The new functions provides a more generic interface than
av_fifo_peek2() for peeking data out of a fifo buffer.
---
 libavutil/fifo.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/libavutil/fifo.h b/libavutil/fifo.h
index 999d0bf..dfc4a47 100644
--- a/libavutil/fifo.h
+++ b/libavutil/fifo.h
@@ -113,4 +113,17 @@ static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int 
offs)
         ptr -= f->end - f->buffer;
     return *ptr;
 }
+
+/**
+ * Return a pointer to the data offset by offs stored in the fifo,
+ * without modifying the fifo itself.
+ */
+static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
+{
+    uint8_t *ptr = f->rptr + offs;
+    if (ptr >= f->end)
+        ptr -= f->end - f->buffer;
+    return ptr;
+}
+
 #endif /* AVUTIL_FIFO_H */
-- 
1.7.2.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to