diff options
author | wm4 <wm4@nowhere> | 2016-09-24 19:56:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-24 19:57:19 +0200 |
commit | 88f10ec84f116bca4580a454b711dbaec7dfd04f (patch) | |
tree | 9c0eda17cdc0b20247e1c0c70722be52b833205c /player/sub.c | |
parent | 2361ec35aa2438cb6c4e9976eecc856d3b123447 (diff) | |
download | mpv-88f10ec84f116bca4580a454b711dbaec7dfd04f.tar.bz2 mpv-88f10ec84f116bca4580a454b711dbaec7dfd04f.tar.xz |
player: fix instant subtitle refresh on track switches
When switching a subtitle track, the subtitle wasn't necessarily
updated, especially when playback was paused.
Some awfully subtle and complex interactions here.
First off (and not so subtle), the subtitle decoder will read packets
only on explicit update_subtitles() calls, which, if video is active, is
called only when a new video frame is shown. (A simply video frame
redraw doesn't trigger this.) So call it explicitly. But only if
playback is "initialized", i.e. not when it does initial track selection
and decoder init, during which no packets should be read.
The second issue is that the demuxer thread simply will not read new
packets just because a track was switched, especially if playback is
paused. That's fine, but if a refresh seek is to be done, it really
should do this. So if there's either 1. a refresh seek requested, or 2.
a refresh seek ongoing, then read more packets.
Note that it's entirely possible that we overflow the packet queue with
this in unpredicated weird corner cases, but the queue limit will still
be enforced, so this shouldn't make the situation worse.
Diffstat (limited to 'player/sub.c')
-rw-r--r-- | player/sub.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/player/sub.c b/player/sub.c index 6d01e0ca5d..c4a24fe011 100644 --- a/player/sub.c +++ b/player/sub.c @@ -183,6 +183,9 @@ void reinit_sub(struct MPContext *mpctx, struct track *track) int order = get_order(mpctx, track); osd_set_sub(mpctx->osd, order, track->d_sub); sub_control(track->d_sub, SD_CTRL_SET_TOP, &(bool){!!order}); + + if (mpctx->playback_initialized) + update_subtitles(mpctx, mpctx->playback_pts); } void reinit_sub_all(struct MPContext *mpctx) |