[FFmpeg-devel] [PATCH 12/18] avformat/ttaenc: port to the new packet list API

James Almer jamrial at gmail.com
Wed Nov 18 18:52:41 EET 2020


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/ttaenc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index 39d9034f68..8abba11aed 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -30,7 +30,7 @@
 
 typedef struct TTAMuxContext {
     AVIOContext *seek_table;
-    PacketListEntry *queue, *queue_end;
+    AVPacketList *queue;
     uint32_t nb_samples;
     int frame_size;
     int last_frame;
@@ -64,6 +64,10 @@ static int tta_init(AVFormatContext *s)
     tta->frame_size = par->sample_rate * 256 / 245;
     avpriv_set_pts_info(s->streams[0], 64, 1, par->sample_rate);
 
+    tta->queue = av_packet_list_alloc();
+    if (!tta->queue)
+        return AVERROR(ENOMEM);
+
     return 0;
 }
 
@@ -94,8 +98,7 @@ static int tta_write_packet(AVFormatContext *s, AVPacket *pkt)
     TTAMuxContext *tta = s->priv_data;
     int ret;
 
-    ret = avpriv_packet_list_put(&tta->queue, &tta->queue_end, pkt,
-                                 av_packet_ref, 0);
+    ret = av_packet_list_put(tta->queue, pkt, av_packet_ref, 0);
     if (ret < 0) {
         return ret;
     }
@@ -125,8 +128,7 @@ static void tta_queue_flush(AVFormatContext *s)
     TTAMuxContext *tta = s->priv_data;
     AVPacket pkt;
 
-    while (tta->queue) {
-        avpriv_packet_list_get(&tta->queue, &tta->queue_end, &pkt);
+    while (!av_packet_list_get(tta->queue, &pkt, 0)) {
         avio_write(s->pb, pkt.data, pkt.size);
         av_packet_unref(&pkt);
     }
@@ -162,7 +164,7 @@ static void tta_deinit(AVFormatContext *s)
     TTAMuxContext *tta = s->priv_data;
 
     ffio_free_dyn_buf(&tta->seek_table);
-    avpriv_packet_list_free(&tta->queue, &tta->queue_end);
+    av_packet_list_free(&tta->queue);
 }
 
 AVOutputFormat ff_tta_muxer = {
-- 
2.29.2



More information about the ffmpeg-devel mailing list