FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
fifo.c File Reference
#include "avassert.h"
#include "common.h"
#include "fifo.h"

Go to the source code of this file.

Functions

AVFifoBufferav_fifo_alloc (unsigned int size)
 Initialize an AVFifoBuffer.
 
void av_fifo_free (AVFifoBuffer *f)
 Free an AVFifoBuffer.
 
void av_fifo_reset (AVFifoBuffer *f)
 Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
 
int av_fifo_size (AVFifoBuffer *f)
 Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from it.
 
int av_fifo_space (AVFifoBuffer *f)
 Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write into it.
 
int av_fifo_realloc2 (AVFifoBuffer *f, unsigned int new_size)
 Resize an AVFifoBuffer.
 
int av_fifo_grow (AVFifoBuffer *f, unsigned int size)
 Enlarge an AVFifoBuffer.
 
int av_fifo_generic_write (AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
 Feed data from a user-supplied callback to an AVFifoBuffer.
 
int av_fifo_generic_read (AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
 Feed data from an AVFifoBuffer to a user-supplied callback.
 
void av_fifo_drain (AVFifoBuffer *f, int size)
 Discard data from the FIFO.
 

Function Documentation

AVFifoBuffer* av_fifo_alloc ( unsigned int  size)
void av_fifo_free ( AVFifoBuffer f)
void av_fifo_reset ( AVFifoBuffer f)

Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.

Parameters
fAVFifoBuffer to reset

Definition at line 48 of file fifo.c.

Referenced by av_audio_fifo_reset(), and av_fifo_alloc().

int av_fifo_size ( AVFifoBuffer f)
int av_fifo_space ( AVFifoBuffer f)

Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write into it.

Parameters
fAVFifoBuffer to write into
Returns
size

Definition at line 59 of file fifo.c.

Referenced by add_buffer_ref(), av_buffersrc_add_frame_internal(), flac_parse(), libvorbis_encode_frame(), process_callback(), supply_new_packets(), and write_to_fifo().

int av_fifo_realloc2 ( AVFifoBuffer f,
unsigned int  size 
)

Resize an AVFifoBuffer.

In case of reallocation failure, the old FIFO is kept unchanged.

Parameters
fAVFifoBuffer to resize
sizenew AVFifoBuffer size in bytes
Returns
<0 for failure, >=0 otherwise

Definition at line 64 of file fifo.c.

Referenced by add_buffer_ref(), av_audio_fifo_realloc(), av_buffersrc_add_frame_internal(), av_fifo_grow(), ff_audio_rechunk_interleave(), flac_parse(), mpeg_mux_write_packet(), and write_to_fifo().

int av_fifo_grow ( AVFifoBuffer f,
unsigned int  additional_space 
)

Enlarge an AVFifoBuffer.

In case of reallocation failure, the old FIFO is kept unchanged. The new fifo size may be larger than the requested size.

Parameters
fAVFifoBuffer to resize
additional_spacethe amount of space in bytes to allocate in addition to av_fifo_size()
Returns
<0 for failure, >=0 otherwise

Definition at line 84 of file fifo.c.

int av_fifo_generic_write ( AVFifoBuffer f,
void src,
int  size,
int(*)(void *, void *, int)  func 
)

Feed data from a user-supplied callback to an AVFifoBuffer.

Parameters
fAVFifoBuffer to write to
srcdata source; non-const since it may be used as a modifiable context by the function defined in func
sizenumber of bytes to write
funcgeneric write function; the first parameter is src, the second is dest_buf, the third is dest_buf_size. func must return the number of bytes written to dest_buf, or <= 0 to indicate no more data available to write. If func is NULL, src is interpreted as a simple byte array for source data.
Returns
the number of bytes written to the FIFO

Definition at line 99 of file fifo.c.

Referenced by add_buffer_ref(), av_audio_fifo_write(), av_buffersrc_add_frame_internal(), dv_assemble_frame(), ff_audio_rechunk_interleave(), ff_thread_video_encode_frame(), flac_parse(), libvorbis_encode_frame(), mpeg_mux_write_packet(), process_callback(), supply_new_packets(), swf_write_audio(), and write_to_fifo().

int av_fifo_generic_read ( AVFifoBuffer f,
void dest,
int  buf_size,
void(*)(void *, void *, int)  func 
)

Feed data from an AVFifoBuffer to a user-supplied callback.

Parameters
fAVFifoBuffer to read from
buf_sizenumber of bytes to read
funcgeneric read function
destdata destination

Definition at line 127 of file fifo.c.

Referenced by audio_read_packet(), av_audio_fifo_read(), av_buffersink_get_frame_flags(), av_fifo_realloc2(), filter_frame(), flush_fifo(), flush_packet(), free_pkt_fifo(), interleave_new_audio_packet(), libvorbis_encode_frame(), process_callback(), request_frame(), swf_write_video(), udp_read(), uninit(), and worker().

void av_fifo_drain ( AVFifoBuffer f,
int  size 
)

Discard data from the FIFO.

Read and discard the specified amount of data from an AVFifoBuffer.

Definition at line 147 of file fifo.c.

Referenced by av_audio_fifo_drain(), av_fifo_generic_read(), dv_assemble_frame(), flac_parse(), and udp_read().