From 63b013aa687662440c85ecff8fdc087123025bf6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 30 Dec 2021 13:02:38 +0100 Subject: lavu/fifo: deprecate av_fifo_peek2() It returns a pointer inside the fifo's buffer, which cannot be safely used without accessing AVFifoBuffer internals. It is easier and safer to use av_fifo_generic_peek_at(). --- libavutil/fifo.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavutil/fifo.h') diff --git a/libavutil/fifo.h b/libavutil/fifo.h index dc7bc6f0dd..92b1cf50e4 100644 --- a/libavutil/fifo.h +++ b/libavutil/fifo.h @@ -156,6 +156,7 @@ int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); */ void av_fifo_drain(AVFifoBuffer *f, int size); +#if FF_API_FIFO_PEEK2 /** * Return a pointer to the data stored in a FIFO buffer at a certain offset. * The FIFO buffer is not modified. @@ -165,7 +166,9 @@ void av_fifo_drain(AVFifoBuffer *f, int size); * than the used buffer size or the returned pointer will * point outside to the buffer data. * The used buffer size can be checked with av_fifo_size(). + * @deprecated use av_fifo_generic_peek_at() */ +attribute_deprecated static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) { uint8_t *ptr = f->rptr + offs; @@ -175,5 +178,6 @@ static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) ptr = f->end - (f->buffer - ptr); return ptr; } +#endif #endif /* AVUTIL_FIFO_H */ -- cgit v1.2.3