summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/player/command.c b/player/command.c
index 5af2a53ef5..fa0151c6b8 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2178,19 +2178,28 @@ static int property_switch_track(struct m_property *prop, int action, void *arg,
track->user_tid, lang);
}
} else {
- *(char **) arg = talloc_strdup(NULL, "no");
+ const char *msg = "no";
+ if (!mpctx->playback_initialized &&
+ mpctx->opts->stream_id[order][type] == -1)
+ msg = "auto";
+ *(char **) arg = talloc_strdup(NULL, msg);
}
return M_PROPERTY_OK;
case M_PROPERTY_SWITCH: {
- if (!mpctx->playback_initialized)
- return M_PROPERTY_ERROR;
- struct m_property_switch_arg *sarg = arg;
- 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:");
+ if (mpctx->playback_initialized) {
+ struct m_property_switch_arg *sarg = arg;
+ 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:");
+ } else {
+ // Simply cycle between "no" and "auto". It's possible that this does
+ // not always do what the user means, but keep the complexity low.
+ mpctx->opts->stream_id[order][type] =
+ mpctx->opts->stream_id[order][type] == -1 ? -2 : -1;
+ }
return M_PROPERTY_OK;
}
case M_PROPERTY_SET: