fftools/ffmpeg_demux: disallow using disabled input streams

This is less ad-hoc than checking explicitly in every place that binds
an input stream to a filter or output.
This commit is contained in:
Anton Khirnov 2023-05-11 11:02:36 +02:00
parent dfa29ba955
commit 65f3d042a6
2 changed files with 6 additions and 5 deletions

View File

@ -848,6 +848,12 @@ static int ist_use(InputStream *ist, int decoding_needed)
{
DemuxStream *ds = ds_from_ist(ist);
if (ist->user_set_discard == AVDISCARD_ALL) {
av_log(ist, AV_LOG_ERROR, "Cannot %s a disabled input stream\n",
decoding_needed ? "decode" : "streamcopy");
return AVERROR(EINVAL);
}
ist->discard = 0;
ist->st->discard = ist->user_set_discard;
ist->decoding_needed |= decoding_needed;

View File

@ -417,11 +417,6 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
exit_program(1);
}
ist = input_files[file_idx]->streams[st->index];
if (ist->user_set_discard == AVDISCARD_ALL) {
av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
"matches a disabled input stream.\n", p, fgp->graph_desc);
exit_program(1);
}
} else {
ist = ist_find_unused(type);
if (!ist) {