summaryrefslogtreecommitdiff
path: root/libavcodec/avcodec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-01-07 11:41:42 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-07 00:31:23 +0100
commit37e70d480218b041d247c7be92d21556343b3c9a (patch)
tree2e630102f46d851da5057980aac315eddc7c3e1e /libavcodec/avcodec.c
parent93ed3755746227dee13f71605d9a9d2fab6d524c (diff)
lavc/avcodec: switch to new FIFO API
Diffstat (limited to 'libavcodec/avcodec.c')
-rw-r--r--libavcodec/avcodec.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index c00a9b2af8..4df834c708 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -183,7 +183,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
avci->es.in_frame = av_frame_alloc();
avci->in_pkt = av_packet_alloc();
avci->last_pkt_props = av_packet_alloc();
- avci->pkt_props = av_fifo_alloc(sizeof(*avci->last_pkt_props));
+ avci->pkt_props = av_fifo_alloc2(1, sizeof(*avci->last_pkt_props),
+ AV_FIFO_FLAG_AUTO_GROW);
if (!avci->buffer_frame || !avci->buffer_pkt ||
!avci->es.in_frame || !avci->in_pkt ||
!avci->last_pkt_props || !avci->pkt_props) {
@@ -399,13 +400,8 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
av_packet_unref(avci->buffer_pkt);
av_packet_unref(avci->last_pkt_props);
- while (av_fifo_size(avci->pkt_props) >= sizeof(*avci->last_pkt_props)) {
- av_fifo_generic_read(avci->pkt_props,
- avci->last_pkt_props, sizeof(*avci->last_pkt_props),
- NULL);
+ while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
av_packet_unref(avci->last_pkt_props);
- }
- av_fifo_reset(avci->pkt_props);
av_frame_unref(avci->es.in_frame);
av_packet_unref(avci->in_pkt);
@@ -464,12 +460,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_frame_free(&avci->buffer_frame);
av_packet_free(&avci->buffer_pkt);
if (avci->pkt_props) {
- while (av_fifo_size(avci->pkt_props) >= sizeof(*avci->last_pkt_props)) {
+ while (av_fifo_can_read(avci->pkt_props)) {
av_packet_unref(avci->last_pkt_props);
- av_fifo_generic_read(avci->pkt_props, avci->last_pkt_props,
- sizeof(*avci->last_pkt_props), NULL);
+ av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1);
}
- av_fifo_freep(&avci->pkt_props);
+ av_fifo_freep2(&avci->pkt_props);
}
av_packet_free(&avci->last_pkt_props);