FFmpeg
[フレーム]
Files | Macros | Typedefs | Functions
AVFifo
libavutil » Data Structures

Files

file   fifo.h
 

Macros

#define  AV_FIFO_FLAG_AUTO_GROW   (1 << 0)
  Automatically resize the FIFO on writes, so that the data fits. More...
 

Typedefs

typedef int  AVFifoCB(void *opaque, void *buf, size_t *nb_elems)
  Callback for writing or reading from a FIFO, passed to (and invoked from) the av_fifo_*_cb() functions. More...
 

Functions

AVFifoav_fifo_alloc2 (size_t elems, size_t elem_size, unsigned int flags)
  Allocate and initialize an AVFifo with a given element size. More...
 
size_t  av_fifo_elem_size (const AVFifo *f)
 
void  av_fifo_auto_grow_limit (AVFifo *f, size_t max_elems)
  Set the maximum size (in elements) to which the FIFO can be resized automatically. More...
 
size_t  av_fifo_can_read (const AVFifo *f)
 
size_t  av_fifo_can_write (const AVFifo *f)
 
int  av_fifo_grow2 (AVFifo *f, size_t inc)
  Enlarge an AVFifo. More...
 
int  av_fifo_write (AVFifo *f, const void *buf, size_t nb_elems)
  Write data into a FIFO. More...
 
int  av_fifo_write_from_cb (AVFifo *f, AVFifoCB read_cb, void *opaque, size_t *nb_elems)
  Write data from a user-provided callback into a FIFO. More...
 
int  av_fifo_read (AVFifo *f, void *buf, size_t nb_elems)
  Read data from a FIFO. More...
 
int  av_fifo_read_to_cb (AVFifo *f, AVFifoCB write_cb, void *opaque, size_t *nb_elems)
  Feed data from a FIFO into a user-provided callback. More...
 
int  av_fifo_peek (const AVFifo *f, void *buf, size_t nb_elems, size_t offset)
  Read data from a FIFO without modifying FIFO state. More...
 
int  av_fifo_peek_to_cb (const AVFifo *f, AVFifoCB write_cb, void *opaque, size_t *nb_elems, size_t offset)
  Feed data from a FIFO into a user-provided callback. More...
 
void  av_fifo_drain2 (AVFifo *f, size_t size)
  Discard the specified amount of data from an AVFifo. More...
 
 
void  av_fifo_freep2 (AVFifo **f)
  Free an AVFifo and reset pointer to NULL. More...
 

Detailed Description

A generic FIFO API

Macro Definition Documentation

AV_FIFO_FLAG_AUTO_GROW

#define AV_FIFO_FLAG_AUTO_GROW   (1 << 0)

Automatically resize the FIFO on writes, so that the data fits.

This automatic resizing happens up to a limit that can be modified with av_fifo_auto_grow_limit().

Definition at line 63 of file fifo.h.

Typedef Documentation

AVFifoCB

typedef int AVFifoCB(void *opaque, void *buf, size_t *nb_elems)

Callback for writing or reading from a FIFO, passed to (and invoked from) the av_fifo_*_cb() functions.

It may be invoked multiple times from a single av_fifo_*_cb() call and may process less data than the maximum size indicated by nb_elems.

Parameters
opaque the opaque pointer provided to the av_fifo_*_cb() function
buf the buffer for reading or writing the data, depending on which av_fifo_*_cb function is called
nb_elems On entry contains the maximum number of elements that can be read from / written into buf. On success, the callback should update it to contain the number of elements actually written.
Returns
0 on success, a negative error code on failure (will be returned from the invoking av_fifo_*_cb() function)

Definition at line 56 of file fifo.h.

Function Documentation

av_fifo_alloc2()

AVFifo* av_fifo_alloc2 ( size_t  elems,
size_t  elem_size,
unsigned int  flags 
)

Allocate and initialize an AVFifo with a given element size.

Parameters
elems initial number of elements that can be stored in the FIFO
elem_size Size in bytes of a single element. Further operations on the returned FIFO will implicitly use this element size.
flags a combination of AV_FIFO_FLAG_*
Returns
newly-allocated AVFifo on success, a negative error code on failure

Definition at line 47 of file fifo.c.

