From 2ac74977c5f6561e33ad37c68b9da47739c7fd6c Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 22 Sep 2016 20:43:33 +0200 Subject: command: add a load-script command The intention is to give libmpv users as much flexibility to load scripts as using mpv from CLI, but without restricting libmpv users from having to decide everything on creation time, or having to go through hacks like recreating the libmpv context to update state. --- player/command.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 2296c97f7b..d49b844caf 100644 --- a/player/command.c +++ b/player/command.c @@ -5472,6 +5472,13 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re break; } + case MP_CMD_LOAD_SCRIPT: { + char *script = cmd->args[0].v.s; + if (mp_load_script(mpctx, script) < 0) + return -1; + break; + } + default: MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name); return -1; -- cgit v1.2.3