summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-04 20:26:35 +0100
committerwm4 <wm4@nowhere>2020-02-04 20:26:35 +0100
commit6a83187b064959ca55f14b91446d256c8708970f (patch)
treeb01b90fe2c15b29f1d2ad23460244f3f487dc7e1
parent2b851933e013d992069d5a0defce112317ec7625 (diff)
downloadmpv-6a83187b064959ca55f14b91446d256c8708970f.tar.bz2
mpv-6a83187b064959ca55f14b91446d256c8708970f.tar.xz
player: partially fix backward playback display of cached text subtitles
This simply didn't set the direction flag in most situations, which meant the timestamps used in the subtitle renderer were nonsense, leading to invisible subtitles. This works only for text subtitles that are cached in the ASS_Track state. Reading new subtitles is broken because the demuxer layer has trouble returning subtitle packets backwards, and I think for rendering bitmap subtitles, the pruning direction would have to be adjusted. (Not sure if reversing the timestamps before the subtitle renderer backend is even the right thing to do. At least for sd_ass.c, it seems to make sense, because it caches subtitles with "normal" timestamps.)
-rw-r--r--player/playloop.c2
-rw-r--r--player/sub.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 8fa590ff68..7b5a2f6d45 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -229,6 +229,8 @@ void reset_playback_state(struct MPContext *mpctx)
// (Often, but not always, this is redundant and also done elsewhere.)
if (t->dec)
t->dec->play_dir = mpctx->play_dir;
+ if (t->d_sub)
+ sub_set_play_dir(t->d_sub, mpctx->play_dir);
}
mpctx->hrseek_active = false;
diff --git a/player/sub.c b/player/sub.c
index 12a9696227..599430ac21 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -57,11 +57,8 @@ static void reset_subtitles(struct MPContext *mpctx, struct track *track)
void reset_subtitle_state(struct MPContext *mpctx)
{
- for (int n = 0; n < mpctx->num_tracks; n++) {
- struct dec_sub *d_sub = mpctx->tracks[n]->d_sub;
- if (d_sub)
- sub_reset(d_sub);
- }
+ for (int n = 0; n < mpctx->num_tracks; n++)
+ reset_subtitles(mpctx, mpctx->tracks[n]);
term_osd_set_subs(mpctx, NULL);
}