[FFmpeg-devel] [PATCH] avformat/dv: Set AVFMTCTX_NOHEADER flag

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat Aug 28 14:27:24 EEST 2021


Audio streams are only added when a packet is read.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
The mov demuxer is different from all the other users of DV:
It does not use its main AVFormatContext for this, but a separate one.
Therefore the new audio streams are not added to the mov context
and so it does not need this flag (and it is not added for it).
But there is a problem with this approach: If there are multiple DV
audio streams included in this DV stream, the packets will all have
the same stream number.

Furthermore I don't see anything that prevents to overwrite and leak
the mov context's dv context in case multiple DV streams are present.
But I also don't have a sample showing a leak.

 libavformat/dv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/dv.c b/libavformat/dv.c
index d7909683c3..62c20f6a00 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -343,6 +343,9 @@ static int dv_init_demux(AVFormatContext *s, DVDemuxContext *c)
     c->vst->codecpar->bit_rate   = 25000000;
     c->vst->start_time        = 0;
 
+    /* Audio streams are added later as they are encountered. */
+    s->ctx_flags |= AVFMTCTX_NOHEADER;
+
     return 0;
 }
 
-- 
2.30.2



More information about the ffmpeg-devel mailing list