* Moving FifoBuffer out of libavformat/avformat.h and
[libav.git] / libavutil / fifo.h
CommitLineData
f5a478f6
RS
1#ifndef FIFO_H
2#define FIFO_H
3
4typedef struct AVFifoBuffer {
5 uint8_t *buffer;
6 uint8_t *rptr, *wptr, *end;
7} AVFifoBuffer;
8
9int av_fifo_init(AVFifoBuffer *f, int size);
10void av_fifo_free(AVFifoBuffer *f);
11int av_fifo_size(AVFifoBuffer *f);
12int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size);
13int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest);
14void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size);
15void av_fifo_realloc(AVFifoBuffer *f, unsigned int size);
16void av_fifo_drain(AVFifoBuffer *f, int size);
17
18static 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 */