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/mem.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 34 of file ipfsgateway.c.

◆ OFFSET

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

Definition at line 326 of file ipfsgateway.c.

Function Documentation

◆ populate_ipfs_gateway()

static int populate_ipfs_gateway ( URLContext h)
static

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

◆ ipfs_read()

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

Definition at line 308 of file ipfsgateway.c.

◆ ipfs_seek()

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

Definition at line 314 of file ipfsgateway.c.

◆ ipfs_close()

static int ipfs_close ( URLContext h)
static

Definition at line 320 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 328 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 333 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 340 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 350 of file ipfsgateway.c.

IPFSGatewayContext
Definition: ipfsgateway.c:37
ipfs_seek
static int64_t ipfs_seek(URLContext *h, int64_t pos, int whence)
Definition: ipfsgateway.c:314
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:326
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:333
translate_ipfs_to_http
static int translate_ipfs_to_http(URLContext *h, const char *uri, int flags, AVDictionary **options)
Definition: ipfsgateway.c:199
options
static const AVOption options[]
Definition: ipfsgateway.c:328
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:356
ipfs_read
static int ipfs_read(URLContext *h, unsigned char *buf, int size)
Definition: ipfsgateway.c:308
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
ipfs_close
static int ipfs_close(URLContext *h)
Definition: ipfsgateway.c:320