diff mbox series

[FFmpeg-devel,19/31] fftools/ffmpeg_dec: move setting compute_edt to demuxer

Message ID 20240124081702.4759-19-anton@khirnov.net
State Accepted
Commit b27de18e4f66e8e775e173e4953f8fe4a7404a82
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
It is done based on demuxer information, so that is the more appropriate
place for this code.

This is a step towards decoupling Decoder and InputStream.
---
 fftools/ffmpeg_dec.c   | 9 ---------
 fftools/ffmpeg_demux.c | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 937e969988..46eac025a3 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -999,15 +999,6 @@  int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
     dp->dec_ctx->opaque                = dp;
     dp->dec_ctx->get_format            = get_format;
 
-    if (dp->dec_ctx->codec_id == AV_CODEC_ID_DVB_SUBTITLE &&
-       (ist->decoding_needed & DECODING_FOR_OST)) {
-        av_dict_set(dec_opts, "compute_edt", "1", AV_DICT_DONT_OVERWRITE);
-        if (ist->decoding_needed & DECODING_FOR_FILTER)
-            av_log(dp, AV_LOG_WARNING,
-                   "Warning using DVB subtitles for filtering and output at the "
-                   "same time is not fully supported, also see -compute_edt [0|1]\n");
-    }
-
     /* Useful for subtitles retiming by lavf (FIXME), skipping samples in
      * audio, and video decoders such as cuvid or mediacodec */
     dp->dec_ctx->pkt_timebase = ist->st->time_base;
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 2a34f97545..7cb85c127a 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -913,6 +913,15 @@  static int ist_use(InputStream *ist, int decoding_needed)
         } else
             ds->dec_opts.framerate  = ist->st->avg_frame_rate;
 
+        if (ist->dec->id == AV_CODEC_ID_DVB_SUBTITLE &&
+           (ist->decoding_needed & DECODING_FOR_OST)) {
+            av_dict_set(&ist->decoder_opts, "compute_edt", "1", AV_DICT_DONT_OVERWRITE);
+            if (ist->decoding_needed & DECODING_FOR_FILTER)
+                av_log(ist, AV_LOG_WARNING,
+                       "Warning using DVB subtitles for filtering and output at the "
+                       "same time is not fully supported, also see -compute_edt [0|1]\n");
+        }
+
         ret = dec_open(ist, d->sch, ds->sch_idx_dec,
                        &ist->decoder_opts, &ds->dec_opts);
         if (ret < 0)