path: root/player/sub.c
diff options
authorwm4 <wm4@nowhere>2014-07-22 23:48:29 +0200
committerwm4 <wm4@nowhere>2014-07-22 23:48:29 +0200
commit870dc8483954ea0cb80bee1473b6ae58ae64bdce (patch)
tree5d4304143beae324259beb3e489ad1a64a346e67 /player/sub.c
parentaa1a383342f72fb0dfb1fb016535735bc0480e7e (diff)
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.)
Diffstat (limited to 'player/sub.c')
1 files changed, 2 insertions, 1 deletions
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);