FFmpeg
|
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
union | FFRefStructOpaque |
RefStruct is an API for creating reference-counted objects with minimal overhead. More... | |
Macros | |
#define | FF_REFSTRUCT_FLAG_NO_ZEROING (1 << 0) |
If this flag is set in ff_refstruct_alloc_ext_c(), the object will not be initially zeroed. More... | |
Functions | |
void * | ff_refstruct_alloc_ext_c (size_t size, unsigned flags, FFRefStructOpaque opaque, void(*free_cb)(FFRefStructOpaque opaque, void *obj)) |
Allocate a refcounted object of usable size size managed via the RefStruct API. More... | |
static void * | ff_refstruct_alloc_ext (size_t size, unsigned flags, void *opaque, void(*free_cb)(FFRefStructOpaque opaque, void *obj)) |
A wrapper around ff_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque. More... | |
static void * | ff_refstruct_allocz (size_t size) |
Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL) More... | |
void | ff_refstruct_unref (void *objp) |
Decrement the reference count of the underlying object and automatically free the object if there are no more references to it. More... | |
void * | ff_refstruct_ref (void *obj) |
Create a new reference to an object managed via this API, i.e. More... | |
const void * | ff_refstruct_ref_c (const void *obj) |
Analog of ff_refstruct_ref(), but for constant objects. More... | |
void | ff_refstruct_replace (void *dstp, const void *src) |
Ensure *dstp refers to the same object as src. More... | |
int | ff_refstruct_exclusive (const void *obj) |
Check whether the reference count of an object managed via this API is 1. More... | |
#define FF_REFSTRUCT_FLAG_NO_ZEROING (1 << 0) |
If this flag is set in ff_refstruct_alloc_ext_c(), the object will not be initially zeroed.
Definition at line 67 of file refstruct.h.
void* ff_refstruct_alloc_ext_c | ( | size_t | size, |
unsigned | flags, | ||
FFRefStructOpaque | opaque, | ||
void(*)(FFRefStructOpaque opaque, void *obj) | free_cb | ||
) |
Allocate a refcounted object of usable size size
managed via the RefStruct API.
By default (in the absence of flags to the contrary), the returned object is initially zeroed.
size | Desired usable size of the returned object. |
flags | A bitwise combination of FF_REFSTRUCT_FLAG_* flags. |
opaque | A pointer that will be passed to the free_cb callback. |
free_cb | A callback for freeing this object's content when its reference count reaches zero; it must not free the object itself. |
Definition at line 98 of file refstruct.c.
Referenced by cbs_alloc_content(), and ff_refstruct_alloc_ext().
|
inlinestatic |
A wrapper around ff_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
Definition at line 94 of file refstruct.h.
Referenced by ff_cbs_sei_alloc_message_payload(), ff_h264_decode_picture_parameter_set(), ff_hevc_decode_nal_pps(), ff_hwaccel_frame_priv_alloc(), ff_refstruct_allocz(), nvdec_decoder_create(), update_frame_pool(), and vulkan_decode_bootstrap().
|
inlinestatic |
Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL)
Definition at line 105 of file refstruct.h.
Referenced by alloc_frame(), ff_dovi_rpu_parse(), ff_h264_decode_seq_parameter_set(), ff_hevc_decode_nal_sps(), ff_hevc_decode_nal_vps(), ff_hwaccel_frame_priv_alloc(), ff_thread_get_ext_buffer(), sps(), vp8_alloc_frame(), and wv_dsd_reset().
void ff_refstruct_unref | ( | void * | objp | ) |
Decrement the reference count of the underlying object and automatically free the object if there are no more references to it.
*objp == NULL
is legal and a no-op.
objp | Pointer to a pointer that is either NULL or points to an object managed via this API. *objp is set to NULL on return. |
Definition at line 116 of file refstruct.c.
Referenced by av1_decode_free(), av1_frame_unref(), avcodec_close(), cbs_av1_close(), cbs_av1_write_obu(), cbs_clone_noncomplex_unit_content(), cbs_free_user_data_registered(), cbs_free_user_data_unregistered(), cbs_h264_close(), cbs_h264_flush(), cbs_h265_close(), cbs_h265_flush(), cbs_h266_flush(), cbs_read_fragment_content(), cbs_sei_delete_message(), cbs_unit_uninit(), ff_cbs_make_unit_writable(), ff_cbs_sei_free_message_list(), ff_dovi_ctx_flush(), ff_dovi_ctx_unref(), ff_frame_thread_free(), ff_h264_decode_picture_parameter_set(), ff_h264_decode_seq_parameter_set(), ff_h264_ps_uninit(), ff_h264_unref_picture(), ff_hevc_decode_nal_pps(), ff_hevc_decode_nal_sps(), ff_hevc_decode_nal_vps(), ff_hevc_ps_uninit(), ff_hevc_unref_frame(), ff_mpeg_unref_picture(), ff_nvdec_decode_uninit(), ff_refstruct_replace(), ff_thread_get_ext_buffer(), ff_thread_release_ext_buffer(), ff_vk_decode_uninit(), nvdec_decoder_create(), nvdec_fdd_priv_free(), nvdec_unmap_mapped_frame(), pps_free(), remove_pps(), remove_sps(), remove_vps(), update_frame_pool(), vp8_alloc_frame(), vp8_release_frame(), vp9_frame_unref(), vulkan_decode_bootstrap(), wavpack_decode_end(), and wv_dsd_reset().
void* ff_refstruct_ref | ( | void * | obj | ) |
Create a new reference to an object managed via this API, i.e.
increment the reference count of the underlying object and return obj.
Definition at line 136 of file refstruct.c.
Referenced by cbs_av1_write_obu(), ff_cbs_insert_unit_content(), ff_cbs_sei_add_message(), ff_nvdec_start_frame(), ff_thread_ref_frame(), get_current_frame(), and hevc_ref_frame().
const void* ff_refstruct_ref_c | ( | const void * | obj | ) |
Analog of ff_refstruct_ref(), but for constant objects.
Definition at line 145 of file refstruct.c.
Referenced by alloc_picture(), ff_h264_decode_picture_parameter_set(), and ff_refstruct_replace().
void ff_refstruct_replace | ( | void * | dstp, |
const void * | src | ||
) |
Ensure *dstp
refers to the same object as src.
If *dstp
is already equal to src, do nothing. Otherwise unreference *dstp
and replace it with a new reference to src in case src != NULL
(this involves incrementing the reference count of src's underlying object) or with NULL otherwise.
dstp | Pointer to a pointer that is either NULL or points to an object managed via this API. |
src | A pointer to an object managed via this API or NULL. |
Definition at line 156 of file refstruct.c.
Referenced by av1_frame_ref(), av1_receive_frame_internal(), cbs_av1_read_unit(), cbs_h2645_replace_ps(), ff_dovi_ctx_replace(), ff_h264_ref_picture(), ff_h264_replace_picture(), ff_h264_update_thread_context(), ff_mpeg_ref_picture(), ff_thread_replace_frame(), ff_vk_update_thread_context(), h264_copy_picture_params(), h264_init_ps(), hevc_ref_frame(), parse_nal_units(), update_context_from_thread(), and vp9_frame_ref().
int ff_refstruct_exclusive | ( | const void * | obj | ) |
Check whether the reference count of an object managed via this API is 1.
obj | A pointer to an object managed via this API. |
Definition at line 170 of file refstruct.c.
Referenced by ff_cbs_make_unit_writable().