aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-05-31 09:13:21 +0000
committerGravatar albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-05-31 09:13:21 +0000
commit17ac1fe1ce0c6fb63a06c0911c103d0236a8c44c (patch)
treebaf38b9ad29610d5add3ee06a77424644c9323e1
parent46d9d6fa72033543aa3de59c95a557f121bd8de8 (diff)
Fix the step_property coammand to correctly handle the step size with
all numerical types. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23429 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--command.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/command.c b/command.c
index 7eeb636598..a61505325f 100644
--- a/command.c
+++ b/command.c
@@ -1709,17 +1709,42 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_STEP_PROPERTY:{
- float arg = cmd->args[1].v.f;
- int r = mp_property_do
- (cmd->args[0].v.s, M_PROPERTY_STEP_UP,
- arg ? &arg : NULL, mpctx);
+ void* arg = NULL;
+ int r,i;
+ double d;
+ off_t o;
+ if (cmd->args[1].v.f) {
+ m_option_t* prop;
+ if((r = mp_property_do(cmd->args[0].v.s,
+ M_PROPERTY_GET_TYPE,
+ &prop, mpctx)) <= 0)
+ goto step_prop_err;
+ if(prop->type == CONF_TYPE_INT ||
+ prop->type == CONF_TYPE_FLAG)
+ i = cmd->args[1].v.f, arg = &i;
+ else if(prop->type == CONF_TYPE_FLOAT)
+ arg = &cmd->args[1].v.f;
+ else if(prop->type == CONF_TYPE_DOUBLE ||
+ prop->type == CONF_TYPE_TIME)
+ d = cmd->args[1].v.f, arg = &d;
+ else if(prop->type == CONF_TYPE_POSITION)
+ o = cmd->args[1].v.f, arg = &o;
+ else
+ mp_msg(MSGT_CPLAYER, MSGL_WARN,
+ "Ignoring step size stepping property '%s'.\n",
+ cmd->args[0].v.s);
+ }
+ r = mp_property_do(cmd->args[0].v.s,
+ M_PROPERTY_STEP_UP,
+ arg, mpctx);
+ step_prop_err:
if (r == M_PROPERTY_UNKNOWN)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"Unknown property: '%s'\n", cmd->args[0].v.s);
else if (r <= 0)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"Failed to increment property '%s' by %f.\n",
- cmd->args[0].v.s, arg);
+ cmd->args[0].v.s, cmd->args[1].v.f);
}
break;