mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
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().
This commit is contained in:
parent
d47dc0b0df
commit
63b013aa68
@ -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 */
|
||||
|
@ -30,14 +30,6 @@ int main(void)
|
||||
for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++)
|
||||
av_fifo_generic_write(fifo, &i, sizeof(int), NULL);
|
||||
|
||||
/* peek at FIFO */
|
||||
n = av_fifo_size(fifo) / sizeof(int);
|
||||
for (i = -n + 1; i < n; i++) {
|
||||
int *v = (int *)av_fifo_peek2(fifo, i * sizeof(int));
|
||||
printf("%d: %d\n", i, *v);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
/* peek_at at FIFO */
|
||||
n = av_fifo_size(fifo) / sizeof(int);
|
||||
for (i = 0; i < n; i++) {
|
||||
|
@ -109,6 +109,7 @@
|
||||
#define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
#define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
#define FF_API_FIFO_PEEK2 (LIBAVUTIL_VERSION_MAJOR < 58)
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -1,29 +1,3 @@
|
||||
-12: 1
|
||||
-11: 2
|
||||
-10: 3
|
||||
-9: 4
|
||||
-8: 5
|
||||
-7: 6
|
||||
-6: 7
|
||||
-5: 8
|
||||
-4: 9
|
||||
-3: 10
|
||||
-2: 11
|
||||
-1: 12
|
||||
0: 0
|
||||
1: 1
|
||||
2: 2
|
||||
3: 3
|
||||
4: 4
|
||||
5: 5
|
||||
6: 6
|
||||
7: 7
|
||||
8: 8
|
||||
9: 9
|
||||
10: 10
|
||||
11: 11
|
||||
12: 12
|
||||
|
||||
0: 0
|
||||
1: 1
|
||||
2: 2
|
||||
|
Loading…
Reference in New Issue
Block a user