FFmpeg  4.0
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  Context
 

Macros

#define BUFFER_CAPACITY   (4 * 1024 * 1024)
 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(Context, 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_generic_read (RingBuffer *ring, void *dest, int buf_size, void(*func)(void *, void *, int))
 
static int ring_generic_write (RingBuffer *ring, void *src, int size, int(*func)(void *, void *, int))
 
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 int wrapped_url_read (void *src, void *dst, int size)
 
static voidasync_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, int read_complete, void(*func)(void *, void *, int))
 
static int async_read (URLContext *h, unsigned char *buf, int size)
 
static void fifo_do_not_copy_func (void *dest, void *src, 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)

support timeout support work with concatdec, hls

Definition at line 44 of file async.c.

Referenced by async_open().

◆ READ_BACK_CAPACITY

#define READ_BACK_CAPACITY   (4 * 1024 * 1024)

Definition at line 45 of file async.c.

Referenced by async_open().

◆ SHORT_SEEK_THRESHOLD

#define SHORT_SEEK_THRESHOLD   (256 * 1024)

Definition at line 46 of file async.c.

Referenced by async_seek().

◆ OFFSET

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

Definition at line 465 of file async.c.

◆ D

Definition at line 466 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_generic_write().

◆ ring_generic_read()

static int ring_generic_read ( RingBuffer ring,
void dest,
int  buf_size,
void(*)(void *, void *, int func 
)
static

Definition at line 115 of file async.c.

Referenced by async_read_internal().

◆ ring_generic_write()

static int ring_generic_write ( RingBuffer ring,
void src,
int  size,
int(*)(void *, void *, int func 
)
static

Definition at line 131 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 137 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 142 of file async.c.

Referenced by async_seek().

◆ async_check_interrupt()

static int async_check_interrupt ( void arg)
static

Definition at line 150 of file async.c.

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

◆ wrapped_url_read()

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

Definition at line 164 of file async.c.

Referenced by async_buffer_task().

◆ async_buffer_task()

static void* async_buffer_task ( void arg)
static

Definition at line 176 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 240 of file async.c.

◆ async_close()

static int async_close ( URLContext h)
static

Definition at line 303 of file async.c.

◆ async_read_internal()

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

Definition at line 326 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 373 of file async.c.

◆ fifo_do_not_copy_func()

static void fifo_do_not_copy_func ( void dest,
void src,
int  size 
)
static

Definition at line 378 of file async.c.

Referenced by async_seek().

◆ async_seek()

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

Definition at line 382 of file async.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{NULL},
}
#define NULL
Definition: coverity.c:32

Definition at line 468 of file async.c.

◆ async_context_class

const AVClass async_context_class
static
Initial value:
= {
.class_name = "Async",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
static const AVOption options[]
Definition: async.c:468

Definition at line 475 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(Context),
.priv_data_class = &async_context_class,
}
Definition: async.c:56
static const AVClass async_context_class
Definition: async.c:475
static int64_t async_seek(URLContext *h, int64_t pos, int whence)
Definition: async.c:382
static int async_open(URLContext *h, const char *arg, int flags, AVDictionary **options)
Definition: async.c:240
static int async_close(URLContext *h)
Definition: async.c:303
static int async_read(URLContext *h, unsigned char *buf, int size)
Definition: async.c:373

Definition at line 482 of file async.c.