summaryrefslogtreecommitdiffstats
path: root/core/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-04 23:56:20 +0200
committerwm4 <wm4@nowhere>2013-08-05 00:00:26 +0200
commitee2e3b3374c4756dc881962bea4e4615805a8122 (patch)
treeeefd7cd4f17e6b68d2a7eebf4d9fcd1db0b9b1f1 /core/command.c
parentcccfac47a423cbaeda04f9864c4676ed1c9d5002 (diff)
downloadmpv-ee2e3b3374c4756dc881962bea4e4615805a8122.tar.bz2
mpv-ee2e3b3374c4756dc881962bea4e4615805a8122.tar.xz
core: change speed option/property to double
The --speed option and the speed property used float. Change them to double. Change the commands that manipulate the property (speed_mult/add) to double as well. Since the cycle command shares code with the add command, we change that as well. The reason for this change is that this allows better control over speed, such as stepping by semitones. Using floats is also just plain unnecessary.
Diffstat (limited to 'core/command.c')
-rw-r--r--core/command.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/command.c b/core/command.c
index e50121fede..a2d4d2ee56 100644
--- a/core/command.c
+++ b/core/command.c
@@ -127,7 +127,7 @@ static int mp_property_playback_speed(m_option_t *prop, int action,
double orig_speed = opts->playback_speed;
switch (action) {
case M_PROPERTY_SET: {
- opts->playback_speed = *(float *) arg;
+ opts->playback_speed = *(double *) arg;
// Adjust time until next frame flip for nosound mode
mpctx->time_frame *= orig_speed / opts->playback_speed;
if (mpctx->sh_audio)
@@ -2186,8 +2186,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
.inc = 1,
.wrap = cmd->id == MP_CMD_CYCLE,
};
- if (cmd->args[1].v.f)
- s.inc = cmd->args[1].v.f;
+ if (cmd->args[1].v.d)
+ s.inc = cmd->args[1].v.d;
int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_SWITCH, &s, mpctx);
if (r == M_PROPERTY_OK || r == M_PROPERTY_UNAVAILABLE) {
show_property_osd(mpctx, cmd->args[0].v.s, cmd->on_osd);
@@ -2221,7 +2221,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
case MP_CMD_SPEED_MULT: {
- float v = cmd->args[0].v.f;
+ double v = cmd->args[0].v.d;
v *= mpctx->opts->playback_speed;
mp_property_do("speed", M_PROPERTY_SET, &v, mpctx);
show_property_osd(mpctx, "speed", cmd->on_osd);