FFmpeg
Data Structures | Macros | Functions | Variables
async.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/error.h"
#include "libavutil/fifo.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "url.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  RingBuffer
 
struct  AsyncContext
 

Macros

#define BUFFER_CAPACITY   (4 * 1024 * 1024)
 @TODO support timeout support work with concatdec, hls More...
 
#define READ_BACK_CAPACITY   (4 * 1024 * 1024)
 
#define SHORT_SEEK_THRESHOLD   (256 * 1024)
 
#define OFFSET(x)   offsetof(AsyncContext, x)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 

Functions

static int ring_init (RingBuffer *ring, unsigned int capacity, int read_back_capacity)
 
static void ring_destroy (RingBuffer *ring)
 
static void ring_reset (RingBuffer *ring)
 
static int ring_size (RingBuffer *ring)
 
static int ring_space (RingBuffer *ring)
 
static int ring_read (RingBuffer *ring, void *dest, int buf_size)
 
static int wrapped_url_read (void *src, void *dst, size_t *size)
 
static int ring_write (RingBuffer *ring, URLContext *h, size_t size)
 
static int ring_size_of_read_back (RingBuffer *ring)
 
static int ring_drain (RingBuffer *ring, int offset)
 
static int async_check_interrupt (void *arg)
 
static void * async_buffer_task (void *arg)
 
static int async_open (URLContext *h, const char *arg, int flags, AVDictionary **options)
 
static int async_close (URLContext *h)
 
static int async_read_internal (URLContext *h, void *dest, int size)
 
static int async_read (URLContext *h, unsigned char *buf, int size)
 
static int64_t async_seek (URLContext *h, int64_t pos, int whence)
 

Variables

static const AVOption options []
 
static const AVClass async_context_class
 
const URLProtocol ff_async_protocol
 

Macro Definition Documentation

◆ BUFFER_CAPACITY

#define BUFFER_CAPACITY   (4 * 1024 * 1024)

@TODO support timeout support work with concatdec, hls

Definition at line 44 of file async.c.

◆ READ_BACK_CAPACITY

#define READ_BACK_CAPACITY   (4 * 1024 * 1024)

Definition at line 45 of file async.c.

◆ SHORT_SEEK_THRESHOLD

#define SHORT_SEEK_THRESHOLD   (256 * 1024)

Definition at line 46 of file async.c.

◆ OFFSET

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

Definition at line 475 of file async.c.

◆ D

Definition at line 476 of file async.c.

Function Documentation

◆ ring_init()

static int ring_init ( RingBuffer ring,
unsigned int  capacity,
int  read_back_capacity 
)
static

Definition at line 83 of file async.c.

Referenced by async_open().

◆ ring_destroy()

static void ring_destroy ( RingBuffer ring)
static

Definition at line 94 of file async.c.

Referenced by async_close(), and async_open().

◆ ring_reset()

static void ring_reset ( RingBuffer ring)
static

Definition at line 99 of file async.c.

Referenced by async_buffer_task().

◆ ring_size()

static int ring_size ( RingBuffer ring)
static

◆ ring_space()

static int ring_space ( RingBuffer ring)
static

Definition at line 110 of file async.c.

Referenced by async_buffer_task(), and ring_write().

◆ ring_read()

static int ring_read ( RingBuffer ring,
void *  dest,
int  buf_size 
)
static

Definition at line 115 of file async.c.

Referenced by async_read_internal().

◆ wrapped_url_read()

static int wrapped_url_read ( void *  src,
void *  dst,
size_t *  size 
)
static

Definition at line 132 of file async.c.

Referenced by ring_write().

◆ ring_write()

static int ring_write ( RingBuffer ring,
URLContext h,
size_t  size 
)
static

Definition at line 145 of file async.c.

Referenced by async_buffer_task().

◆ ring_size_of_read_back()

static int ring_size_of_read_back ( RingBuffer ring)
static

Definition at line 157 of file async.c.

Referenced by async_seek(), and ring_drain().

◆ ring_drain()

static int ring_drain ( RingBuffer ring,
int  offset 
)
static

Definition at line 162 of file async.c.

Referenced by async_seek().

◆ async_check_interrupt()

static int async_check_interrupt ( void *  arg)
static

Definition at line 170 of file async.c.

Referenced by async_buffer_task(), async_open(), async_read_internal(), and async_seek().

◆ async_buffer_task()

static void* async_buffer_task ( void *  arg)
static

Definition at line 184 of file async.c.

Referenced by async_open().

◆ async_open()

static int async_open ( URLContext h,
const char *  arg,
int  flags,
AVDictionary **  options 
)
static

Definition at line 250 of file async.c.

◆ async_close()

static int async_close ( URLContext h)
static

Definition at line 317 of file async.c.

◆ async_read_internal()

static int async_read_internal ( URLContext h,
void *  dest,
int  size 
)
static

Definition at line 340 of file async.c.

Referenced by async_read(), and async_seek().

◆ async_read()

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

Definition at line 387 of file async.c.

◆ async_seek()

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

Definition at line 392 of file async.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{NULL},
}

Definition at line 478 of file async.c.

Referenced by async_open().

◆ async_context_class

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

Definition at line 485 of file async.c.

◆ ff_async_protocol

const URLProtocol ff_async_protocol
Initial value:
= {
.name = "async",
.url_open2 = async_open,
.url_read = async_read,
.url_seek = async_seek,
.url_close = async_close,
.priv_data_size = sizeof(AsyncContext),
.priv_data_class = &async_context_class,
}

Definition at line 492 of file async.c.

async_close
static int async_close(URLContext *h)
Definition: async.c:317
options
static const AVOption options[]
Definition: async.c:478
AsyncContext
Definition: async.c:56
async_context_class
static const AVClass async_context_class
Definition: async.c:485
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
async_open
static int async_open(URLContext *h, const char *arg, int flags, AVDictionary **options)
Definition: async.c:250
async_read
static int async_read(URLContext *h, unsigned char *buf, int size)
Definition: async.c:387
async_seek
static int64_t async_seek(URLContext *h, int64_t pos, int whence)
Definition: async.c:392