summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-02 02:49:05 +0200
committerwm4 <wm4@nowhere>2014-10-02 02:49:05 +0200
commitc3e2a1febc1610517c7de2a5f57632b83cefa3e8 (patch)
treee640e6549a0255f7342f42235be49e3f38aa02db /player/command.c
parent7dd3822d099522cd8bf59aa1eb3e318e2cfcacdd (diff)
downloadmpv-c3e2a1febc1610517c7de2a5f57632b83cefa3e8.tar.bz2
mpv-c3e2a1febc1610517c7de2a5f57632b83cefa3e8.tar.xz
command: move setting playback speed to a separate function
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/player/command.c b/player/command.c
index 0399905e23..ed36ab4d69 100644
--- a/player/command.c
+++ b/player/command.c
@@ -165,21 +165,16 @@ static int mp_property_playback_speed(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
- struct MPOpts *opts = mpctx->opts;
- double orig_speed = opts->playback_speed;
+ double speed = mpctx->opts->playback_speed;
switch (action) {
case M_PROPERTY_SET: {
- opts->playback_speed = *(double *) arg;
- if (opts->playback_speed == orig_speed)
- return M_PROPERTY_OK;
- // Adjust time until next frame flip for nosound mode
- mpctx->time_frame *= orig_speed / opts->playback_speed;
- if (mpctx->d_audio)
- reinit_audio_chain(mpctx);
+ double new_speed = *(double *)arg;
+ if (speed != new_speed)
+ set_playback_speed(mpctx, new_speed);
return M_PROPERTY_OK;
}
case M_PROPERTY_PRINT:
- *(char **)arg = talloc_asprintf(NULL, "%.2f", orig_speed);
+ *(char **)arg = talloc_asprintf(NULL, "%.2f", speed);
return M_PROPERTY_OK;
}
return mp_property_generic_option(mpctx, prop, action, arg);