diff options
author | wm4 <wm4@nowhere> | 2014-10-02 02:49:05 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-02 02:49:05 +0200 |
commit | c3e2a1febc1610517c7de2a5f57632b83cefa3e8 (patch) | |
tree | e640e6549a0255f7342f42235be49e3f38aa02db /player/audio.c | |
parent | 7dd3822d099522cd8bf59aa1eb3e318e2cfcacdd (diff) | |
download | mpv-c3e2a1febc1610517c7de2a5f57632b83cefa3e8.tar.bz2 mpv-c3e2a1febc1610517c7de2a5f57632b83cefa3e8.tar.xz |
command: move setting playback speed to a separate function
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/player/audio.c b/player/audio.c index 85dda4722c..f532f1167b 100644 --- a/player/audio.c +++ b/player/audio.c @@ -88,6 +88,19 @@ int reinit_audio_filters(struct MPContext *mpctx) return 1; } +void set_playback_speed(struct MPContext *mpctx, double new_speed) +{ + struct MPOpts *opts = mpctx->opts; + + // Adjust time until next frame flip for nosound mode + mpctx->time_frame *= opts->playback_speed / new_speed; + + opts->playback_speed = new_speed; + + if (mpctx->d_audio) + recreate_audio_filters(mpctx); +} + void reset_audio_state(struct MPContext *mpctx) { if (mpctx->d_audio) |