AVBuffer is an API for reference-counted data buffers. More...
AVBuffer is an API for reference-counted data buffers.
There are two core objects in this API – AVBuffer and AVBufferRef. AVBuffer represents the data buffer itself; it is opaque and not meant to be accessed by the caller directly, but only through AVBufferRef. However, the caller may e.g. compare two AVBuffer pointers to check whether two different references are describing the same data buffer. AVBufferRef represents a single reference to an AVBuffer and it is the object that may be manipulated by the caller directly.
There are two functions provided for creating a new AVBuffer with a single reference – av_buffer_alloc() to just allocate a new buffer, and av_buffer_create() to wrap an existing array in an AVBuffer. From an existing reference, additional references may be created with av_buffer_ref(). Use av_buffer_unref() to free a reference (this will automatically free the data once all the references are freed).
The convention throughout this API and the rest of FFmpeg is such that the buffer is considered writable if there exists only one reference to it (and it has not been marked as read-only). The av_buffer_is_writable() function is provided to check whether this is true and av_buffer_make_writable() will automatically create a new writable buffer when necessary. Of course nothing prevents the calling code from violating this convention, however that is safe only when all the existing references are under its control.
Always treat the buffer as read-only, even when it has only one reference.
Definition at line 113 of file buffer.h.
Referenced by av_buffer_create(), av_buffer_is_writable(), dxva2_get_buffer(), vda_h264_end_frame(), and vdpau_get_buffer().
Allocate an AVBuffer of the given size using av_malloc().
Definition at line 65 of file buffer.c.
Referenced by asf_parse_packet(), av_buffer_allocz(), av_buffer_make_writable(), av_buffer_pool_init(), av_grow_packet(), av_packet_merge_side_data(), ff_flac_parse_picture(), ff_mjpeg_decode_frame(), get_audio_buffer(), get_video_buffer(), mpegts_push_data(), raw_decode(), raw_init_decoder(), read_apic(), thread_get_buffer_internal(), and vda_h264_alloc_frame().
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
Definition at line 81 of file buffer.c.
Referenced by alloc_frame(), alloc_frame_buffer(), alloc_picture(), alloc_picture_tables(), ff_er_frame_end(), ff_hevc_decode_nal_sps(), ff_hevc_decode_nal_vps(), get_buffer(), init_table_pools(), pic_arrays_init(), update_frame_pool(), vp8_alloc_frame(), and vp9_alloc_frame().
Create an AVBuffer from an existing array.
If this function is successful, data is owned by the AVBuffer. The caller may only access data through the returned AVBufferRef and references derived from it. If this function fails, data is left untouched.
Definition at line 27 of file buffer.c.
Referenced by av_buffer_alloc(), av_buffer_pool_get(), av_buffer_realloc(), av_packet_from_data(), dxva2_get_buffer(), ff_hevc_decode_nal_pps(), filter_packet(), get_buffer2(), get_buffer_internal(), mmap_read_frame(), vda_h264_end_frame(), vda_old_h264_end_frame(), vdpau_get_buffer(), and write_frame().
Default free callback, which calls av_free() on the buffer data.
This function is meant to be passed to av_buffer_create(), not called directly.
Definition at line 60 of file buffer.c.
Referenced by av_buffer_alloc(), av_buffer_create(), av_buffer_realloc(), av_packet_from_data(), filter_packet(), and write_frame().
Create a new reference to an AVBuffer.
Definition at line 91 of file buffer.c.
Referenced by av_frame_copy_props(), av_frame_ref(), av_packet_ref(), avformat_queue_attached_pictures(), copy_packet_data(), ff_h264_ref_picture(), ff_hevc_decode_nal_sps(), ff_mpeg_ref_picture(), ff_mpv_export_qp_table(), ff_thread_ref_frame(), hevc_ref_frame(), hevc_update_thread_context(), join_request_frame(), mkv_write_packet(), raw_decode(), and vp9_ref_frame().
Free a given reference and automatically free the buffer if there are no more references to it.
Definition at line 105 of file buffer.c.
Referenced by asf_parse_packet(), av_buffer_make_writable(), av_buffer_realloc(), av_frame_set_qp_table(), av_frame_unref(), av_free_packet(), av_packet_unref(), compat_release_buffer(), ff_er_frame_end(), ff_flac_parse_picture(), ff_free_picture_tables(), ff_h264_unref_picture(), ff_hevc_decode_nal_pps(), ff_hevc_decode_nal_sps(), ff_hevc_decode_nal_vps(), ff_hevc_unref_frame(), ff_mpeg_unref_picture(), ff_thread_release_buffer(), free_apic(), free_picture(), get_buffer_internal(), get_video_buffer(), handle_packets(), hevc_close(), hevc_decode_free(), hevc_update_thread_context(), mpegts_close_filter(), pool_alloc_buffer(), raw_close_decoder(), raw_decode(), reset_pes_packet_state(), thread_get_buffer_internal(), vda_h264_end_frame(), vdpau_get_buffer(), vp8_release_frame(), and vp9_unref_frame().
Definition at line 120 of file buffer.c.
Referenced by av_buffer_make_writable(), av_buffer_realloc(), and av_frame_is_writable().
Definition at line 128 of file buffer.c.
Referenced by vdadec_decode().
Definition at line 133 of file buffer.c.
Referenced by ff_h264_decode_ref_pic_list_reordering().
Create a writable reference from a given buffer reference, avoiding data copy if possible.
Reallocate a given buffer.
Definition at line 156 of file buffer.c.
Referenced by av_buffer_realloc(), av_grow_packet(), avcodec_encode_audio2(), avcodec_encode_video2(), and packet_alloc().