1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

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.)
This commit is contained in:
wm4 2014-07-22 23:48:29 +02:00
parent aa1a383342
commit 870dc84839

View File

@ -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);