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 #include "avutil.h"
00029 #include "attributes.h"
00030
00031 typedef struct AVFifoBuffer {
00032 uint8_t *buffer;
00033 uint8_t *rptr, *wptr, *end;
00034 uint32_t rndx, wndx;
00035 } AVFifoBuffer;
00036
00042 AVFifoBuffer *av_fifo_alloc(unsigned int size);
00043
00048 void av_fifo_free(AVFifoBuffer *f);
00049
00054 void av_fifo_reset(AVFifoBuffer *f);
00055
00062 int av_fifo_size(AVFifoBuffer *f);
00063
00070 int av_fifo_space(AVFifoBuffer *f);
00071
00079 int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
00080
00094 int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
00095
00104 int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
00105
00115 int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
00116
00122 void av_fifo_drain(AVFifoBuffer *f, int size);
00123
00134 static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
00135 {
00136 uint8_t *ptr = f->rptr + offs;
00137 if (ptr >= f->end)
00138 ptr = f->buffer + (ptr - f->end);
00139 else if (ptr < f->buffer)
00140 ptr = f->end - (f->buffer - ptr);
00141 return ptr;
00142 }
00143
00144 #if FF_API_AV_FIFO_PEEK
00145
00148 attribute_deprecated
00149 static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
00150 {
00151 return *av_fifo_peek2(f, offs);
00152 }
00153 #endif
00154
00155 #endif