[FFmpeg-devel] [PATCH 13/34] avformat/mux: Use AVFormatInternal.parse_pkt for temporary packets

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


The documentation of said packet ("Every user has to ensure that
this packet is blank after using it") perfectly fits how we use said
packet in the generic muxing code. Better than the documentation of pkt.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavformat/mux.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index ea298c1221..7373fcd1a8 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1174,7 +1174,7 @@ static int write_packets_common(AVFormatContext *s, AVPacket *pkt, int interleav
 
 int av_write_frame(AVFormatContext *s, AVPacket *in)
 {
-    AVPacket *pkt = s->internal->pkt;
+    AVPacket *pkt = s->internal->parse_pkt;
     int ret;
 
     if (!in) {
@@ -1237,8 +1237,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
 
 int av_write_trailer(AVFormatContext *s)
 {
+    AVPacket *const pkt = s->internal->parse_pkt;
     int i, ret1, ret = 0;
-    AVPacket *pkt = s->internal->pkt;
 
     av_packet_unref(pkt);
     for (i = 0; i < s->nb_streams; i++) {
@@ -1328,7 +1328,7 @@ static void uncoded_frame_free(void *unused, uint8_t *data)
 static int write_uncoded_frame_internal(AVFormatContext *s, int stream_index,
                                         AVFrame *frame, int interleaved)
 {
-    AVPacket *pkt = s->internal->pkt;
+    AVPacket *pkt = s->internal->parse_pkt;
 
     av_assert0(s->oformat);
     if (!s->oformat->write_uncoded_frame) {
-- 
2.30.2



More information about the ffmpeg-devel mailing list