From 131633b4e5a378ce67ad7e04ca713097f0c01c71 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Oct 2014 23:55:29 +0200 Subject: command: extend sub_add command --- player/command.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'player/command.c') 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; } -- cgit v1.2.3