summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-25 12:28:01 +0100
committerwm4 <wm4@nowhere>2015-12-25 12:28:01 +0100
commit6d9cb89333782c1c7043f58cc4b0c713c2e871d6 (patch)
tree2dfe9e172a4ba3e4857294b98899754dd2db3872 /player
parent940007cbf98f554435baa7909c3528fc616a6e2f (diff)
downloadmpv-6d9cb89333782c1c7043f58cc4b0c713c2e871d6.tar.bz2
mpv-6d9cb89333782c1c7043f58cc4b0c713c2e871d6.tar.xz
sub: clear subtitle list when crossing timeline boundary
When crossing timeline boundaries (such as switching to a new segment or chapter with ordered chapters), clear the internal text subtitle list. This breaks the sub-seek command, but is otherwise not too harmful. Fixes Sub-OC-test-final7.mkv. (The internal text subtitle list is basically a cache to make subtitles show up at the right time when seeking back.) I suspect this was caused by 76fcef61. The sample file times subtitles slightly before the video frame when it should show up. This is to avoid problems with subtitles showing up a frame later than intended. It also means that a subtitle which is supposed to show up on the start of a timeline part boundary actually might first be shown in a different part. Since we now manipulate the packet timestamps, instead of manipulating timestamps after the subtitle decoder, this means this subtitle event would have 2 timestamps, which our code of course does not handle. If the two parts come one after another, this would actually work (since the subtitle would have the same timestamps in the old and new part), but it breaks if the new part (which follows the old part in the physical file) is has a completely different start time in the timeline. Essentially, the trick used to time subtitles correctly is incompatible with the way we cache subtitles (to make them survive seeks). The simple solution is just clearing the cached subtitles when crossing chapter boundaries.
Diffstat (limited to 'player')
-rw-r--r--player/loadfile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index af60aed3e0..8b35209d9f 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -336,6 +336,12 @@ bool timeline_switch_to_time(struct MPContext *mpctx, double pts)
track->type,
track->user_tid - 1);
}
+
+ if (track->type == STREAM_SUB && track->stream) {
+ struct dec_sub *dec = track->stream->sub->dec_sub;
+ if (dec)
+ sub_control(dec, SD_CTRL_CLEAR, NULL);
+ }
}
}