From 870dc8483954ea0cb80bee1473b6ae58ae64bdce Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 22 Jul 2014 23:48:29 +0200 Subject: [PATCH] sub: offset subtitle timing to video start PTS This allows using external subtitle files with e.g. transport stream files that don't start at time 0. Note that if the .ts file has timestamp resets, everything goes south. But I guess this was already the case before, unless there are external subtitle files that also include timestamp resets, which is unlikely. (On the other hand, you could for example expect that it works with embedded DVB subtitles, that were somehow captured from the same stream and use the same timestamps.) --- player/sub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player/sub.c b/player/sub.c index 7202eff9e5..2018e6ed7b 100644 --- a/player/sub.c +++ b/player/sub.c @@ -101,7 +101,8 @@ static void update_subtitle(struct MPContext *mpctx, int order) struct osd_sub_state state; osd_get_sub(mpctx->osd, obj, &state); - state.video_offset = track->under_timeline ? mpctx->video_offset : 0; + state.video_offset = + track->under_timeline ? mpctx->video_offset : get_start_time(mpctx); osd_set_sub(mpctx->osd, obj, &state);