diff options
author | wm4 <wm4@nowhere> | 2016-09-03 16:39:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-03 17:12:29 +0200 |
commit | 590caeb2bdeddd85aa86e4b08c05db058c538433 (patch) | |
tree | 9822779586fcf80fd31961bd4ef3a0a4ed5b9aad /player/command.c | |
parent | 0c2c059826df1f0463c5cf741d717c6315b4317e (diff) | |
download | mpv-590caeb2bdeddd85aa86e4b08c05db058c538433.tar.bz2 mpv-590caeb2bdeddd85aa86e4b08c05db058c538433.tar.xz |
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.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 7 |
1 files changed, 4 insertions, 3 deletions
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; } |