Referenced by av1_decode_init(), av_audio_fifo_alloc(), av_container_fifo_alloc(), av_thread_message_queue_alloc(), config_input(), cuvid_decode_init(), d3d12va_encode_create_command_objects(), deshake_opencl_init(), dnn_detect_init(), dts2pts_init(), dv_init_mux(), ff_amf_encode_init(), ff_ccfifo_init(), ff_d3d12va_decode_init(), ff_d3d12va_encode_init(), ff_qsv_enc_init(), ff_qsvvpp_init(), ff_vaapi_encode_init(), ff_vulkan_encode_init(), fg_thread_init(), ifilter_alloc(), init(), input_init(), libvorbis_encode_init(), main(), mediacodec_init_async_state(), mpeg_mux_init(), nvenc_setup_surfaces(), oh_decode_init(), oh_encode_init(), packet_queue_init(), qsv_decode_init(), qsv_decode_preinit(), ring_init(), sch_add_mux_stream(), start_jack(), swf_write_header(), tq_alloc(), udp_open(), and vpx_init().

av_fifo_elem_size()

size_t av_fifo_elem_size ( const AVFifof )
Returns
Element size for FIFO operations. This element size is set at FIFO allocation and remains constant during its lifetime

Definition at line 82 of file fifo.c.

Referenced by main().

av_fifo_auto_grow_limit()

void av_fifo_auto_grow_limit ( AVFifof,
size_t  max_elems 
)

Set the maximum size (in elements) to which the FIFO can be resized automatically.

Has no effect unless AV_FIFO_FLAG_AUTO_GROW is used.

Definition at line 77 of file fifo.c.

av_fifo_can_read()

size_t av_fifo_can_read ( const AVFifof )
Returns
number of elements available for reading from the given FIFO.

Definition at line 87 of file fifo.c.

Referenced by activate(), amf_copy_buffer(), av_audio_fifo_realloc(), av_container_fifo_can_read(), av_container_fifo_drain(), av_fifo_can_write(), av_fifo_drain2(), av_thread_message_flush(), av_thread_message_queue_nb_elems(), cuvid_decode_packet(), cuvid_is_buffer_full(), dnn_detect_fill_side_data(), dnn_detect_uninit(), dts2pts_filter(), dv_assemble_frame(), ff_amf_encode_close(), ff_ccfifo_injectbytes(), ff_hw_base_encode_receive_packet(), ff_qsv_encode(), ff_qsvvpp_filter_frame(), fifo_peek_common(), flush_packet(), main(), mediacodec_get_input_index(), mpeg_mux_end(), mpeg_mux_write_packet(), mux_queue_packet(), output_packet(), output_ready(), process_callback(), qsv_decode(), qsv_decode_frame(), ring_size(), swf_write_video(), udp_read(), and uninit().

av_fifo_can_write()

size_t av_fifo_can_write ( const AVFifof )
Returns
Number of elements that can be written into the given FIFO without growing it.

In other words, this number of elements or less is guaranteed to fit into the FIFO. More data may be written when the AV_FIFO_FLAG_AUTO_GROW flag was specified at FIFO creation, but this may involve memory allocation, which can fail.

Definition at line 94 of file fifo.c.

Referenced by activate(), av_audio_fifo_realloc(), dts2pts_filter(), dv_assemble_frame(), ff_hw_base_encode_receive_packet(), fifo_check_space(), libvorbis_encode_frame(), main(), mpeg_mux_write_packet(), mux_queue_packet(), process_callback(), ring_space(), ringbuf_float_at(), supply_new_packets(), swf_write_audio(), tq_send(), and udp_write().

av_fifo_grow2()

int av_fifo_grow2 ( AVFifof,
size_t  inc 
)

Enlarge an AVFifo.

On success, the FIFO will be large enough to hold exactly inc + av_fifo_can_read() + av_fifo_can_write() elements. In case of failure, the old FIFO is kept unchanged.

Parameters
f AVFifo to resize
inc number of elements to allocate for, in addition to the current allocated size
Returns
a non-negative number on success, a negative error code on failure

Definition at line 99 of file fifo.c.

Referenced by av_audio_fifo_realloc(), fifo_check_space(), main(), mpeg_mux_write_packet(), and mux_queue_packet().

av_fifo_write()

int av_fifo_write ( AVFifof,
const void *  buf,
size_t  nb_elems 
)

Write data into a FIFO.

In case nb_elems > av_fifo_can_write(f) and the AV_FIFO_FLAG_AUTO_GROW flag was not specified at FIFO creation, nothing is written and an error is returned.

Calling function is guaranteed to succeed if nb_elems <= av_fifo_can_write(f).

