[FFmpeg-devel] [PATCH 24/31] fftools/ffmpeg_dec: pass AVCodec through DecoderOpts
Anton Khirnov
anton at khirnov.net
Wed Jan 24 10:16:54 EET 2024
Do not retrieve it from InputStream directly.
This is a step towards decoupling Decoder and InputStream.
---
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 ba261f4912..c64b9f5b70 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)
--
2.42.0
More information about the ffmpeg-devel
mailing list