@@ -298,6 +298,8 @@ typedef struct DecoderOpts {
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
+ AVRational time_base;
+
// Either forced (when DECODER_FLAG_FRAMERATE_FORCED is set) or
// estimated (otherwise) video framerate.
AVRational framerate;
@@ -998,10 +998,7 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
dp->dec_ctx->opaque = dp;
dp->dec_ctx->get_format = get_format;
-
- /* 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;
+ dp->dec_ctx->pkt_timebase = o->time_base;
if (!av_dict_get(*dec_opts, "threads", NULL, 0))
av_dict_set(dec_opts, "threads", "auto", 0);
@@ -1152,6 +1152,8 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
ds->first_dts = AV_NOPTS_VALUE;
ds->next_dts = AV_NOPTS_VALUE;
+ ds->dec_opts.time_base = st->time_base;
+
ds->ts_scale = 1.0;
MATCH_PER_STREAM_OPT(ts_scale, dbl, ds->ts_scale, ic, st);