Mercurial > mplayer.hg
comparison command.c @ 23411:07741c30e64c
Fix the step_property coammand to correctly handle the step size with
all numerical types.
author | albeu |
---|---|
date | Thu, 31 May 2007 09:13:21 +0000 |
parents | 8412921b363c |
children | f6c225ffe60d |
comparison
equal
deleted
inserted
replaced
23410:a25e0a8adab5 | 23411:07741c30e64c |
---|---|
1707 cmd->args[0].v.s, cmd->args[1].v.s); | 1707 cmd->args[0].v.s, cmd->args[1].v.s); |
1708 } | 1708 } |
1709 break; | 1709 break; |
1710 | 1710 |
1711 case MP_CMD_STEP_PROPERTY:{ | 1711 case MP_CMD_STEP_PROPERTY:{ |
1712 float arg = cmd->args[1].v.f; | 1712 void* arg = NULL; |
1713 int r = mp_property_do | 1713 int r,i; |
1714 (cmd->args[0].v.s, M_PROPERTY_STEP_UP, | 1714 double d; |
1715 arg ? &arg : NULL, mpctx); | 1715 off_t o; |
1716 if (cmd->args[1].v.f) { | |
1717 m_option_t* prop; | |
1718 if((r = mp_property_do(cmd->args[0].v.s, | |
1719 M_PROPERTY_GET_TYPE, | |
1720 &prop, mpctx)) <= 0) | |
1721 goto step_prop_err; | |
1722 if(prop->type == CONF_TYPE_INT || | |
1723 prop->type == CONF_TYPE_FLAG) | |
1724 i = cmd->args[1].v.f, arg = &i; | |
1725 else if(prop->type == CONF_TYPE_FLOAT) | |
1726 arg = &cmd->args[1].v.f; | |
1727 else if(prop->type == CONF_TYPE_DOUBLE || | |
1728 prop->type == CONF_TYPE_TIME) | |
1729 d = cmd->args[1].v.f, arg = &d; | |
1730 else if(prop->type == CONF_TYPE_POSITION) | |
1731 o = cmd->args[1].v.f, arg = &o; | |
1732 else | |
1733 mp_msg(MSGT_CPLAYER, MSGL_WARN, | |
1734 "Ignoring step size stepping property '%s'.\n", | |
1735 cmd->args[0].v.s); | |
1736 } | |
1737 r = mp_property_do(cmd->args[0].v.s, | |
1738 M_PROPERTY_STEP_UP, | |
1739 arg, mpctx); | |
1740 step_prop_err: | |
1716 if (r == M_PROPERTY_UNKNOWN) | 1741 if (r == M_PROPERTY_UNKNOWN) |
1717 mp_msg(MSGT_CPLAYER, MSGL_WARN, | 1742 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
1718 "Unknown property: '%s'\n", cmd->args[0].v.s); | 1743 "Unknown property: '%s'\n", cmd->args[0].v.s); |
1719 else if (r <= 0) | 1744 else if (r <= 0) |
1720 mp_msg(MSGT_CPLAYER, MSGL_WARN, | 1745 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
1721 "Failed to increment property '%s' by %f.\n", | 1746 "Failed to increment property '%s' by %f.\n", |
1722 cmd->args[0].v.s, arg); | 1747 cmd->args[0].v.s, cmd->args[1].v.f); |
1723 } | 1748 } |
1724 break; | 1749 break; |
1725 | 1750 |
1726 case MP_CMD_GET_PROPERTY:{ | 1751 case MP_CMD_GET_PROPERTY:{ |
1727 char *tmp; | 1752 char *tmp; |