diff mbox series

[FFmpeg-devel,17/31] fftools/ffmpeg_dec: move flags to DecoderOpts

Message ID 20240124081702.4759-17-anton@khirnov.net
State Accepted
Commit e0a6cb07b21fe958f30b0ed47a5ae5b9d16693bd
Headers show
Series [FFmpeg-devel,01/31] fftools/ffmpeg_dec: split Decoder into a private and public part | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Jan. 24, 2024, 8:16 a.m. UTC
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 mbox series

Patch

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 0cbe16ea5f..babfeb1b96 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;