libavutil/fifo.h File Reference

a very simple circular buffer FIFO implementation More...

#include <stdint.h>
#include "avutil.h"

Go to the source code of this file.

Data Structures

struct  AVFifoBuffer

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_generic_read (AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
 Feed data from an AVFifoBuffer to a user-supplied callback.
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_realloc2 (AVFifoBuffer *f, unsigned int size)
 Resize an AVFifoBuffer.
void av_fifo_drain (AVFifoBuffer *f, int size)
 Read and discard the specified amount of data from an AVFifoBuffer.
static uint8_t * av_fifo_peek2 (const AVFifoBuffer *f, int offs)
 Return a pointer to the data stored in a FIFO buffer at a certain offset.
static attribute_deprecated uint8_t av_fifo_peek (AVFifoBuffer *f, int offs)


Detailed Description

a very simple circular buffer FIFO implementation

Definition in file fifo.h.


Function Documentation

AVFifoBuffer* av_fifo_alloc ( unsigned int  size  ) 

Initialize an AVFifoBuffer.

Parameters:
size of FIFO
Returns:
AVFifoBuffer or NULL in case of memory allocation failure

Definition at line 25 of file fifo.c.

Referenced by av_fifo_realloc2(), common_init(), dv_init_mux(), ff_audio_interleave_init(), flac_parse_init(), init(), mpeg_mux_init(), start_jack(), swf_write_header(), transcode_init(), and udp_open().

void av_fifo_drain ( AVFifoBuffer f,
int  size 
)

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

Parameters:
f AVFifoBuffer to read from
size amount of data to read in bytes

Definition at line 129 of file fifo.c.

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

void av_fifo_free ( AVFifoBuffer f  ) 

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:
f AVFifoBuffer to read from
buf_size number of bytes to read
func generic read function
dest data destination

Definition at line 111 of file fifo.c.

Referenced by audio_read_packet(), av_buffersink_get_buffer_ref(), av_fifo_realloc2(), common_uninit(), ff_interleave_new_audio_packet(), flush_encoders(), flush_packet(), free_pkt_fifo(), process_callback(), request_frame(), swf_write_video(), udp_read(), and uninit().

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:
f AVFifoBuffer to write to
src data source; non-const since it may be used as a modifiable context by the function defined in func
size number of bytes to write
func generic 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 83 of file fifo.c.

Referenced by av_asrc_buffer_add_audio_buffer_ref(), dv_assemble_frame(), end_frame(), ff_audio_rechunk_interleave(), flac_parse(), mpeg_mux_write_packet(), process_callback(), start_frame(), supply_new_packets(), and swf_write_audio().

static attribute_deprecated uint8_t av_fifo_peek ( AVFifoBuffer f,
int  offs 
) [inline, static]

Deprecated:
Use av_fifo_peek2() instead.

Definition at line 137 of file fifo.h.

static uint8_t* av_fifo_peek2 ( const AVFifoBuffer f,
int  offs 
) [inline, static]

Return a pointer to the data stored in a FIFO buffer at a certain offset.

The FIFO buffer is not modified.

Parameters:
f AVFifoBuffer to peek at, f must be non-NULL
offs an offset in bytes, its absolute value must be less than the used buffer size or the returned pointer will point outside to the buffer data. The used buffer size can be checked with av_fifo_size().

Definition at line 122 of file fifo.h.

Referenced by av_buffersink_get_buffer_ref(), av_fifo_peek(), and dv_inject_audio().

int av_fifo_realloc2 ( AVFifoBuffer f,
unsigned int  size 
)

Resize an AVFifoBuffer.

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

Parameters:
f AVFifoBuffer to resize
size new AVFifoBuffer size in bytes
Returns:
<0 for failure, >=0 otherwise

Definition at line 62 of file fifo.c.

Referenced by end_frame(), ff_audio_rechunk_interleave(), flac_parse(), and mpeg_mux_write_packet().

void av_fifo_reset ( AVFifoBuffer f  ) 

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

Parameters:
f AVFifoBuffer to reset

Definition at line 46 of file fifo.c.

Referenced by 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:
f AVFifoBuffer to write into
Returns:
size

Definition at line 57 of file fifo.c.

Referenced by av_asrc_buffer_add_audio_buffer_ref(), end_frame(), poll_frame(), process_callback(), start_frame(), and supply_new_packets().


Generated on Fri Oct 26 02:46:14 2012 for FFmpeg by  doxygen 1.5.8