summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-26 23:41:20 +0100
committerwm4 <wm4@nowhere>2013-11-26 23:43:56 +0100
commit7a0299478e169ea076fe57028fda1ef7292a5431 (patch)
tree56942e2b844c08d507be009535446c92831a588d
parentf1eb30a476fa92840d1cdfcdcc13db9e59ad09a6 (diff)
downloadmpv-7a0299478e169ea076fe57028fda1ef7292a5431.tar.bz2
mpv-7a0299478e169ea076fe57028fda1ef7292a5431.tar.xz
video: unbreak --no-correct-pts with demuxers that use DTS
-rw-r--r--mpvcore/player/playloop.c2
-rw-r--r--mpvcore/player/video.c2
-rw-r--r--video/decode/dec_video.c8
-rw-r--r--video/decode/dec_video.h2
4 files changed, 8 insertions, 6 deletions
diff --git a/mpvcore/player/playloop.c b/mpvcore/player/playloop.c
index 56b2bc0bc5..73c751652c 100644
--- a/mpvcore/player/playloop.c
+++ b/mpvcore/player/playloop.c
@@ -176,7 +176,7 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao)
vf_chain_seek_reset(mpctx->d_video->vfilter);
mpctx->d_video->num_buffered_pts = 0;
mpctx->d_video->last_pts = MP_NOPTS_VALUE;
- mpctx->d_video->last_packet_pts = MP_NOPTS_VALUE;
+ mpctx->d_video->last_packet_pdts = MP_NOPTS_VALUE;
mpctx->d_video->pts = MP_NOPTS_VALUE;
mpctx->video_pts = MP_NOPTS_VALUE;
mpctx->delay = 0;
diff --git a/mpvcore/player/video.c b/mpvcore/player/video.c
index 429e141ab9..65343cfa58 100644
--- a/mpvcore/player/video.c
+++ b/mpvcore/player/video.c
@@ -119,7 +119,7 @@ int reinit_video_chain(struct MPContext *mpctx)
struct dec_video *d_video = talloc_zero(NULL, struct dec_video);
mpctx->d_video = d_video;
d_video->last_pts = MP_NOPTS_VALUE;
- d_video->last_packet_pts = MP_NOPTS_VALUE;
+ d_video->last_packet_pdts = MP_NOPTS_VALUE;
d_video->opts = mpctx->opts;
d_video->header = sh;
d_video->fps = sh->video->fps;
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 8d4b6cb194..679295b83e 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -211,7 +211,7 @@ static void determine_frame_pts(struct dec_video *d_video)
if (!opts->correct_pts) {
double frame_time = 1.0f / (d_video->fps > 0 ? d_video->fps : 25);
- double pkt_pts = d_video->last_packet_pts;
+ double pkt_pts = d_video->last_packet_pdts;
if (d_video->pts == MP_NOPTS_VALUE)
d_video->pts = pkt_pts == MP_NOPTS_VALUE ? 0 : pkt_pts;
@@ -253,9 +253,11 @@ struct mp_image *video_decode(struct dec_video *d_video,
struct MPOpts *opts = d_video->opts;
bool sort_pts = opts->user_pts_assoc_mode != 1 && opts->correct_pts;
double pts = packet ? packet->pts : MP_NOPTS_VALUE;
+ double dts = packet ? packet->dts : MP_NOPTS_VALUE;
- if (pts != MP_NOPTS_VALUE)
- d_video->last_packet_pts = pts;
+ double pdts = pts == MP_NOPTS_VALUE ? dts : pts;
+ if (pdts != MP_NOPTS_VALUE)
+ d_video->last_packet_pdts = pdts;
if (sort_pts && pts != MP_NOPTS_VALUE) {
int delay = -1;
diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h
index 6259d5b0d4..a9c64cb695 100644
--- a/video/decode/dec_video.h
+++ b/video/decode/dec_video.h
@@ -60,7 +60,7 @@ struct dec_video {
float fps; // FPS from demuxer or from user override
float initial_decoder_aspect;
- double last_packet_pts;
+ double last_packet_pdts;
// State used only by player/video.c
double last_pts;
};