110
|
1 #ifndef FIFO_H
|
|
2 #define FIFO_H
|
|
3
|
|
4 typedef struct AVFifoBuffer {
|
|
5 uint8_t *buffer;
|
|
6 uint8_t *rptr, *wptr, *end;
|
|
7 } AVFifoBuffer;
|
|
8
|
|
9 int av_fifo_init(AVFifoBuffer *f, int size);
|
|
10 void av_fifo_free(AVFifoBuffer *f);
|
|
11 int av_fifo_size(AVFifoBuffer *f);
|
|
12 int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size);
|
|
13 int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest);
|
|
14 void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size);
|
|
15 void av_fifo_realloc(AVFifoBuffer *f, unsigned int size);
|
|
16 void av_fifo_drain(AVFifoBuffer *f, int size);
|
|
17
|
|
18 static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
|
|
19 {
|
|
20 uint8_t *ptr = f->rptr + offs;
|
|
21 if (ptr >= f->end)
|
|
22 ptr -= f->end - f->buffer;
|
|
23 return *ptr;
|
|
24 }
|
|
25 #endif /* FIFO_H */
|