diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-12-06 02:46:37 +0200 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-12-06 07:47:46 +0200 |
commit | 7ac154065f3acbb38afba7fc0eccd3adf8208ced (patch) | |
tree | d535bccb123ef17b0210ecbb7ada876ade1301b1 /command.c | |
parent | 253f62c564443b93604f4bac610c6e7dc7f58824 (diff) | |
download | mpv-7ac154065f3acbb38afba7fc0eccd3adf8208ced.tar.bz2 mpv-7ac154065f3acbb38afba7fc0eccd3adf8208ced.tar.xz |
commands: playback speed: better responsiveness without audio
Adjust the scheduled time until next frame when changing playback
speed (only affects behavior without audio). The main case where this
makes a difference is when it would take a noticeably long time to
switch frames with the previous speed and you switch to a faster
speed.
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -287,19 +287,21 @@ static int mp_property_playback_speed(m_option_t *prop, int action, void *arg, MPContext *mpctx) { struct MPOpts *opts = &mpctx->opts; + double orig_speed = opts->playback_speed; switch (action) { case M_PROPERTY_SET: if (!arg) return M_PROPERTY_ERROR; - M_PROPERTY_CLAMP(prop, *(float *) arg); opts->playback_speed = *(float *) arg; - reinit_audio_chain(mpctx); - return M_PROPERTY_OK; + goto set; case M_PROPERTY_STEP_UP: case M_PROPERTY_STEP_DOWN: opts->playback_speed += (arg ? *(float *) arg : 0.1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); + set: M_PROPERTY_CLAMP(prop, opts->playback_speed); + // Adjust time until next frame flip for nosound mode + mpctx->time_frame *= orig_speed / opts->playback_speed; reinit_audio_chain(mpctx); return M_PROPERTY_OK; } |