Skip to content

Commit 974ee16

Browse files
author
wm4
committed
ffmpeg: check for unconnected outputs
Fixes e.g.: ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "[0:v][1:v]psnr[out]" -f null none
1 parent 3624d45 commit 974ee16

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

ffmpeg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec);
638638

639639
int configure_filtergraph(FilterGraph *fg);
640640
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
641+
void check_filter_outputs(void);
641642
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist);
642643
int filtergraph_is_simple(FilterGraph *fg);
643644
int init_simple_filtergraph(InputStream *ist, OutputStream *ost);

ffmpeg_filter.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,21 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu
678678
}
679679
}
680680

681+
void check_filter_outputs(void)
682+
{
683+
int i;
684+
for (i = 0; i < nb_filtergraphs; i++) {
685+
int n;
686+
for (n = 0; n < filtergraphs[i]->nb_outputs; n++) {
687+
OutputFilter *output = filtergraphs[i]->outputs[n];
688+
if (!output->ost) {
689+
av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name);
690+
exit_program(1);
691+
}
692+
}
693+
}
694+
}
695+
681696
static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
682697
{
683698
AVFormatContext *avf = input_files[ist->file_index]->ctx;

ffmpeg_opt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,6 +3260,8 @@ int ffmpeg_parse_options(int argc, char **argv)
32603260
goto fail;
32613261
}
32623262

3263+
check_filter_outputs();
3264+
32633265
fail:
32643266
uninit_parse_context(&octx);
32653267
if (ret < 0) {

0 commit comments

Comments
 (0)