[FFmpeg-cvslog] fftools/ffmpeg: write the header for stream-less outputs when initializing the muxer

Anton Khirnov git at videolan.org
Sat Jul 23 13:07:08 EEST 2022


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Dec 11 14:33:26 2021 +0100| [cc4964607724980aae242777af9b35567b2fc627] | committer: Anton Khirnov

fftools/ffmpeg: write the header for stream-less outputs when initializing the muxer

There is no reason to delay this.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc4964607724980aae242777af9b35567b2fc627
---

 fftools/ffmpeg.c     | 11 -----------
 fftools/ffmpeg_mux.c |  7 +++++++
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 062f7c3b6a..b93b453e05 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3274,7 +3274,6 @@ static void report_new_stream(int input_index, AVPacket *pkt)
 static int transcode_init(void)
 {
     int ret = 0, i, j, k;
-    AVFormatContext *oc;
     OutputStream *ost;
     InputStream *ist;
     char error[1024] = {0};
@@ -3348,16 +3347,6 @@ static int transcode_init(void)
         }
     }
 
-    /* write headers for files with no streams */
-    for (i = 0; i < nb_output_files; i++) {
-        oc = output_files[i]->ctx;
-        if (output_files[i]->format->flags & AVFMT_NOSTREAMS && oc->nb_streams == 0) {
-            ret = of_check_init(output_files[i]);
-            if (ret < 0)
-                goto dump_format;
-        }
-    }
-
  dump_format:
     /* dump the stream mapping */
     av_log(NULL, AV_LOG_INFO, "Stream mapping:\n");
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index db04b7858d..396e91184b 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -340,6 +340,13 @@ int of_muxer_init(OutputFile *of, int64_t limit_filesize)
     if (strcmp(of->format->name, "rtp"))
         want_sdp = 0;
 
+    /* write the header for files with no streams */
+    if (of->format->flags & AVFMT_NOSTREAMS && of->ctx->nb_streams == 0) {
+        int ret = of_check_init(of);
+        if (ret < 0)
+            return ret;
+    }
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list