[FFmpeg-cvslog] fftools/ffmpeg_demux: disallow using disabled input streams

Anton Khirnov git at videolan.org
Mon May 22 18:11:34 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu May 11 11:02:36 2023 +0200| [65f3d042a614ed62f4bc272f3859bb092e56e35e] | committer: Anton Khirnov

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65f3d042a614ed62f4bc272f3859bb092e56e35e
---

 fftools/ffmpeg_demux.c  | 6 ++++++
 fftools/ffmpeg_filter.c | 5 -----
 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) {



More information about the ffmpeg-cvslog mailing list