FFmpeg
Loading...
Searching...
No Matches
cache.c File Reference
#include <inttypes.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/error.h"
#include "libavutil/file_open.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/tree.h"
#include "avio.h"
#include <fcntl.h>
#include <sys/stat.h>
#include "os_support.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  CacheEntry
 @TODO support keeping files support filling with a background thread More...
 
struct  CacheContext
 

Macros

#define OFFSET(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

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(CacheContext, x)

Definition at line 323 of file cache.c.

◆ D

Definition at line 324 of file cache.c.

Function Documentation

◆ cmp()

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

Definition at line 72 of file cache.c.

◆ cache_open()

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

Definition at line 77 of file cache.c.

◆ add_entry()

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

Definition at line 102 of file cache.c.

Referenced by cache_read().

◆ cache_read()

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

Definition at line 165 of file cache.c.

Referenced by cache_seek().

◆ cache_seek()

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

Definition at line 230 of file cache.c.

◆ enu_free()

static int enu_free ( void * opaque,
void * elem )
static

Definition at line 295 of file cache.c.

Referenced by cache_close(), and ff_nut_free_sp().

◆ cache_close()

static int cache_close ( URLContext * h)
static

Definition at line 301 of file cache.c.

Variable Documentation

◆ options

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 D
Definition avdct.c:35
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 326 of file cache.c.

◆ cache_context_class

const AVClass cache_context_class
static
Initial value:
= {
.class_name = "cache",
.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 331 of file cache.c.

◆ ff_cache_protocol

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(CacheContext),
.priv_data_class = &cache_context_class,
}
static int cache_close(URLContext *h)
Definition cache.c:301
static int cache_open(URLContext *h, const char *arg, int flags, AVDictionary **options)
Definition cache.c:77
static const AVClass cache_context_class
Definition cache.c:331
static int64_t cache_seek(URLContext *h, int64_t pos, int whence)
Definition cache.c:230
static int cache_read(URLContext *h, unsigned char *buf, int size)
Definition cache.c:165

Definition at line 338 of file cache.c.