[FFmpeg-devel] [PATCH] avformat/mux: skip parameter and pts checks for data muxer

Gyan ffmpeg at gyani.pro
Fri Apr 26 16:08:37 EEST 2019


-------------- next part --------------
From 5ec154870d9c559037598b41736bf5b216a756e0 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg at gyani.pro>
Date: Fri, 26 Apr 2019 18:31:33 +0530
Subject: [PATCH] avformat/mux: skip parameter and pts checks for data muxer

Allows to dump a malformed stream for external inspection or repair.
---
 libavformat/mux.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 83fe1de78f..3699b572f2 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -290,6 +290,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
         goto fail;
     }
 
+    if (!strcmp(of->name, "data"))
+        goto bypass;
+
     for (i = 0; i < s->nb_streams; i++) {
         st  = s->streams[i];
         par = st->codecpar;
@@ -409,6 +412,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         av_dict_set(&s->metadata, e->key, NULL, 0);
     }
 
+bypass:
     if (options) {
          av_dict_free(options);
          *options = tmp;
@@ -528,7 +532,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
     if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
         avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_UNKNOWN);
 
-    if (!s->internal->streams_initialized) {
+    if (!s->internal->streams_initialized && strcmp(s->oformat->name, "data")) {
         if ((ret = init_pts(s)) < 0)
             goto fail;
     }
@@ -559,6 +563,9 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
     int num, den, i;
     int frame_size;
 
+    if (!strcmp(s->oformat->name, "data"))
+        return 0;
+
     if (!s->internal->missing_ts_warning &&
         !(s->oformat->flags & AVFMT_NOTIMESTAMPS) &&
         (!(st->disposition & AV_DISPOSITION_ATTACHED_PIC) || (st->disposition & AV_DISPOSITION_TIMED_THUMBNAILS)) &&
-- 
2.21.0


More information about the ffmpeg-devel mailing list