]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg: check for unconnected outputs
authorwm4 <nfxjfg@googlemail.com>
Thu, 4 May 2017 22:15:15 +0000 (00:15 +0200)
committerwm4 <nfxjfg@googlemail.com>
Thu, 4 May 2017 22:15:15 +0000 (00:15 +0200)
Fixes e.g.:

ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "[0:v][1:v]psnr[out]" -f null none

ffmpeg.h
ffmpeg_filter.c
ffmpeg_opt.c

index 4d0456c1fbe1e5f90f4b92e3a5de5bb356e6a5d3..d34561275a9519555df64f373d3d291cba8234ed 100644 (file)
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -638,6 +638,7 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec);
 
 int configure_filtergraph(FilterGraph *fg);
 int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
+void check_filter_outputs(void);
 int ist_in_filtergraph(FilterGraph *fg, InputStream *ist);
 int filtergraph_is_simple(FilterGraph *fg);
 int init_simple_filtergraph(InputStream *ist, OutputStream *ost);
index 896161a869568481c7343707b24ff36d89c4e6d8..817f48f473d0748dfe8f41afff530da9b0e73468 100644 (file)
@@ -678,6 +678,21 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu
     }
 }
 
+void check_filter_outputs(void)
+{
+    int i;
+    for (i = 0; i < nb_filtergraphs; i++) {
+        int n;
+        for (n = 0; n < filtergraphs[i]->nb_outputs; n++) {
+            OutputFilter *output = filtergraphs[i]->outputs[n];
+            if (!output->ost) {
+                av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name);
+                exit_program(1);
+            }
+        }
+    }
+}
+
 static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
 {
     AVFormatContext *avf = input_files[ist->file_index]->ctx;
index d1fe8742ff256af1e6f53f82b5da8aff28453f32..e73a61059f6d7935e711ec4435da2e59b84ac3cd 100644 (file)
@@ -3260,6 +3260,8 @@ int ffmpeg_parse_options(int argc, char **argv)
         goto fail;
     }
 
+    check_filter_outputs();
+
 fail:
     uninit_parse_context(&octx);
     if (ret < 0) {