FFmpeg
Data Structures | Macros | Functions | Variables
ipfsgateway.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/file_open.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_gateway_context_class
 
const URLProtocol ff_ipfs_gateway_protocol
 
const URLProtocol ff_ipns_gateway_protocol
 

Macro Definition Documentation

◆ PATH_MAX

#define PATH_MAX   4096

Definition at line 33 of file ipfsgateway.c.

◆ OFFSET

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

Definition at line 325 of file ipfsgateway.c.

Function Documentation

◆ populate_ipfs_gateway()

static int populate_ipfs_gateway ( URLContext h)
static

Definition at line 51 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 198 of file ipfsgateway.c.

◆ ipfs_read()

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

Definition at line 307 of file ipfsgateway.c.

◆ ipfs_seek()

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

Definition at line 313 of file ipfsgateway.c.

◆ ipfs_close()

static int ipfs_close ( URLContext h)
static

Definition at line 319 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 327 of file ipfsgateway.c.

Referenced by translate_ipfs_to_http().

◆ ipfs_gateway_context_class

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

Definition at line 332 of file ipfsgateway.c.

◆ ff_ipfs_gateway_protocol

const URLProtocol ff_ipfs_gateway_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_gateway_context_class,
}

Definition at line 339 of file ipfsgateway.c.

◆ ff_ipns_gateway_protocol

const URLProtocol ff_ipns_gateway_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_gateway_context_class,
}

Definition at line 349 of file ipfsgateway.c.

IPFSGatewayContext
Definition: ipfsgateway.c:36
ipfs_seek
static int64_t ipfs_seek(URLContext *h, int64_t pos, int whence)
Definition: ipfsgateway.c:313
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:325
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
ipfs_gateway_context_class
static const AVClass ipfs_gateway_context_class
Definition: ipfsgateway.c:332
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:198
options
static const AVOption options[]
Definition: ipfsgateway.c:327
ipfs_read
static int ipfs_read(URLContext *h, unsigned char *buf, int size)
Definition: ipfsgateway.c:307
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
ipfs_close
static int ipfs_close(URLContext *h)
Definition: ipfsgateway.c:319