Go to the documentation of this file.
19 #include <stdatomic.h>
31 void *opaque,
int flags)
120 b->free(
b->opaque,
b->data);
220 void (*pool_free)(
void *opaque))
280 if (!ppool || !*ppool)
294 if(CONFIG_MEMORY_POISONING)
331 ret->buffer->opaque = buf;
static int ff_mutex_init(AVMutex *mutex, const void *attr)
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int av_buffer_realloc(AVBufferRef **pbuf, int size)
Reallocate a given buffer.
uint8_t * data
The data buffer.
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
#define BUFFER_FLAG_REALLOCATABLE
The buffer was av_realloc()ed, so it is reallocatable.
static int ff_mutex_unlock(AVMutex *mutex)
int size
Size of data in bytes.
AVBufferPool * av_buffer_pool_init(int size, AVBufferRef *(*alloc)(int size))
Allocate and initialize a buffer pool.
void * av_buffer_pool_buffer_get_opaque(AVBufferRef *ref)
Query the original opaque parameter of an allocated buffer in the pool.
int flags
A combination of AV_BUFFER_FLAG_*.
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
static void buffer_replace(AVBufferRef **dst, AVBufferRef **src)
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
static void pool_release_buffer(void *opaque, uint8_t *data)
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void(* free)(void *opaque, uint8_t *data)
a callback for freeing the data
#define atomic_load(object)
int flags_internal
A combination of BUFFER_FLAG_*.
static void buffer_pool_free(AVBufferPool *pool)
void * opaque
an opaque pointer, to be used by the freeing callback
void(* pool_free)(void *opaque)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
uint8_t * data
data described by this buffer
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
void(* free)(void *opaque, uint8_t *data)
static AVBufferRef * pool_alloc_buffer(AVBufferPool *pool)
#define atomic_fetch_sub_explicit(object, operand, order)
static int ff_mutex_destroy(AVMutex *mutex)
int size
size of data in bytes
AVBufferRef *(* alloc)(int size)
#define atomic_fetch_add_explicit(object, operand, order)
AVBufferRef *(* alloc2)(void *opaque, int size)
int av_buffer_make_writable(AVBufferRef **pbuf)
Create a writable reference from a given buffer reference, avoiding data copy if possible.
int av_buffer_get_ref_count(const AVBufferRef *buf)
static int ff_mutex_lock(AVMutex *mutex)
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
A reference counted buffer type.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
AVBufferPool * av_buffer_pool_init2(int size, void *opaque, AVBufferRef *(*alloc)(void *opaque, int size), void(*pool_free)(void *opaque))
Allocate and initialize a buffer pool with a more complex allocator.
struct BufferPoolEntry * next
int av_buffer_is_writable(const AVBufferRef *buf)
static int ref[MAX_W *MAX_W]
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
void * av_buffer_get_opaque(const AVBufferRef *buf)
A reference to a data buffer.
#define flags(name, subs,...)
#define atomic_init(obj, value)
atomic_uint refcount
number of existing AVBufferRef instances referring to this buffer