diff mbox

[FFmpeg-devel] ffmpeg: check for unconnected outputs

Message ID 20170502230659.28441-1-nfxjfg@googlemail.com
State Accepted
Commit 974ee16d6a71c31d0b5db4f139a40831c2f45776
Headers show

Commit Message

wm4 May 2, 2017, 11:06 p.m. UTC
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        |  1 +
 ffmpeg_filter.c | 15 +++++++++++++++
 ffmpeg_opt.c    |  2 ++
 3 files changed, 18 insertions(+)

Comments

Steven Liu May 3, 2017, 1:17 a.m. UTC | #1
2017-05-03 7:06 GMT+08:00 wm4 <nfxjfg@googlemail.com>:

> 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        |  1 +
>  ffmpeg_filter.c | 15 +++++++++++++++
>  ffmpeg_opt.c    |  2 ++
>  3 files changed, 18 insertions(+)
>
> diff --git a/ffmpeg.h b/ffmpeg.h
> index 4d0456c1fb..d34561275a 100644
> --- 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);
> diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
> index 896161a869..817f48f473 100644
> --- a/ffmpeg_filter.c
> +++ b/ffmpeg_filter.c
> @@ -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;
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index d1fe8742ff..e73a61059f 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -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) {
> --
> 2.11.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


LGTM


Thanks
Carl Eugen Hoyos May 3, 2017, 2 a.m. UTC | #2
2017-05-03 1:06 GMT+02:00 wm4 <nfxjfg@googlemail.com>:
> Fixes e.g.:
>
> ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "[0:v][1:v]psnr[out]" -f null none

Please mention the ticket number in the commit message.

Carl Eugen
Carl Eugen Hoyos May 4, 2017, 11:36 p.m. UTC | #3
2017-05-03 1:06 GMT+02:00 wm4 <nfxjfg@googlemail.com>:
> Fixes e.g.:
>
> ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "[0:v][1:v]psnr[out]" -f null none

I believe you forgot to fix the commit message.

Carl Eugen
James Almer May 6, 2017, 6:43 p.m. UTC | #4
On 5/2/2017 8:06 PM, wm4 wrote:
> Fixes e.g.:
> 
> ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "[0:v][1:v]psnr[out]" -f null none

This should be backported to release/3.3 before 3.3.1 is tagged.
Marton Balint May 7, 2017, 6:02 p.m. UTC | #5
On Sat, 6 May 2017, James Almer wrote:

> On 5/2/2017 8:06 PM, wm4 wrote:
>> Fixes e.g.:
>> 
>> ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "[0:v][1:v]psnr[out]" -f null none
>
> This should be backported to release/3.3 before 3.3.1 is tagged.

Done.

Regards,
Marton
James Almer May 7, 2017, 6:03 p.m. UTC | #6
On 5/7/2017 3:02 PM, Marton Balint wrote:
> 
> On Sat, 6 May 2017, James Almer wrote:
> 
>> On 5/2/2017 8:06 PM, wm4 wrote:
>>> Fixes e.g.:
>>>
>>> ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex
>>> "[0:v][1:v]psnr[out]" -f null none
>>
>> This should be backported to release/3.3 before 3.3.1 is tagged.
> 
> Done.

Thanks!
diff mbox

Patch

diff --git a/ffmpeg.h b/ffmpeg.h
index 4d0456c1fb..d34561275a 100644
--- 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);
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 896161a869..817f48f473 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -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;
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index d1fe8742ff..e73a61059f 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -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) {