00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #ifndef AVUTIL_FIFO_H
00025 #define AVUTIL_FIFO_H
00026
00027 #include <stdint.h>
00028
00029 typedef struct AVFifoBuffer {
00030 uint8_t *buffer;
00031 uint8_t *rptr, *wptr, *end;
00032 uint32_t rndx, wndx;
00033 } AVFifoBuffer;
00034
00040 AVFifoBuffer *av_fifo_alloc(unsigned int size);
00041
00046 void av_fifo_free(AVFifoBuffer *f);
00047
00052 void av_fifo_reset(AVFifoBuffer *f);
00053
00060 int av_fifo_size(AVFifoBuffer *f);
00061
00068 int av_fifo_space(AVFifoBuffer *f);
00069
00077 int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
00078
00092 int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
00093
00100 int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
00101
00107 void av_fifo_drain(AVFifoBuffer *f, int size);
00108
00109 static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
00110 {
00111 uint8_t *ptr = f->rptr + offs;
00112 if (ptr >= f->end)
00113 ptr -= f->end - f->buffer;
00114 return *ptr;
00115 }
00116 #endif