From e0a6cb07b21fe958f30b0ed47a5ae5b9d16693bd Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Jan 2024 18:28:57 +0100 Subject: [PATCH] fftools/ffmpeg_dec: move flags to DecoderOpts Will be useful in the following commit. --- fftools/ffmpeg.h | 4 +++- fftools/ffmpeg_dec.c | 4 ++-- fftools/ffmpeg_demux.c | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index abf95f106b..b4288e7352 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -287,6 +287,8 @@ enum DecoderFlags { }; typedef struct DecoderOpts { + int flags; + /* hwaccel options */ enum HWAccelID hwaccel_id; enum AVHWDeviceType hwaccel_device_type; @@ -738,7 +740,7 @@ AVBufferRef *hw_device_for_filter(void); * is transferred to the decoder. */ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, - AVDictionary **dec_opts, int flags, const DecoderOpts *o); + AVDictionary **dec_opts, const DecoderOpts *o); void dec_free(Decoder **pdec); int dec_add_filter(Decoder *dec, InputFilter *ifilter); diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index 791df8d98c..2698e2683a 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -943,7 +943,7 @@ static const AVClass dec_class = { }; int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, - AVDictionary **dec_opts, int flags, const DecoderOpts *o) + AVDictionary **dec_opts, const DecoderOpts *o) { DecoderPriv *dp; const AVCodec *codec = ist->dec; @@ -957,7 +957,7 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, dp->sch = sch; dp->sch_idx = sch_idx; - dp->flags = flags; + dp->flags = o->flags; dp->dec.class = &dec_class; dp->log_parent = ist; diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 0f426e3c2e..5ee07f706b 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -893,8 +893,6 @@ static int ist_use(InputStream *ist, int decoding_needed) if (decoding_needed && ds->sch_idx_dec < 0) { int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; - int dec_flags = (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) | - (!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE); ret = sch_add_dec(d->sch, decoder_thread, ist, d->loop && is_audio); if (ret < 0) @@ -906,8 +904,11 @@ static int ist_use(InputStream *ist, int decoding_needed) if (ret < 0) return ret; + ds->dec_opts.flags = (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) | + (!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE); + ret = dec_open(ist, d->sch, ds->sch_idx_dec, - &ist->decoder_opts, dec_flags, &ds->dec_opts); + &ist->decoder_opts, &ds->dec_opts); if (ret < 0) return ret;