command: sub_add with "auto" should not always select a subtitle track

Running "sub_add file.srt auto" during hook execution automatically
selected the first added track. This happened because all tracks added
with sub_add are marked as "external", and external subtitles are always
selected by default.

Fix this by negating the "external" flag when autoselecting subtitles
during loading. The no_default flag exists for this purpose; it was
probably added for libquvi originally, where we had the same issue.
This commit is contained in:
wm4 2014-11-27 18:57:18 +01:00 committed by Alessandro Ghedini
parent 3051ff9f25
commit 3d6d7012ff
1 changed files with 3 additions and 1 deletions

View File

@ -4350,7 +4350,9 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
struct track *sub = mp_add_subtitles(mpctx, cmd->args[0].v.s); struct track *sub = mp_add_subtitles(mpctx, cmd->args[0].v.s);
if (!sub) if (!sub)
return -1; return -1;
if (cmd->args[1].v.i != 1) { if (cmd->args[1].v.i == 1) {
sub->no_default = true;
} else {
mp_switch_track(mpctx, sub->type, sub); mp_switch_track(mpctx, sub->type, sub);
mp_mark_user_track_selection(mpctx, 0, sub->type); mp_mark_user_track_selection(mpctx, 0, sub->type);
} }