summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-03 23:53:12 +0100
committerwm4 <wm4@nowhere>2014-03-03 23:53:12 +0100
commit59d9007e15fe30fd0ed24580eb461ae02d497f40 (patch)
treed12f8a611c7d334803c66f80af18f6a5e0f9bb37 /player/command.c
parent082b1cdeaa4fb720cca6e9cbad19c83df69f448c (diff)
downloadmpv-59d9007e15fe30fd0ed24580eb461ae02d497f40.tar.bz2
mpv-59d9007e15fe30fd0ed24580eb461ae02d497f40.tar.xz
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).
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c6
1 files changed, 5 insertions, 1 deletions
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;
}