[FFmpeg-devel] [PATCH 18/34] avformat/internal: Allow AVFormatInternal.pkt to be used by muxers

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Sep 6 05:27:46 EEST 2021


It is unused by the generic muxing code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavformat/internal.h | 4 +++-
 libavformat/mux.c      | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index c3d0ff6b88..c16cb5b17f 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -116,7 +116,9 @@ struct AVFormatInternal {
     AVPacket *parse_pkt;
 
     /**
-     * Used to hold temporary packets.
+     * Used to hold temporary packets for the generic demuxing code.
+     * When muxing, it may be used by muxers to hold packets (even
+     * permanent ones).
      */
     AVPacket *pkt;
     /**
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 7373fcd1a8..c5e07aaf1c 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1277,6 +1277,7 @@ int av_write_trailer(AVFormatContext *s)
     if (s->oformat->priv_class)
         av_opt_free(s->priv_data);
     av_freep(&s->priv_data);
+    av_packet_unref(s->internal->pkt);
     return ret;
 }
 
-- 
2.30.2



More information about the ffmpeg-devel mailing list