[FFmpeg-cvslog] fftools/ffmpeg_dec: pass AVCodec through DecoderOpts

Anton Khirnov git at videolan.org
Tue Jan 30 11:08:03 EET 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Jan 23 18:42:20 2024 +0100| [b3d1916ba03086d9d1e80a2ff5fdee2c915152ae] | committer: Anton Khirnov

fftools/ffmpeg_dec: pass AVCodec through DecoderOpts

Do not retrieve it from InputStream directly.

This is a step towards decoupling Decoder and InputStream.

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

 fftools/ffmpeg.h       | 2 ++
 fftools/ffmpeg_dec.c   | 2 +-
 fftools/ffmpeg_demux.c | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index bdfacf16b7..b169b1a323 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -297,6 +297,8 @@ typedef struct DecoderOpts {
 
     char                       *name;
 
+    const AVCodec              *codec;
+
     /* hwaccel options */
     enum HWAccelID              hwaccel_id;
     enum AVHWDeviceType         hwaccel_device_type;
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 734549ed0b..e41440b21d 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -951,7 +951,7 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
              AVDictionary **dec_opts, const DecoderOpts *o)
 {
     DecoderPriv *dp;
-    const AVCodec *codec = ist->dec;
+    const AVCodec *codec = o->codec;
     int ret;
 
     ret = dec_alloc(&ist->decoder);
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 8bc73e2bf3..f66319aafe 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -930,6 +930,8 @@ static int ist_use(InputStream *ist, int decoding_needed)
         snprintf(ds->dec_name, sizeof(ds->dec_name), "%d:%d", ist->file->index, ist->index);
         ds->dec_opts.name = ds->dec_name;
 
+        ds->dec_opts.codec = ist->dec;
+
         ret = dec_open(ist, d->sch, ds->sch_idx_dec,
                        &ist->decoder_opts, &ds->dec_opts);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list