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.)
This commit is contained in:
wm4 2020-02-04 20:26:35 +01:00
parent 2b851933e0
commit 6a83187b06
2 changed files with 4 additions and 5 deletions

View File

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

View File

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