19 #include <stdatomic.h>
31 void *opaque,
int flags)
120 b->free(
b->opaque,
b->data);
247 void (*pool_free)(
void *opaque))
318 if (!ppool || !*ppool)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void buffer_pool_flush(AVBufferPool *pool)
static void buffer_pool_free(AVBufferPool *pool)
static void buffer_replace(AVBufferRef **dst, AVBufferRef **src)
static AVBufferRef * pool_alloc_buffer(AVBufferPool *pool)
static void pool_release_buffer(void *opaque, uint8_t *data)
#define BUFFER_FLAG_REALLOCATABLE
The buffer was av_realloc()ed, so it is reallocatable.
#define flags(name, subs,...)
common internal and external API header
#define CONFIG_MEMORY_POISONING
#define atomic_fetch_add_explicit(object, operand, order)
#define atomic_load(object)
#define atomic_init(obj, value)
#define atomic_fetch_sub_explicit(object, operand, order)
int av_buffer_is_writable(const AVBufferRef *buf)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_allocz(buffer_size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
AVBufferRef * av_buffer_create(uint8_t *data, buffer_size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
AVBufferRef * av_buffer_alloc(buffer_size_t size)
Allocate an AVBuffer of the given size using av_malloc().
int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src)
Ensure dst refers to the same data as src.
int av_buffer_get_ref_count(const AVBufferRef *buf)
int av_buffer_make_writable(AVBufferRef **pbuf)
Create a writable reference from a given buffer reference, avoiding data copy if possible.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
void * av_buffer_get_opaque(const AVBufferRef *buf)
int av_buffer_realloc(AVBufferRef **pbuf, buffer_size_t size)
Reallocate a given buffer.
AVBufferPool * av_buffer_pool_init(buffer_size_t size, AVBufferRef *(*alloc)(buffer_size_t size))
Allocate and initialize a buffer pool.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
AVBufferPool * av_buffer_pool_init2(buffer_size_t size, void *opaque, AVBufferRef *(*alloc)(void *opaque, buffer_size_t size), void(*pool_free)(void *opaque))
Allocate and initialize a buffer pool with a more complex allocator.
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
void * av_buffer_pool_buffer_get_opaque(AVBufferRef *ref)
Query the original opaque parameter of an allocated buffer in the pool.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int ff_mutex_unlock(AVMutex *mutex)
static int ff_mutex_lock(AVMutex *mutex)
static int ff_mutex_destroy(AVMutex *mutex)
static int ff_mutex_init(AVMutex *mutex, const void *attr)
Memory handling functions.
AVBufferRef *(* alloc2)(void *opaque, buffer_size_t size)
void(* pool_free)(void *opaque)
AVBufferRef *(* alloc)(buffer_size_t size)
A reference to a data buffer.
int size
Size of data in bytes.
uint8_t * data
The data buffer.
A reference counted buffer type.
void(* free)(void *opaque, uint8_t *data)
a callback for freeing the data
atomic_uint refcount
number of existing AVBufferRef instances referring to this buffer
buffer_size_t size
size of data in bytes
int flags
A combination of AV_BUFFER_FLAG_*.
uint8_t * data
data described by this buffer
int flags_internal
A combination of BUFFER_FLAG_*.
void * opaque
an opaque pointer, to be used by the freeing callback
struct BufferPoolEntry * next
void(* free)(void *opaque, uint8_t *data)
static int ref[MAX_W *MAX_W]