summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-20 23:55:29 +0200
committerwm4 <wm4@nowhere>2014-10-21 00:15:04 +0200
commit131633b4e5a378ce67ad7e04ca713097f0c01c71 (patch)
tree44f48ef4af18b7b845ab60899505640d51c88128 /player
parentb79f291f4bb6f3f2efb24b9f03829784c17a0541 (diff)
downloadmpv-131633b4e5a378ce67ad7e04ca713097f0c01c71.tar.bz2
mpv-131633b4e5a378ce67ad7e04ca713097f0c01c71.tar.xz
command: extend sub_add command
Diffstat (limited to 'player')
-rw-r--r--player/command.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index 2e42c8079f..e4cd73131c 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4019,8 +4019,16 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
struct track *sub = mp_add_subtitles(mpctx, cmd->args[0].v.s);
if (!sub)
return -1;
- mp_switch_track(mpctx, sub->type, sub);
- mp_mark_user_track_selection(mpctx, 0, sub->type);
+ if (cmd->args[1].v.i == 0) {
+ mp_switch_track(mpctx, sub->type, sub);
+ mp_mark_user_track_selection(mpctx, 0, sub->type);
+ }
+ char *title = cmd->args[2].v.s;
+ if (title && title[0])
+ sub->title = talloc_strdup(sub, title);
+ char *lang = cmd->args[3].v.s;
+ if (lang && lang[0])
+ sub->lang = talloc_strdup(sub, lang);
break;
}