FFmpeg
Loading...
Searching...
No Matches
ipfsgateway.c File Reference
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/error.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)
 

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 37 of file ipfsgateway.c.

Referenced by populate_ipfs_gateway().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 329 of file ipfsgateway.c.

Function Documentation

◆ populate_ipfs_gateway()

static int populate_ipfs_gateway ( URLContext * h)
static

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

◆ ipfs_read()

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

Definition at line 311 of file ipfsgateway.c.

◆ ipfs_seek()

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

Definition at line 317 of file ipfsgateway.c.

◆ ipfs_close()

static int ipfs_close ( URLContext * h)
static

Definition at line 323 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},
}
#define NULL
Definition coverity.c:32
#define OFFSET(x)
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition opt.h:355
@ 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:275

Definition at line 331 of file ipfsgateway.c.

◆ 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,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 336 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,
}
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)
static int translate_ipfs_to_http(URLContext *h, const char *uri, int flags, AVDictionary **options)
static const AVClass ipfs_gateway_context_class

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