FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
cache.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/tree.h"
#include "avformat.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <stdlib.h>
#include "os_support.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  CacheEntry
 support keeping files support filling with a background thread More...
 
struct  Context
 

Macros

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

Functions

static int cmp (const void *key, const void *node)
 
static int cache_open (URLContext *h, const char *arg, int flags, AVDictionary **options)
 
static int add_entry (URLContext *h, const unsigned char *buf, int size)
 
static int cache_read (URLContext *h, unsigned char *buf, int size)
 
static int64_t cache_seek (URLContext *h, int64_t pos, int whence)
 
static int enu_free (void *opaque, void *elem)
 
static int cache_close (URLContext *h)
 

Variables

static const AVOption options []
 
static const AVClass cache_context_class
 
const URLProtocol ff_cache_protocol
 

Macro Definition Documentation

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

Definition at line 307 of file cache.c.

Definition at line 308 of file cache.c.

Function Documentation

static int cmp ( const void key,
const void node 
)
static

Definition at line 68 of file cache.c.

Referenced by add_entry(), and cache_read().

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

Definition at line 73 of file cache.c.

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

Definition at line 93 of file cache.c.

Referenced by cache_read().

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

Definition at line 156 of file cache.c.

Referenced by cache_seek().

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

Definition at line 221 of file cache.c.

static int enu_free ( void opaque,
void elem 
)
static

Definition at line 286 of file cache.c.

Referenced by cache_close().

static int cache_close ( URLContext h)
static

Definition at line 292 of file cache.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "read_ahead_limit", "Amount in bytes that may be read ahead when seeking isn't supported, -1 for unlimited", OFFSET(read_ahead_limit), AV_OPT_TYPE_INT, { .i64 = 65536 }, -1, INT_MAX, D },
{NULL},
}
#define NULL
Definition: coverity.c:32
#define D
Definition: cache.c:308
#define OFFSET(x)
Definition: cache.c:307

Definition at line 310 of file cache.c.

const AVClass cache_context_class
static
Initial value:
= {
.class_name = "Cache",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
static const AVOption options[]
Definition: cache.c:310
av_default_item_name

Definition at line 315 of file cache.c.

const URLProtocol ff_cache_protocol
Initial value:
= {
.name = "cache",
.url_open2 = cache_open,
.url_read = cache_read,
.url_seek = cache_seek,
.url_close = cache_close,
.priv_data_size = sizeof(Context),
.priv_data_class = &cache_context_class,
}
Definition: async.c:56
static const AVClass cache_context_class
Definition: cache.c:315
static int cache_open(URLContext *h, const char *arg, int flags, AVDictionary **options)
Definition: cache.c:73
static int cache_close(URLContext *h)
Definition: cache.c:292
static int64_t cache_seek(URLContext *h, int64_t pos, int whence)
Definition: cache.c:221
static int cache_read(URLContext *h, unsigned char *buf, int size)
Definition: cache.c:156

Definition at line 322 of file cache.c.