1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-11 04:01:31 +00:00

player: cosmetically restructure a small function

No actual functional changes. Just preparation for the next commit, to
reduce its diff.
This commit is contained in:
wm4 2019-12-14 14:15:57 +01:00
parent ad2cda343b
commit 23c5965d47

View File

@ -464,16 +464,20 @@ void queue_seek(struct MPContext *mpctx, enum seek_type type, double amount,
void execute_queued_seek(struct MPContext *mpctx) void execute_queued_seek(struct MPContext *mpctx)
{ {
if (mpctx->seek.type) { if (mpctx->seek.type) {
bool queued_hr_seek = mpctx->seek.exact != MPSEEK_KEYFRAME;
// Let explicitly imprecise seeks cancel precise seeks: // 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; mpctx->start_timestamp = -1e9;
/* If the user seeks continuously (keeps arrow key down) // If the user seeks continuously (keeps arrow key down) try to finish
* try to finish showing a frame from one location before doing // showing a frame from one location before doing another seek (instead
* another seek (which could lead to unchanging display). */ // of never updating the screen).
bool delay = mpctx->seek.flags & MPSEEK_FLAG_DELAY; if ((mpctx->seek.flags & MPSEEK_FLAG_DELAY) &&
if (delay && mpctx->video_status < STATUS_PLAYING &&
mp_time_sec() - mpctx->start_timestamp < 0.3) 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); mp_seek(mpctx, mpctx->seek);
mpctx->seek = (struct seek_params){0}; mpctx->seek = (struct seek_params){0};
} }