Miam-Player  0.8.0
A nice music player
fifo.h File Reference
#include <stdint.h>
#include "avutil.h"
#include "attributes.h"

Go to the source code of this file.

Classes

struct  AVFifoBuffer
 

Typedefs

typedef struct AVFifoBuffer AVFifoBuffer
 

Functions

AVFifoBuffer * av_fifo_alloc (unsigned int size)
 
AVFifoBuffer * av_fifo_alloc_array (size_t nmemb, size_t size)
 
void av_fifo_free (AVFifoBuffer *f)
 
void av_fifo_freep (AVFifoBuffer **f)
 
void av_fifo_reset (AVFifoBuffer *f)
 
int av_fifo_size (const AVFifoBuffer *f)
 
int av_fifo_space (const AVFifoBuffer *f)
 
int av_fifo_generic_peek_at (AVFifoBuffer *f, void *dest, int offset, int buf_size, void(*func)(void *, void *, int))
 
int av_fifo_generic_peek (AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
 
int av_fifo_generic_read (AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
 
int av_fifo_generic_write (AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
 
int av_fifo_realloc2 (AVFifoBuffer *f, unsigned int size)
 
int av_fifo_grow (AVFifoBuffer *f, unsigned int additional_space)
 
void av_fifo_drain (AVFifoBuffer *f, int size)
 

Detailed Description

a very simple circular buffer FIFO implementation

Typedef Documentation

typedef struct AVFifoBuffer AVFifoBuffer

Function Documentation

AVFifoBuffer* av_fifo_alloc ( unsigned int  size)

Initialize an AVFifoBuffer.

Parameters
sizeof FIFO
Returns
AVFifoBuffer or NULL in case of memory allocation failure
AVFifoBuffer* av_fifo_alloc_array ( size_t  nmemb,
size_t  size 
)

Initialize an AVFifoBuffer.

Parameters
nmembnumber of elements
sizesize of the single element
Returns
AVFifoBuffer or NULL in case of memory allocation failure
void av_fifo_drain ( AVFifoBuffer *  f,
int  size 
)

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

Parameters
fAVFifoBuffer to read from
sizeamount of data to read in bytes
void av_fifo_free ( AVFifoBuffer *  f)

Free an AVFifoBuffer.

Parameters
fAVFifoBuffer to free
void av_fifo_freep ( AVFifoBuffer **  f)

Free an AVFifoBuffer and reset pointer to NULL.

Parameters
fAVFifoBuffer to free
int av_fifo_generic_peek ( AVFifoBuffer *  f,
void *  dest,
int  buf_size,
void(*)(void *, void *, int)  func 
)

Feed data from an AVFifoBuffer to a user-supplied callback. Similar as av_fifo_gereric_read but without discarding data.

Parameters
fAVFifoBuffer to read from
buf_sizenumber of bytes to read
funcgeneric read function
destdata destination
int av_fifo_generic_peek_at ( AVFifoBuffer *  f,
void *  dest,
int  offset,
int  buf_size,
void(*)(void *, void *, int)  func 
)

Feed data at specific position from an AVFifoBuffer to a user-supplied callback. Similar as av_fifo_gereric_read but without discarding data.

Parameters
fAVFifoBuffer to read from
offsetoffset from current read position
buf_sizenumber of bytes to read
funcgeneric read function
destdata destination
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
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
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
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
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
int av_fifo_size ( const AVFifoBuffer *  f)

Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from it.

Parameters
fAVFifoBuffer to read from
Returns
size
int av_fifo_space ( const 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