[FFmpeg-cvslog] avconv: move the no streams failure to open_output_file()

Anton Khirnov git at videolan.org
Sun Jul 19 14:11:29 CEST 2015


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jul 15 15:51:39 2015 +0200| [1959351aecf09fc3e90208ff775f4849801dc13f] | committer: Anton Khirnov

avconv: move the no streams failure to open_output_file()

It is a better place for it, there is no reason to wait until
transcode_init().

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

 avconv.c     |   10 ----------
 avconv_opt.c |    6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/avconv.c b/avconv.c
index 098e88b..6557754 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1679,16 +1679,6 @@ static int transcode_init(void)
                 input_streams[j + ifile->ist_index]->start = av_gettime_relative();
     }
 
-    /* output stream init */
-    for (i = 0; i < nb_output_files; i++) {
-        oc = output_files[i]->ctx;
-        if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
-            av_dump_format(oc, i, oc->filename, 1);
-            av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i);
-            return AVERROR(EINVAL);
-        }
-    }
-
     /* init complex filtergraphs */
     for (i = 0; i < nb_filtergraphs; i++)
         if ((ret = avfilter_graph_config(filtergraphs[i]->graph, NULL)) < 0)
diff --git a/avconv_opt.c b/avconv_opt.c
index e231f53..1ec165d 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1622,6 +1622,12 @@ loop_end:
         avio_close(pb);
     }
 
+    if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
+        av_dump_format(oc, nb_output_files - 1, oc->filename, 1);
+        av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", nb_output_files - 1);
+        exit_program(1);
+    }
+
     /* check if all codec options have been used */
     unused_opts = strip_specifiers(o->g->codec_opts);
     for (i = of->ost_index; i < nb_output_streams; i++) {



More information about the ffmpeg-cvslog mailing list