FFmpeg
Data Structures | Macros | Functions | Variables
ipfsgateway.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/getenv_utf8.h"
#include "libavutil/opt.h"
#include <sys/stat.h>
#include "os_support.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  IPFSGatewayContext
 

Macros

#define PATH_MAX   4096
 
#define OFFSET(x)   offsetof(IPFSGatewayContext, x)
 

Functions

static int populate_ipfs_gateway (URLContext *h)
 
static int translate_ipfs_to_http (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int ipfs_read (URLContext *h, unsigned char *buf, int size)
 
static int64_t ipfs_seek (URLContext *h, int64_t pos, int whence)
 
static int ipfs_close (URLContext *h)
 

Variables

static const AVOption options []
 
static const AVClass ipfs_context_class
 
const URLProtocol ff_ipfs_protocol
 
const URLProtocol ff_ipns_protocol
 

Macro Definition Documentation

◆ PATH_MAX

#define PATH_MAX   4096

Definition at line 32 of file ipfsgateway.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(IPFSGatewayContext, x)

Definition at line 324 of file ipfsgateway.c.

Function Documentation

◆ populate_ipfs_gateway()

static int populate_ipfs_gateway ( URLContext h)
static

Definition at line 50 of file ipfsgateway.c.

Referenced by translate_ipfs_to_http().

◆ translate_ipfs_to_http()

static int translate_ipfs_to_http ( URLContext h,
const char *  uri,
int  flags,
AVDictionary **  options 
)
static

Definition at line 197 of file ipfsgateway.c.

◆ ipfs_read()

static int ipfs_read ( URLContext h,
unsigned char *  buf,
int  size 
)
static

Definition at line 306 of file ipfsgateway.c.

◆ ipfs_seek()

static int64_t ipfs_seek ( URLContext h,
int64_t  pos,
int  whence 
)
static

Definition at line 312 of file ipfsgateway.c.

◆ ipfs_close()

static int ipfs_close ( URLContext h)
static

Definition at line 318 of file ipfsgateway.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{"gateway", "The gateway to ask for IPFS data.", OFFSET(gateway), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM},
{NULL},
}

Definition at line 326 of file ipfsgateway.c.

Referenced by translate_ipfs_to_http().

◆ ipfs_context_class

const AVClass ipfs_context_class
static
Initial value:
= {
.class_name = "IPFS",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 331 of file ipfsgateway.c.

◆ ff_ipfs_protocol

const URLProtocol ff_ipfs_protocol
Initial value:
= {
.name = "ipfs",
.url_open2 = translate_ipfs_to_http,
.url_read = ipfs_read,
.url_seek = ipfs_seek,
.url_close = ipfs_close,
.priv_data_size = sizeof(IPFSGatewayContext),
.priv_data_class = &ipfs_context_class,
}

Definition at line 338 of file ipfsgateway.c.

◆ ff_ipns_protocol

const URLProtocol ff_ipns_protocol
Initial value:
= {
.name = "ipns",
.url_open2 = translate_ipfs_to_http,
.url_read = ipfs_read,
.url_seek = ipfs_seek,
.url_close = ipfs_close,
.priv_data_size = sizeof(IPFSGatewayContext),
.priv_data_class = &ipfs_context_class,
}

Definition at line 348 of file ipfsgateway.c.

IPFSGatewayContext
Definition: ipfsgateway.c:35
ipfs_seek
static int64_t ipfs_seek(URLContext *h, int64_t pos, int whence)
Definition: ipfsgateway.c:312
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: ipfsgateway.c:324
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
ipfs_context_class
static const AVClass ipfs_context_class
Definition: ipfsgateway.c:331
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:282
translate_ipfs_to_http
static int translate_ipfs_to_http(URLContext *h, const char *uri, int flags, AVDictionary **options)
Definition: ipfsgateway.c:197
options
static const AVOption options[]
Definition: ipfsgateway.c:326
ipfs_read
static int ipfs_read(URLContext *h, unsigned char *buf, int size)
Definition: ipfsgateway.c:306
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
ipfs_close
static int ipfs_close(URLContext *h)
Definition: ipfsgateway.c:318