Parameters
f the FIFO buffer
buf Data to be written. nb_elems * av_fifo_elem_size(f) bytes will be read from buf on success.
nb_elems number of elements to write into FIFO
Returns
a non-negative number on success, a negative error code on failure

Definition at line 188 of file fifo.c.

Referenced by activate(), amf_submit_frame(), av1_receive_frame_internal(), av_audio_fifo_write(), av_container_fifo_write(), cuvid_handle_picture_display(), d3d12va_discard_command_allocator(), d3d12va_discard_helper_objects(), dnn_detect_parse_yolo_output(), dv_assemble_frame(), encode_frame(), ff_amf_receive_packet(), ff_ccfifo_extractbytes(), ff_hw_base_encode_receive_packet(), ff_nvenc_receive_packet(), ff_qsvvpp_filter_frame(), filter_frame(), frame_data_submit(), h264_queue_frame(), handle_input(), libvorbis_encode_frame(), main(), mpeg_mux_write_packet(), mux_queue_packet(), nvenc_alloc_surface(), nvenc_send_frame(), oh_decode_on_need_input(), oh_decode_on_output(), oh_encode_on_need_input(), oh_encode_on_output(), on_input_available(), on_output_available(), packet_queue_put_private(), process_callback(), qsv_decode(), qsv_decode_frame(), send_frame(), sub2video_frame(), supply_new_packets(), swf_write_audio(), timestamp_queue_enqueue(), tq_send(), and udp_write().

av_fifo_write_from_cb()

int av_fifo_write_from_cb ( AVFifof,
AVFifoCB  read_cb,
void *  opaque,
size_t *  nb_elems 
)

Write data from a user-provided callback into a FIFO.

Parameters
f the FIFO buffer
read_cb Callback supplying the data to the FIFO. May be called multiple times.
opaque opaque user data to be provided to read_cb
nb_elems Should point to the maximum number of elements that can be written. Will be updated to contain the number of elements actually written.
Returns
non-negative number on success, a negative error code on failure

Definition at line 193 of file fifo.c.

Referenced by main(), and ring_write().

av_fifo_read()

int av_fifo_read ( AVFifof,
void *  buf,
size_t  nb_elems 
)

Read data from a FIFO.

In case nb_elems > av_fifo_can_read(f), nothing is read and an error is returned.

Parameters
f the FIFO buffer
buf Buffer to store the data. nb_elems * av_fifo_elem_size(f) bytes will be written into buf on success.
nb_elems number of elements to read from FIFO
Returns
a non-negative number on success, a negative error code on failure

Definition at line 240 of file fifo.c.

Referenced by activate(), amf_copy_buffer(), audio_read_packet(), av1_decode_flush(), av1_decode_free(), av_audio_fifo_read(), av_container_fifo_drain(), av_container_fifo_free(), av_container_fifo_read(), configure_filtergraph(), cuvid_output_frame(), d3d12va_get_valid_command_allocator(), d3d12va_get_valid_helper_objects(), dnn_detect_fill_side_data(), dnn_detect_uninit(), dts2pts_filter(), dts2pts_flush(), export_metadata(), ff_amf_encode_close(), ff_amf_receive_packet(), ff_ccfifo_injectbytes(), ff_d3d12va_decode_uninit(), ff_d3d12va_encode_close(), ff_hw_base_encode_receive_packet(), ff_nvenc_receive_packet(), ff_qsv_enc_close(), ff_qsv_encode(), ff_qsvvpp_filter_frame(), fg_free(), fg_thread_uninit(), fifo_free(), filter_frame(), free_debug_matches(), free_pkt_fifo(), get_free_frame(), libvorbis_encode_frame(), main(), mediacodec_get_input_index(), mediacodec_get_output_index(), mux_task_start(), nvenc_send_frame(), oh_decode_receive_frame(), oh_encode_receive(), packet_queue_flush(), packet_queue_get(), process_callback(), qsv_clear_buffers(), qsv_decode(), qsv_decode_close_qsvcontext(), qsv_decode_frame(), receive_locked(), sch_free(), timestamp_queue_dequeue(), udp_read(), and uninit().

av_fifo_read_to_cb()

int av_fifo_read_to_cb ( AVFifof,
AVFifoCB  write_cb,
void *  opaque,
size_t *  nb_elems 
)

Feed data from a FIFO into a user-provided callback.

