From 590caeb2bdeddd85aa86e4b08c05db058c538433 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 3 Sep 2016 16:39:59 +0200 Subject: command: try selecting the next track if track switching fails This affects the "cycle" command. If we switched to the next track, and it failed to initialize, we just deselected everything. Change it so that if initialization fails early (typically decoder selection), we try to continue with the track after that. (Even if nothing can be selected, the loop will terminate when trying to select nothing. Fixes #3446. --- player/command.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 942430f3ba..03ea4d640c 100644 --- a/player/command.c +++ b/player/command.c @@ -1961,9 +1961,10 @@ static int property_switch_track(struct m_property *prop, int action, void *arg, if (!mpctx->playback_initialized) return M_PROPERTY_ERROR; struct m_property_switch_arg *sarg = arg; - mp_switch_track_n(mpctx, order, type, - track_next(mpctx, type, sarg->inc >= 0 ? +1 : -1, track), - FLAG_MARK_SELECTION); + do { + track = track_next(mpctx, type, sarg->inc >= 0 ? +1 : -1, track); + mp_switch_track_n(mpctx, order, type, track, FLAG_MARK_SELECTION); + } while (mpctx->current_track[order][type] != track); print_track_list(mpctx, "Track switched:"); return M_PROPERTY_OK; } -- cgit v1.2.3