[FFmpeg-cvslog] fftools/ffmpeg: move decoder existence check to a more appropriate place

Anton Khirnov git at videolan.org
Tue Jan 30 11:07:35 EET 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jan 11 12:19:37 2024 +0100| [b2a0a2e6f531afa75c59c917c53b8ccee07d3655] | committer: Anton Khirnov

fftools/ffmpeg: move decoder existence check to a more appropriate place

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

 fftools/ffmpeg_dec.c   | 7 -------
 fftools/ffmpeg_demux.c | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 1c5030d933..c80b6eddea 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -898,13 +898,6 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
     const AVCodec *codec = ist->dec;
     int ret;
 
-    if (!codec) {
-        av_log(ist, AV_LOG_ERROR,
-               "Decoding requested, but no decoder found for: %s\n",
-                avcodec_get_name(ist->par->codec_id));
-        return AVERROR(EINVAL);
-    }
-
     ret = dec_alloc(&ist->decoder);
     if (ret < 0)
         return ret;
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 5a58bb735a..11db118b72 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -866,6 +866,13 @@ static int ist_use(InputStream *ist, int decoding_needed)
         return AVERROR(EINVAL);
     }
 
+    if (decoding_needed && !ist->dec) {
+        av_log(ist, AV_LOG_ERROR,
+               "Decoding requested, but no decoder found for: %s\n",
+                avcodec_get_name(ist->par->codec_id));
+        return AVERROR(EINVAL);
+    }
+
     if (ds->sch_idx_stream < 0) {
         ret = sch_add_demux_stream(d->sch, d->f.index);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list