diff options
author | wm4 <wm4@nowhere> | 2018-05-05 20:20:21 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:33 +0200 |
commit | dc00566963b35c931a4cf489d4361daa8283697a (patch) | |
tree | 9aec83db4c36eecbddc48be6aa29cea36dfe76c2 | |
parent | 88f9506f42ceea1efb10b39c6854c9ad28f92710 (diff) | |
download | mpv-dc00566963b35c931a4cf489d4361daa8283697a.tar.bz2 mpv-dc00566963b35c931a4cf489d4361daa8283697a.tar.xz |
command: handle list commands like normal commands
Pretty annoying.
-rw-r--r-- | input/cmd.c | 4 | ||||
-rw-r--r-- | player/command.c | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/input/cmd.c b/input/cmd.c index 8c15c0109b..ceee2c7403 100644 --- a/input/cmd.c +++ b/input/cmd.c @@ -27,10 +27,6 @@ #include "libmpv/client.h" -const struct mp_cmd_def mp_cmd_list = { - .name = "list", -}; - static void destroy_cmd(void *ptr) { struct mp_cmd *cmd = ptr; diff --git a/player/command.c b/player/command.c index cc8b609c50..3fe39642a6 100644 --- a/player/command.c +++ b/player/command.c @@ -4825,6 +4825,16 @@ static void cmd_cycle_values(void *p) change_property_cmd(cmd, name, M_PROPERTY_SET_STRING, cmd->args[current].v.s); } +static void cmd_list(void *p) +{ + struct mp_cmd_ctx *cmd = p; + + for (struct mp_cmd *sub = cmd->cmd->args[0].v.p; sub; sub = sub->queue_next) + run_command(cmd->mpctx, sub, NULL); +} + +const struct mp_cmd_def mp_cmd_list = { "list", cmd_list }; + int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *res) { struct mpv_node dummy_node = {0}; @@ -4861,13 +4871,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re } } - if (cmd->def == &mp_cmd_list) { - for (struct mp_cmd *sub = cmd->args[0].v.p; sub; sub = sub->queue_next) - run_command(mpctx, sub, NULL); - } else { - assert(cmd->def->handler); - cmd->def->handler(ctx); - } + cmd->def->handler(ctx); if (!ctx->success) mpv_free_node_contents(ctx->result); |