aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-06-10 14:45:48 +0200
committerAnton Khirnov <anton@khirnov.net>2022-07-23 11:53:19 +0200
commitd02ae31fb255a151ebf0546f1a349ccf951666a2 (patch)
treea5a18940c45e8eb0bb504f6bc7c220a6725190db /fftools/ffmpeg.c
parentb2b9e9ccee0647b4695edaa66ae824850260ee02 (diff)
downloadffmpeg-d02ae31fb255a151ebf0546f1a349ccf951666a2.tar.gz
fftools/ffmpeg: use pre-BSF DTS for choosing next output
The following commits will add a new buffering stage after bitstream filters, which should not be taken into account for choosing next output. OutputStream.last_mux_dts is also used by the muxing code to make up missing DTS values - that field is now moved to the muxer-private MuxStream object.
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r--fftools/ffmpeg.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index bed87a2199..50e17b1890 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -716,6 +716,9 @@ static void output_packet(OutputFile *of, AVPacket *pkt,
{
int ret = 0;
+ if (!eof && pkt->dts != AV_NOPTS_VALUE)
+ ost->last_mux_dts = av_rescale_q(pkt->dts, ost->mux_timebase, AV_TIME_BASE_Q);
+
/* apply the output bitstream filters */
if (ost->bsf_ctx) {
ret = av_bsf_send_packet(ost->bsf_ctx, eof ? NULL : pkt);
@@ -3459,9 +3462,8 @@ static OutputStream *choose_output(void)
if (ost->filter && ost->last_filter_pts != AV_NOPTS_VALUE) {
opts = ost->last_filter_pts;
} else {
- opts = ost->last_mux_dts == AV_NOPTS_VALUE ? INT64_MIN :
- av_rescale_q(ost->last_mux_dts, ost->st->time_base,
- AV_TIME_BASE_Q);
+ opts = ost->last_mux_dts == AV_NOPTS_VALUE ?
+ INT64_MIN : ost->last_mux_dts;
if (ost->last_mux_dts == AV_NOPTS_VALUE)
av_log(NULL, AV_LOG_DEBUG,
"cur_dts is invalid st:%d (%d) [init:%d i_done:%d finish:%d] (this is harmless if it occurs once at the start per stream)\n",