summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-04 18:13:09 +0200
committerwm4 <wm4@nowhere>2014-08-04 18:17:30 +0200
commitee6df2f76c7c8a7c26d905444529dc3b755d8548 (patch)
treeb88db84a46d8cd7cee2b805c17a7dc58c4a689ce /player
parent922b1d8504ff8556bcac663d7446be893e93feca (diff)
downloadmpv-ee6df2f76c7c8a7c26d905444529dc3b755d8548.tar.bz2
mpv-ee6df2f76c7c8a7c26d905444529dc3b755d8548.tar.xz
sub: fix subtitle timing for TS
The subtitle timing logic always used the demuxer's start time as video offset. This made external subtitle files "just work" with file formats like TS, which usually have a non-0 start time. But it was wrong for subtitles muxed with the TS, so adjust the time offset explicitly with external files only.
Diffstat (limited to 'player')
-rw-r--r--player/sub.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/player/sub.c b/player/sub.c
index 4478b1092c..d6903c146e 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -107,8 +107,12 @@ 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 : get_start_time(mpctx);
+ state.video_offset = 0;
+ if (track->under_timeline) {
+ state.video_offset += mpctx->video_offset;
+ } else if (track->is_external) {
+ state.video_offset += get_start_time(mpctx);
+ };
osd_set_sub(mpctx->osd, obj, &state);