From 75afa370b9aba90be73b8acc97eb9669bc0f2133 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Apr 2013 01:43:14 +0200 Subject: demux_mkv: try to show current subtitle when seeking Makes sure that seeking to a given time position shows the subtitle at that position. This can fail if the subtitle packet is not close enough to the seek target. Always enabled for hr-seeks, and can be manually enabled for normal seeks with --mkv-subtitle-preroll. This helps displaying subtitles correctly with ordered chapters. When switching ordered chapter segments, a seek is performed. If the subtitle is timed slightly before the start of the segment, it normally won't be demuxed. This is a problem with all seeks, but in this case normal playback is affected. Since switching segments always uses hr-seeks, the code added by this commit is always active in this situation. If no subtitles are selected or the subtitles come from an external file, the demuxer should behave exactly as before this commit. --- core/mplayer.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/mplayer.c') diff --git a/core/mplayer.c b/core/mplayer.c index 21af9ca57a..3833d0a7da 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2821,6 +2821,8 @@ static int seek(MPContext *mpctx, struct seek_params seek, demuxer_style |= SEEK_BACKWARD; else if (seek.direction > 0) demuxer_style |= SEEK_FORWARD; + if (hr_seek || opts->mkv_subtitle_preroll) + demuxer_style |= SEEK_SUBPREROLL; if (hr_seek) demuxer_amount -= opts->hr_seek_demuxer_offset; -- cgit v1.2.3