FFmpeg
Enumerations | Functions
container_fifo.h File Reference
#include <stddef.h>

Go to the source code of this file.

Enumerations

enum  AVContainerFifoFlags { AV_CONTAINER_FIFO_FLAG_REF = (1 << 0), AV_CONTAINER_FIFO_FLAG_USER = (1 << 16) }
 

Functions

AVContainerFifoav_container_fifo_alloc (void *opaque, void *(*container_alloc)(void *opaque), void(*container_reset)(void *opaque, void *obj), void(*container_free)(void *opaque, void *obj), int(*fifo_transfer)(void *opaque, void *dst, void *src, unsigned flags), unsigned flags)
 Allocate a new AVContainerFifo for the container type defined by provided callbacks. More...
 
AVContainerFifoav_container_fifo_alloc_avframe (unsigned flags)
 Allocate an AVContainerFifo instance for AVFrames. More...
 
void av_container_fifo_free (AVContainerFifo **cf)
 Free a AVContainerFifo and everything in it. More...
 
int av_container_fifo_write (AVContainerFifo *cf, void *obj, unsigned flags)
 Write the contents of obj to the FIFO. More...
 
int av_container_fifo_read (AVContainerFifo *cf, void *obj, unsigned flags)
 Read the next available object from the FIFO into obj. More...
 
int av_container_fifo_peek (AVContainerFifo *cf, void **pobj, size_t offset)
 Access objects stored in the FIFO without retrieving them. More...
 
void av_container_fifo_drain (AVContainerFifo *cf, size_t nb_elems)
 Discard the specified number of elements from the FIFO. More...
 
size_t av_container_fifo_can_read (const AVContainerFifo *cf)
 

Enumeration Type Documentation

◆ AVContainerFifoFlags

Enumerator
AV_CONTAINER_FIFO_FLAG_REF 

Signal to av_container_fifo_write() that it should make a new reference to data in src rather than consume its contents.

Note
you must handle this flag manually in your own fifo_transfer() callback
AV_CONTAINER_FIFO_FLAG_USER 

This and all higher bits in flags may be set to any value by the caller and are guaranteed to be passed through to the fifo_transfer() callback and not be interpreted by AVContainerFifo code.

Definition at line 31 of file container_fifo.h.

Function Documentation

◆ av_container_fifo_alloc()

AVContainerFifo* av_container_fifo_alloc ( void *  opaque,
void *(*)(void *opaque)  container_alloc,
void(*)(void *opaque, void *obj)  container_reset,
void(*)(void *opaque, void *obj)  container_free,
int(*)(void *opaque, void *dst, void *src, unsigned flags fifo_transfer,
unsigned  flags 
)

Allocate a new AVContainerFifo for the container type defined by provided callbacks.

Parameters
opaqueuser data that will be passed to the callbacks provided to this function
container_allocallocate a new container instance and return a pointer to it, or NULL on failure
container_resetreset the provided container instance to a clean state
container_freefree the provided container instance
fifo_transferTransfer the contents of container src to dst.
flagscurrently unused
Returns
newly allocated AVContainerFifo, or NULL on failure

Definition at line 64 of file container_fifo.c.

Referenced by av_container_fifo_alloc_avframe(), and av_container_fifo_alloc_avpacket().

◆ av_container_fifo_alloc_avframe()

AVContainerFifo* av_container_fifo_alloc_avframe ( unsigned  flags)

Allocate an AVContainerFifo instance for AVFrames.

Parameters
flagscurrently unused

Definition at line 215 of file container_fifo.c.

Referenced by hevc_init_context(), sq_add_stream(), and tq_alloc().

◆ av_container_fifo_free()

void av_container_fifo_free ( AVContainerFifo **  cf)

Free a AVContainerFifo and everything in it.

Definition at line 101 of file container_fifo.c.

Referenced by av_container_fifo_alloc(), hevc_decode_free(), sq_free(), and tq_free().

◆ av_container_fifo_write()

int av_container_fifo_write ( AVContainerFifo cf,
void *  obj,
unsigned  flags 
)

Write the contents of obj to the FIFO.

The fifo_transfer() callback previously provided to av_container_fifo_alloc() will be called with obj as src in order to perform the actual transfer.

Definition at line 162 of file container_fifo.c.

Referenced by ff_hevc_output_frames(), sq_send(), and tq_send().

◆ av_container_fifo_read()

int av_container_fifo_read ( AVContainerFifo cf,
void *  obj,
unsigned  flags 
)

Read the next available object from the FIFO into obj.

The fifo_read() callback previously provided to av_container_fifo_alloc() will be called with obj as dst in order to perform the actual transfer.

Definition at line 122 of file container_fifo.c.

Referenced by hevc_receive_frame(), receive_for_stream(), and receive_locked().

◆ av_container_fifo_peek()

int av_container_fifo_peek ( AVContainerFifo cf,
void **  pobj,
size_t  offset 
)

Access objects stored in the FIFO without retrieving them.

The fifo_transfer() callback will NOT be invoked and the FIFO state will not be modified.

Parameters
pobjPointer to the object stored in the FIFO will be written here on success. The object remains owned by the FIFO and the caller may only access it as long as the FIFO is not modified.
offsetPosition of the object to retrieve - 0 is the next item that would be read, 1 the one after, etc. Must be smaller than av_container_fifo_can_read().
Return values
0success, a pointer was written into pobj
AVERROR(EINVAL)invalid offset value

Definition at line 137 of file container_fifo.c.

Referenced by overflow_heartbeat(), receive_for_stream(), and receive_samples().

◆ av_container_fifo_drain()

void av_container_fifo_drain ( AVContainerFifo cf,
size_t  nb_elems 
)

Discard the specified number of elements from the FIFO.

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

Definition at line 151 of file container_fifo.c.

Referenced by receive_samples().

◆ av_container_fifo_can_read()

size_t av_container_fifo_can_read ( const AVContainerFifo cf)
Returns
number of objects available for reading

Definition at line 185 of file container_fifo.c.

Referenced by hevc_receive_frame(), receive_for_stream(), tb_update(), and tq_receive().