1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

command: unbreak runtime play-dir changes

The whole mess with setting the option value explictly and saving the
old stop_play value only needs to happen if we're at the end of file.
Doing it in general is unneccessary and breaks other things.
Fixes #12424.
This commit is contained in:
Dudemanguy 2023-10-16 09:14:20 -05:00
parent 056072bf95
commit 9d3e607cf7

View File

@ -7064,14 +7064,16 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
if (opt_ptr == &opts->play_dir) {
if (mpctx->play_dir != opts->play_dir) {
// Some weird things for play_dir.
// Some weird things for play_dir if we're at EOF.
// 1. The option must be set before we seek.
// 2. queue_seek can change the stop_play value; always keep the old one.
mpctx->play_dir = opts->play_dir;
int old_stop_play = mpctx->stop_play;
if (old_stop_play == AT_END_OF_FILE)
mpctx->play_dir = opts->play_dir;
queue_seek(mpctx, MPSEEK_ABSOLUTE, get_current_time(mpctx),
MPSEEK_EXACT, 0);
mpctx->stop_play = old_stop_play;
if (old_stop_play == AT_END_OF_FILE)
mpctx->stop_play = old_stop_play;
}
}