mirror of https://github.com/mpv-player/mpv
player: ensure backward playback state is propagated on track switching
Track switching doesn't run reset_playback_state(), so a track enabled at runtime during backward playback would lead to a messed up state. This commit just does a bad code monkey fix to this. It feels like there needs to be a much better way to propagate this state.
This commit is contained in:
parent
911718c413
commit
60a0db39aa
|
@ -187,8 +187,12 @@ static void ao_chain_reset_state(struct ao_chain *ao_c)
|
|||
|
||||
void reset_audio_state(struct MPContext *mpctx)
|
||||
{
|
||||
if (mpctx->ao_chain)
|
||||
if (mpctx->ao_chain) {
|
||||
ao_chain_reset_state(mpctx->ao_chain);
|
||||
struct track *t = mpctx->ao_chain->track;
|
||||
if (t && t->dec)
|
||||
t->dec->play_dir = mpctx->play_dir;
|
||||
}
|
||||
mpctx->audio_status = mpctx->ao_chain ? STATUS_SYNCING : STATUS_EOF;
|
||||
mpctx->delay = 0;
|
||||
mpctx->audio_drop_throttle = 0;
|
||||
|
|
|
@ -226,10 +226,9 @@ void reset_playback_state(struct MPContext *mpctx)
|
|||
|
||||
for (int n = 0; n < mpctx->num_tracks; n++) {
|
||||
struct track *t = mpctx->tracks[n];
|
||||
// (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;
|
||||
|
|
|
@ -48,8 +48,10 @@ static int get_order(struct MPContext *mpctx, struct track *track)
|
|||
|
||||
static void reset_subtitles(struct MPContext *mpctx, struct track *track)
|
||||
{
|
||||
if (track->d_sub)
|
||||
if (track->d_sub) {
|
||||
sub_reset(track->d_sub);
|
||||
sub_set_play_dir(track->d_sub, mpctx->play_dir);
|
||||
}
|
||||
term_osd_set_subs(mpctx, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,8 +95,12 @@ static void vo_chain_reset_state(struct vo_chain *vo_c)
|
|||
|
||||
void reset_video_state(struct MPContext *mpctx)
|
||||
{
|
||||
if (mpctx->vo_chain)
|
||||
if (mpctx->vo_chain) {
|
||||
vo_chain_reset_state(mpctx->vo_chain);
|
||||
struct track *t = mpctx->vo_chain->track;
|
||||
if (t && t->dec)
|
||||
t->dec->play_dir = mpctx->play_dir;
|
||||
}
|
||||
|
||||
for (int n = 0; n < mpctx->num_next_frames; n++)
|
||||
mp_image_unrefp(&mpctx->next_frames[n]);
|
||||
|
|
Loading…
Reference in New Issue