diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 14869be61d..b2577d75a9 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -521,6 +521,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ /* for avi libavformat returns the avi timestamps in .dts, * some made-up stuff that's not really pts in .pts */ priv->use_dts = true; + demuxer->timestamp_type = TIMESTAMP_TYPE_SORT; } else { if (opts->user_correct_pts != 0) avfc->flags |= AVFMT_FLAG_GENPTS; diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index e8878e3bed..0e28dbfb6b 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -99,6 +99,11 @@ struct MPOpts; #define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly +enum timestamp_type { + TIMESTAMP_TYPE_PTS, + TIMESTAMP_TYPE_SORT, +}; + // DEMUXER control commands/answers #define DEMUXER_CTRL_NOTIMPL -1 @@ -249,6 +254,7 @@ typedef struct demuxer { /* Set if using absolute seeks for small movements is OK (no pts resets * that would make pts ambigious, preferably supports back/forward flags */ bool accurate_seek; + enum timestamp_type timestamp_type; // demux_stream_t *audio; // audio buffer/demuxer demux_stream_t *video; // video buffer/demuxer diff --git a/mplayer.c b/mplayer.c index 7adde18740..2acd7e672e 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2526,7 +2526,8 @@ static void determine_frame_pts(struct MPContext *mpctx) if (opts->user_pts_assoc_mode) { sh_video->pts_assoc_mode = opts->user_pts_assoc_mode; } else if (sh_video->pts_assoc_mode == 0) { - if (sh_video->codec_reordered_pts != MP_NOPTS_VALUE) + if (mpctx->d_video->demuxer->timestamp_type == TIMESTAMP_TYPE_PTS + && sh_video->codec_reordered_pts != MP_NOPTS_VALUE) sh_video->pts_assoc_mode = 1; else sh_video->pts_assoc_mode = 2;