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
00030 typedef struct AVFifoBuffer {
00031 uint8_t *buffer;
00032 uint8_t *rptr, *wptr, *end;
00033 uint32_t rndx, wndx;
00034 } AVFifoBuffer;
00035
00041 AVFifoBuffer *av_fifo_alloc(unsigned int size);
00042
00047 void av_fifo_free(AVFifoBuffer *f);
00048
00053 void av_fifo_reset(AVFifoBuffer *f);
00054
00061 int av_fifo_size(AVFifoBuffer *f);
00062
00069 int av_fifo_space(AVFifoBuffer *f);
00070
00078 int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
00079
00093 int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
00094
00103 int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
00104
00114 int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
00115
00121 void av_fifo_drain(AVFifoBuffer *f, int size);
00122
00133 static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
00134 {
00135 uint8_t *ptr = f->rptr + offs;
00136 if (ptr >= f->end)
00137 ptr = f->buffer + (ptr - f->end);
00138 else if (ptr < f->buffer)
00139 ptr = f->end - (f->buffer - ptr);
00140 return ptr;
00141 }
00142
00143 #if FF_API_AV_FIFO_PEEK
00144
00147 attribute_deprecated
00148 static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
00149 {
00150 return *av_fifo_peek2(f, offs);
00151 }
00152 #endif
00153
00154 #endif