diff options
author | wm4 <wm4@nowhere> | 2012-11-15 20:26:52 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-16 21:21:15 +0100 |
commit | b7052b431c92c2babd032885701fb56dfd3ec452 (patch) | |
tree | cf4e45be7d61387cf831d28a19306a0cb4cbf194 /core/command.c | |
parent | dd7dc2ee3d060d77dbafb3182127eb1a59c2d79f (diff) | |
download | mpv-b7052b431c92c2babd032885701fb56dfd3ec452.tar.bz2 mpv-b7052b431c92c2babd032885701fb56dfd3ec452.tar.xz |
command: add sub_reload and sub_remove commands
sub_remove remove an external subtitle track, for whatever this may be
needed.
sub_reload removes and re-adds an external subtitle track.
Also rename sub_load to sub_add, because that seems to be more in line
with sub_remove.
Diffstat (limited to 'core/command.c')
-rw-r--r-- | core/command.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/core/command.c b/core/command.c index f333f20f54..a9cba1800c 100644 --- a/core/command.c +++ b/core/command.c @@ -2205,12 +2205,33 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; #endif /* CONFIG_TV */ - case MP_CMD_SUB_LOAD: + case MP_CMD_SUB_ADD: if (sh_video) { - add_subtitles(mpctx, cmd->args[0].v.s, sh_video->fps, 0); + mp_add_subtitles(mpctx, cmd->args[0].v.s, sh_video->fps, 0); } break; + case MP_CMD_SUB_REMOVE: { + struct track *sub = mp_track_by_tid(mpctx, STREAM_SUB, cmd->args[0].v.i); + if (sub) + mp_remove_track(mpctx, sub); + break; + } + + case MP_CMD_SUB_RELOAD: { + struct track *sub = mp_track_by_tid(mpctx, STREAM_SUB, cmd->args[0].v.i); + if (sh_video && sub && sub->is_external && sub->external_filename) + { + struct track *nsub = mp_add_subtitles(mpctx, sub->external_filename, + sh_video->fps, 0); + if (nsub) { + mp_remove_track(mpctx, sub); + mp_switch_track(mpctx, nsub->type, nsub); + } + } + break; + } + case MP_CMD_SCREENSHOT: screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i); break; |