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);
163 if (offset >= f->
end - rptr)
168 while (buf_size > 0) {
174 len =
FFMIN(f->
end - rptr, buf_size);
176 func(dest, rptr, len);
178 memcpy(dest, rptr, len);
190 void (*
func)(
void *,
void *,
int))
198 func(dest, rptr, len);
200 memcpy(dest, rptr, len);
208 }
while (buf_size > 0);
214 void (*
func)(
void *,
void *,
int))
222 memcpy(dest, f->
rptr, len);
228 }
while (buf_size > 0);
256 for (i = -n + 1; i <
n; i++) {
258 printf(
"%d: %d\n", i, *v);
264 for (i = 0; i <
n; i++) {
266 printf(
"%d: %d\n", i, j);
279 fifo->
rndx = fifo->
wndx = ~(uint32_t)0 - 5;
287 for (i = 0; i <
n; i++) {
289 printf(
"%d: %d\n", i, j);
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().
static const uint8_t offset[127][2]
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_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.
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 ...