summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-29 01:11:50 +0200
committerwm4 <wm4@nowhere>2013-05-30 22:20:03 +0200
commit724f576211c1ea07e0423ac8a9c0e4f273c452fb (patch)
treec976b74a7e142f5bb3fcda67d46fb7826f6d321f /core
parent38bd757e4fd4d87441cdc20777c0cc2eaab85db8 (diff)
downloadmpv-724f576211c1ea07e0423ac8a9c0e4f273c452fb.tar.bz2
mpv-724f576211c1ea07e0423ac8a9c0e4f273c452fb.tar.xz
sub: use DVD PTS fallback code in normal sub decoding path
It appears demux_mpg doesn't output timestamps for subtitles. The vobsub code handled this by doing its own PTS calculations. This code is absent from the normal subtitle decoder path. Copy this code into the normal path, so that we can unify the subtitle decoder paths in a later commit. Decoding subtitles with sd_lavc when playing DVD with demux_mpg still doesn't work.
Diffstat (limited to 'core')
-rw-r--r--core/mplayer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index 602d1f0616..bb6a0872cc 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1938,6 +1938,20 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
while (d_sub->first) {
double subpts_s = ds_get_next_pts(d_sub);
+ if (subpts_s == MP_NOPTS_VALUE) {
+ // Try old method of getting PTS. This is only needed in the
+ // DVD playback case with demux_mpg.
+ // XXX This is wrong, sh_video->pts can be arbitrarily
+ // much behind demuxing position. Unfortunately using
+ // d_video->pts which would have been the simplest
+ // improvement doesn't work because mpeg specific hacks
+ // in video.c set d_video->pts to 0.
+ float x = d_sub->pts - refpts_s;
+ if (x > -20 && x < 20) // prevent missing subs on pts reset
+ subpts_s = d_sub->pts;
+ else
+ subpts_s = curpts_s;
+ }
if (subpts_s > curpts_s) {
mp_dbg(MSGT_CPLAYER, MSGL_DBG2,
"Sub early: c_pts=%5.3f s_pts=%5.3f\n",