From 59d9007e15fe30fd0ed24580eb461ae02d497f40 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 3 Mar 2014 23:53:12 +0100 Subject: player: make separation between user/automatic track selection stronger For example, consider the case when audio initialization fails. Then the audio track is deselected. Before this commit, this would have been equivalent to the user disabling audio. This is bad when multiple files are played at once (the next file would have audio disabled, even if it works), or if playback resume is used (if e.g. audio output failed to initialize, then audio would be disabled when resuming, even if the system's audio driver was fixed). --- player/command.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 69bfba0975..0b135d187f 100644 --- a/player/command.c +++ b/player/command.c @@ -1178,11 +1178,13 @@ static int property_switch_track(m_option_t *prop, int action, void *arg, 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)); + mp_mark_user_track_selection(mpctx, order, type); return M_PROPERTY_OK; } case M_PROPERTY_SET: track = mp_track_by_tid(mpctx, type, *(int *)arg); mp_switch_track_n(mpctx, order, type, track); + mp_mark_user_track_selection(mpctx, order, type); return M_PROPERTY_OK; } return mp_property_generic_option(prop, action, arg, mpctx); @@ -3240,8 +3242,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) case MP_CMD_SUB_ADD: { struct track *sub = mp_add_subtitles(mpctx, cmd->args[0].v.s); - if (sub) + if (sub) { mp_switch_track(mpctx, sub->type, sub); + mp_mark_user_track_selection(mpctx, 0, sub->type); + } break; } -- cgit v1.2.3