From aa73ac8db81b8efb04bf2a5c7256e8a847f49fed Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 27 Nov 2013 20:57:08 +0100 Subject: video: replace d_video->pts field, change PTS jump checks The d_video->pts field was a bit strange. The code overwrote it multiple times (on decoding, on filtering, then once again...), and it wasn't really clear what purpose this field had exactly. Replace it with the mpctx->video_next_pts field, which is relatively unambiguous. Move the decreasing PTS check to dec_video.c. This means it acts on decoder output, not on filter output. (Just like in the previous commit, assume the filter chain is sane.) Drop the jitter vs. reset semantics; the dec_video.c determined PTS never goes backwards, and demuxer timestamps don't "jitter". --- video/decode/dec_video.c | 8 ++++++-- video/decode/dec_video.h | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'video/decode') diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 402bb805ef..1802e19fbf 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -69,7 +69,6 @@ void video_reset_decoding(struct dec_video *d_video) d_video->codec_dts = MP_NOPTS_VALUE; d_video->sorted_pts = MP_NOPTS_VALUE; d_video->unsorted_pts = MP_NOPTS_VALUE; - d_video->pts = MP_NOPTS_VALUE; } int video_vd_control(struct dec_video *d_video, int cmd, void *arg) @@ -358,9 +357,14 @@ struct mp_image *video_decode(struct dec_video *d_video, pts += frame_time; } + if (d_video->decoded_pts != MP_NOPTS_VALUE && pts < d_video->decoded_pts) { + mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Decreasing video pts: %f < %f\n", + pts, d_video->decoded_pts); + pts = d_video->decoded_pts; + } + mpi->pts = pts; d_video->decoded_pts = pts; - d_video->pts = pts; return mpi; } diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h index 9117fceefd..d411717a32 100644 --- a/video/decode/dec_video.h +++ b/video/decode/dec_video.h @@ -65,9 +65,6 @@ struct dec_video { // Final PTS of previously decoded image double decoded_pts; - // PTS of the last decoded frame (often overwritten by player) - double pts; - float stream_aspect; // aspect ratio in media headers (DVD IFO files) int i_bps; // == bitrate (compressed bytes/sec) float fps; // FPS from demuxer or from user override -- cgit v1.2.3