summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--input/cmd_list.c2
-rw-r--r--input/cmd_parse.c7
-rw-r--r--player/command.c6
3 files changed, 10 insertions, 5 deletions
diff --git a/input/cmd_list.c b/input/cmd_list.c
index 3640cce460..2f3bfb994a 100644
--- a/input/cmd_list.c
+++ b/input/cmd_list.c
@@ -146,7 +146,7 @@ const struct mp_cmd_def mp_cmds[] = {
{ MP_CMD_RUN, "run", { ARG_STRING, ARG_STRING }, .vararg = true },
{ MP_CMD_SET, "set", { ARG_STRING, ARG_STRING } },
- { MP_CMD_ADD, "add", { ARG_STRING, OARG_DOUBLE(0) },
+ { MP_CMD_ADD, "add", { ARG_STRING, OARG_DOUBLE(1) },
.allow_auto_repeat = true},
{ MP_CMD_CYCLE, "cycle", {
ARG_STRING,
diff --git a/input/cmd_parse.c b/input/cmd_parse.c
index 206bd4171f..ba35cd5e1c 100644
--- a/input/cmd_parse.c
+++ b/input/cmd_parse.c
@@ -471,8 +471,15 @@ static int parse_cycle_dir(struct mp_log *log, const struct m_option *opt,
return 1;
}
+static void copy_opt(const m_option_t *opt, void *dst, const void *src)
+{
+ if (dst && src)
+ memcpy(dst, src, opt->type->size);
+}
+
const struct m_option_type m_option_type_cycle_dir = {
.name = "up|down",
.parse = parse_cycle_dir,
+ .copy = copy_opt,
.size = sizeof(double),
};
diff --git a/player/command.c b/player/command.c
index 8514be98f7..19f725ba3a 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4286,13 +4286,11 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
case MP_CMD_ADD:
case MP_CMD_CYCLE:
{
+ char *property = cmd->args[0].v.s;
struct m_property_switch_arg s = {
- .inc = 1,
+ .inc = cmd->args[1].v.d * cmd->scale,
.wrap = cmd->id == MP_CMD_CYCLE,
};
- if (cmd->args[1].v.d)
- s.inc = cmd->args[1].v.d * cmd->scale;
- char *property = cmd->args[0].v.s;
if (cmd->repeated && !check_property_autorepeat(property, mpctx)) {
MP_VERBOSE(mpctx, "Dropping command '%.*s' from auto-repeated key.\n",
BSTR_P(cmd->original));