[FFmpeg-devel] [PATCH 16/35] lavc/libvorbisenc: switch to new FIFO API
Anton Khirnov
anton at khirnov.net
Tue Jan 11 22:45:51 EET 2022
---
libavcodec/libvorbisenc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c
index fa0d5f4b42..8db782b188 100644
--- a/libavcodec/libvorbisenc.c
+++ b/libavcodec/libvorbisenc.c
@@ -271,7 +271,7 @@ static av_cold int libvorbis_encode_init(AVCodecContext *avctx)
avctx->frame_size = LIBVORBIS_FRAME_SIZE;
ff_af_queue_init(avctx, &s->afq);
- s->pkt_fifo = av_fifo_alloc(BUFFER_SIZE);
+ s->pkt_fifo = av_fifo_alloc2(BUFFER_SIZE, 1, 0);
if (!s->pkt_fifo) {
ret = AVERROR(ENOMEM);
goto error;
@@ -327,12 +327,12 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
/* add any available packets to the output packet buffer */
while ((ret = vorbis_bitrate_flushpacket(&s->vd, &op)) == 1) {
- if (av_fifo_space(s->pkt_fifo) < sizeof(ogg_packet) + op.bytes) {
+ if (av_fifo_can_write(s->pkt_fifo) < sizeof(ogg_packet) + op.bytes) {
av_log(avctx, AV_LOG_ERROR, "packet buffer is too small\n");
return AVERROR_BUG;
}
- av_fifo_generic_write(s->pkt_fifo, &op, sizeof(ogg_packet), NULL);
- av_fifo_generic_write(s->pkt_fifo, op.packet, op.bytes, NULL);
+ av_fifo_write(s->pkt_fifo, &op, sizeof(ogg_packet));
+ av_fifo_write(s->pkt_fifo, op.packet, op.bytes);
}
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "error getting available packets\n");
@@ -345,14 +345,14 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
/* check for available packets */
- if (av_fifo_size(s->pkt_fifo) < sizeof(ogg_packet))
+ if (av_fifo_can_read(s->pkt_fifo) < sizeof(ogg_packet))
return 0;
- av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL);
+ av_fifo_read(s->pkt_fifo, &op, sizeof(ogg_packet));
if ((ret = ff_get_encode_buffer(avctx, avpkt, op.bytes, 0)) < 0)
return ret;
- av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL);
+ av_fifo_read(s->pkt_fifo, avpkt->data, op.bytes);
avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos);
--
2.33.0
More information about the ffmpeg-devel
mailing list