Parameters
f the FIFO buffer
write_cb Callback the data will be supplied to. May be called multiple times.
opaque opaque user data to be provided to write_cb
nb_elems Should point to the maximum number of elements that can be read. Will be updated to contain the total number of elements actually sent to the callback.
Returns
non-negative number on success, a negative error code on failure

Definition at line 247 of file fifo.c.

Referenced by av_thread_message_flush(), flush_packet(), main(), and swf_write_video().

av_fifo_peek()

int av_fifo_peek ( const AVFifof,
void *  buf,
size_t  nb_elems,
size_t  offset 
)

Read data from a FIFO without modifying FIFO state.

Returns an error if an attempt is made to peek to nonexistent elements (i.e. if offset + nb_elems is larger than av_fifo_can_read(f)).

Parameters
f the FIFO buffer
buf Buffer to store the data. nb_elems * av_fifo_elem_size(f) bytes will be written into buf.
nb_elems number of elements to read from FIFO
offset number of initial elements to skip.
Returns
a non-negative number on success, a negative error code on failure

Definition at line 255 of file fifo.c.

Referenced by amf_copy_buffer(), av_audio_fifo_peek_at(), av_container_fifo_peek(), d3d12va_get_valid_command_allocator(), d3d12va_get_valid_helper_objects(), dnn_detect_fill_side_data(), drain_input_pts(), dv_inject_audio(), filter_frame(), frame_data_apply(), libplacebo_activate(), main(), mux_task_start(), ring_read(), ringbuf_float_at(), and timestamp_queue_peek().

av_fifo_peek_to_cb()

int av_fifo_peek_to_cb ( const AVFifof,
AVFifoCB  write_cb,
void *  opaque,
size_t *  nb_elems,
size_t  offset 
)

Feed data from a FIFO into a user-provided callback.

Parameters
f the FIFO buffer
write_cb Callback the data will be supplied to. May be called multiple times.
opaque opaque user data to be provided to write_cb
nb_elems Should point to the maximum number of elements that can be read. Will be updated to contain the total number of elements actually sent to the callback.
offset number of initial elements to skip; offset + *nb_elems must not be larger than av_fifo_can_read(f).
Returns
a non-negative number on success, a negative error code on failure

Definition at line 260 of file fifo.c.

Referenced by main().

av_fifo_drain2()

void av_fifo_drain2 ( AVFifof,
size_t  size 
)

Discard the specified amount of data from an AVFifo.

Parameters
size number of elements to discard, MUST NOT be larger than av_fifo_can_read(f)

Definition at line 266 of file fifo.c.

Referenced by activate(), av_audio_fifo_drain(), av_fifo_read(), av_fifo_read_to_cb(), drain_input_pts(), dv_assemble_frame(), frame_data_apply(), ring_read(), and udp_read().

av_fifo_reset2()

void av_fifo_reset2 ( AVFifof )

Definition at line 280 of file fifo.c.

Referenced by av_audio_fifo_reset(), ff_nvenc_encode_flush(), oh_decode_flush(), oh_encode_flush(), and ring_reset().

av_fifo_freep2()

void av_fifo_freep2 ( AVFifo **  f )

Free an AVFifo and reset pointer to NULL.

Parameters
f Pointer to an AVFifo to free. *f == NULL is allowed.

Definition at line 286 of file fifo.c.

Referenced by av1_decode_free(), av_audio_fifo_free(), av_container_fifo_free(), av_thread_message_queue_free(), cuvid_decode_end(), deshake_opencl_uninit(), dnn_detect_uninit(), dts2pts_close(), dv_deinit(), ff_amf_encode_close(), ff_ccfifo_uninit(), ff_d3d12va_decode_uninit(), ff_d3d12va_encode_close(), ff_hw_base_encode_close(), ff_nvenc_encode_close(), ff_qsv_enc_close(), ff_qsvvpp_close(), fg_free(), fg_thread_uninit(), fifo_free(), free_debug_matches(), free_pkt_fifo(), input_uninit(), libvorbis_encode_close(), main(), mediacodec_uninit_async_state(), mpeg_mux_deinit(), oh_decode_close(), oh_encode_close(), packet_queue_destroy(), qsv_decode_close(), qsv_decode_close_qsvcontext(), ring_destroy(), sch_free(), swf_deinit(), tq_free(), udp_close(), udp_open(), and uninit().


Generated on Sat Oct 18 2025 19:24:21 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /