aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-05-11 11:02:36 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-22 17:10:44 +0200
commit65f3d042a614ed62f4bc272f3859bb092e56e35e (patch)
tree614cd969029fcca3e47d1205b0874e888f9b700d
parentdfa29ba9550797881943fa5b12a8cf5f30a3e47c (diff)
downloadffmpeg-65f3d042a614ed62f4bc272f3859bb092e56e35e.tar.gz
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.
-rw-r--r--fftools/ffmpeg_demux.c6
-rw-r--r--fftools/ffmpeg_filter.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index ae2133bdbf..df87e0f30a 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -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;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index ca43b4803a..2c3e2a96f7 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -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) {