From 35bdb63952b50b634121ee49446294861766e72d Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 3 Feb 2016 09:05:05 +0100 Subject: command: fix track cycling logic Also remove the unused function argument. Fixes #2784. --- player/command.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index aff1b578e7..52718d60ae 100644 --- a/player/command.c +++ b/player/command.c @@ -1820,23 +1820,18 @@ static int mp_property_balance(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } -static struct track* track_next(struct MPContext *mpctx, int order, - enum stream_type type, int direction, - struct track *track) +static struct track* track_next(struct MPContext *mpctx, enum stream_type type, + int direction, struct track *track) { assert(direction == -1 || direction == +1); struct track *prev = NULL, *next = NULL; bool seen = track == NULL; for (int n = 0; n < mpctx->num_tracks; n++) { struct track *cur = mpctx->tracks[n]; - // One track can be selected only one time - pretend already selected - // tracks don't exist. - if (cur->selected) - continue; if (cur->type == type) { if (cur == track) { seen = true; - } else { + } else if (!cur->selected) { if (seen && !next) { next = cur; } @@ -1885,7 +1880,7 @@ static int property_switch_track(struct m_property *prop, int action, void *arg, return M_PROPERTY_ERROR; struct m_property_switch_arg *sarg = arg; mp_switch_track_n(mpctx, order, type, - track_next(mpctx, order, type, sarg->inc >= 0 ? +1 : -1, track), + track_next(mpctx, type, sarg->inc >= 0 ? +1 : -1, track), FLAG_MARK_SELECTION); print_track_list(mpctx, "Track switched:"); return M_PROPERTY_OK; -- cgit v1.2.3