diff options
author | wm4 <wm4@nowhere> | 2019-12-14 14:15:57 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-14 14:15:57 +0100 |
commit | 23c5965d47d7ceac234d25100263d4e3d0efc133 (patch) | |
tree | 77d8c60334446b8f5225d59554a3120c2b5cdeaf | |
parent | ad2cda343b1d6001f430867e0c3f502ff27c8675 (diff) | |
download | mpv-23c5965d47d7ceac234d25100263d4e3d0efc133.tar.bz2 mpv-23c5965d47d7ceac234d25100263d4e3d0efc133.tar.xz |
player: cosmetically restructure a small function
No actual functional changes. Just preparation for the next commit, to
reduce its diff.
-rw-r--r-- | player/playloop.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/player/playloop.c b/player/playloop.c index 3a7b2d193c..a8d784ae93 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -464,16 +464,20 @@ void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount, void execute_queued_seek(struct MPContext *mpctx) { if (mpctx->seek.type) { + bool queued_hr_seek = mpctx->seek.exact != MPSEEK_KEYFRAME; // Let explicitly imprecise seeks cancel precise seeks: - if (mpctx->hrseek_active && mpctx->seek.exact == MPSEEK_KEYFRAME) + if (mpctx->hrseek_active && !queued_hr_seek) mpctx->start_timestamp = -1e9; - /* If the user seeks continuously (keeps arrow key down) - * try to finish showing a frame from one location before doing - * another seek (which could lead to unchanging display). */ - bool delay = mpctx->seek.flags & MPSEEK_FLAG_DELAY; - if (delay && mpctx->video_status < STATUS_PLAYING && + // If the user seeks continuously (keeps arrow key down) try to finish + // showing a frame from one location before doing another seek (instead + // of never updating the screen). + if ((mpctx->seek.flags & MPSEEK_FLAG_DELAY) && mp_time_sec() - mpctx->start_timestamp < 0.3) - return; + { + // Wait until a video frame is available and has been shown. + if (mpctx->video_status < STATUS_PLAYING) + return; + } mp_seek(mpctx, mpctx->seek); mpctx->seek = (struct seek_params){0}; } |