diff options
author | wm4 <wm4@nowhere> | 2016-02-03 09:05:05 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-03 09:05:05 +0100 |
commit | 35bdb63952b50b634121ee49446294861766e72d (patch) | |
tree | 14901aadd94ee1adecf7a6353bcaf6e8f029ba8d | |
parent | 5d949774775f0daa270e67d53def647877494fa7 (diff) | |
download | mpv-35bdb63952b50b634121ee49446294861766e72d.tar.bz2 mpv-35bdb63952b50b634121ee49446294861766e72d.tar.xz |
command: fix track cycling logic
Also remove the unused function argument.
Fixes #2784.
-rw-r--r-- | player/command.c | 13 |
1 files changed, 4 insertions, 9 deletions
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; |