79 return (uint32_t)(f->
wndx - f->
rndx);
89 unsigned int old_size = f->
end - f->
buffer;
91 if (old_size < new_size) {
109 unsigned int old_size = f->
end - f->
buffer;
123 int (*
func)(
void *,
void *,
int))
126 uint32_t wndx= f->
wndx;
132 len =
func(src, wptr, len);
136 memcpy(wptr, src, len);
152 void (*
func)(
void *,
void *,
int))
156 uint32_t rndx = f->
rndx;
163 memcpy(dest, f->
rptr, len);
169 }
while (buf_size > 0);
178 void (*
func)(
void *,
void *,
int))
186 memcpy(dest, f->
rptr, len);
192 }
while (buf_size > 0);
220 for (i = -n + 1; i <
n; i++) {
222 printf(
"%d: %d\n", i, *v);
int av_fifo_grow(AVFifoBuffer *f, unsigned int size)
Enlarge an AVFifoBuffer.
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.
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.
static AVFifoBuffer * fifo_alloc_common(void *buffer, size_t size)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
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 int...
void av_fifo_free(AVFifoBuffer *f)
Free 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.
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.
simple assert() macros that are a bit more flexible than ISO C assert().
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 ...
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
Resize an AVFifoBuffer.
a very simple circular buffer FIFO implementation
int(* func)(AVBPrint *dst, const char *in, const char *arg)
AVFifoBuffer * av_fifo_alloc_array(size_t nmemb, size_t size)
Initialize an AVFifoBuffer.
common internal and external API header
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
void av_fifo_freep(AVFifoBuffer **f)
Free an AVFifoBuffer and reset pointer to NULL.
#define av_malloc_array(a, b)
int main(int argc, char **argv)
void av_fifo_reset(AVFifoBuffer *f)
Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied...
void av_fifo_drain(AVFifoBuffer *f, int size)
Discard data from the FIFO.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...