FFmpeg
Data Structures | Macros | Functions
fifo.c File Reference
#include <stdint.h>
#include <string.h>
#include "avassert.h"
#include "error.h"
#include "fifo.h"
#include "macros.h"
#include "mem.h"

Go to the source code of this file.

Data Structures

struct  AVFifo
 

Macros

#define AUTO_GROW_DEFAULT_BYTES   (1024 * 1024)
 
#define OLD_FIFO_SIZE_MAX   (size_t)FFMIN3(INT_MAX, UINT32_MAX, SIZE_MAX)
 

Functions

AVFifoav_fifo_alloc2 (size_t nb_elems, size_t elem_size, unsigned int flags)
 Allocate and initialize an AVFifo with a given element size. More...
 
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_elem_size (const AVFifo *f)
 
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...
 
static int fifo_check_space (AVFifo *f, size_t to_write)
 
static int fifo_write_common (AVFifo *f, const uint8_t *buf, size_t *nb_elems, AVFifoCB read_cb, void *opaque)
 
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...
 
static int fifo_peek_common (const AVFifo *f, uint8_t *buf, size_t *nb_elems, size_t offset, AVFifoCB write_cb, void *opaque)
 
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 (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 (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_reset2 (AVFifo *f)
 
void av_fifo_freep2 (AVFifo **f)
 Free an AVFifo and reset pointer to NULL. More...
 
AVFifoBufferav_fifo_alloc_array (size_t nmemb, size_t size)
 Initialize an AVFifoBuffer. More...
 
AVFifoBufferav_fifo_alloc (unsigned int size)
 Initialize an AVFifoBuffer. More...
 
void av_fifo_free (AVFifoBuffer *f)
 Free an AVFifoBuffer. More...
 
void av_fifo_freep (AVFifoBuffer **f)
 Free an AVFifoBuffer and reset pointer to NULL. More...
 
void av_fifo_reset (AVFifoBuffer *f)
 Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. More...
 
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. More...
 
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. More...
 
int av_fifo_realloc2 (AVFifoBuffer *f, unsigned int new_size)
 Resize an AVFifoBuffer. More...
 
int av_fifo_grow (AVFifoBuffer *f, unsigned int size)
 Enlarge an AVFifoBuffer. More...
 
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. More...
 
int av_fifo_generic_peek_at (AVFifoBuffer *f, void *dest, int offset, int buf_size, void(*func)(void *, void *, int))
 Feed data at specific position from an AVFifoBuffer to a user-supplied callback. More...
 
int av_fifo_generic_peek (AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
 Feed data from an AVFifoBuffer to a user-supplied callback. More...
 
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. More...
 
void av_fifo_drain (AVFifoBuffer *f, int size)
 Discard data from the FIFO. More...
 

Macro Definition Documentation

◆ AUTO_GROW_DEFAULT_BYTES

#define AUTO_GROW_DEFAULT_BYTES   (1024 * 1024)

Definition at line 33 of file fifo.c.

◆ OLD_FIFO_SIZE_MAX

#define OLD_FIFO_SIZE_MAX   (size_t)FFMIN3(INT_MAX, UINT32_MAX, SIZE_MAX)

Definition at line 297 of file fifo.c.

Function Documentation

◆ fifo_check_space()

static int fifo_check_space ( AVFifo f,
size_t  to_write 
)
static

Definition at line 129 of file fifo.c.

Referenced by fifo_write_common().

◆ fifo_write_common()

static int fifo_write_common ( AVFifo f,
const uint8_t *  buf,
size_t *  nb_elems,
AVFifoCB  read_cb,
void *  opaque 
)
static

Definition at line 149 of file fifo.c.

Referenced by av_fifo_write(), and av_fifo_write_from_cb().

◆ fifo_peek_common()

static int fifo_peek_common ( const AVFifo f,
uint8_t *  buf,
size_t *  nb_elems,
size_t  offset,
AVFifoCB  write_cb,
void *  opaque 
)
static

Definition at line 199 of file fifo.c.

Referenced by av_fifo_peek(), av_fifo_peek_to_cb(), av_fifo_read(), and av_fifo_read_to_cb().