diff options
author | wm4 <wm4@nowhere> | 2017-08-14 14:02:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-08-14 14:02:13 +0200 |
commit | 68201f4591bd07c7d7027d50fdb6cc5500c7382c (patch) | |
tree | feb6fe9402487d6ce8a11656eda548e21c29b7b9 /player/misc.c | |
parent | b6d79deebbbb9aa95b176ad099abd5695d0a2366 (diff) | |
download | mpv-68201f4591bd07c7d7027d50fdb6cc5500c7382c.tar.bz2 mpv-68201f4591bd07c7d7027d50fdb6cc5500c7382c.tar.xz |
player: make refresh seeks slightly more robust
Refresh seeks are automatically issued when changing filters, which
improves user experience if these filters change buffering or such.
The refresh seek could actually overwrite a previously ongoing seek:
set pause yes
set time-pos 10
set vf ""
Here, the video code issued a refresh seek to the previous video
position, which could be different from the previously triggered (and
still ongoing) seek, this overwriting the seek.
Factor all refresh seek handling into a new function, and make it handle
ongoing seeks correctly.
Remove the weird new canonical_pts field, which actually had no use.
Fixes #4757.
Diffstat (limited to 'player/misc.c')
-rw-r--r-- | player/misc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/player/misc.c b/player/misc.c index 6762f8a518..87e6521b14 100644 --- a/player/misc.c +++ b/player/misc.c @@ -111,6 +111,25 @@ double get_track_seek_offset(struct MPContext *mpctx, struct track *track) return 0; } +void issue_refresh_seek(struct MPContext *mpctx, enum seek_precision min_prec) +{ + // let queued seeks execute at a slightly later point + if (mpctx->seek.type) { + mp_wakeup_core(mpctx); + return; + } + // repeat currently ongoing seeks + if (mpctx->current_seek.type) { + mpctx->seek = mpctx->current_seek; + mp_wakeup_core(mpctx); + return; + } + // maybe happens when changing filters while file is loaded - ignore for now + if (mpctx->playback_pts == MP_NOPTS_VALUE) + return; + queue_seek(mpctx, MPSEEK_ABSOLUTE, mpctx->playback_pts, min_prec, 0); +} + float mp_get_cache_percent(struct MPContext *mpctx) { struct stream_cache_info info = {0}; |