You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
781B

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