summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-14 14:02:13 +0200
committerwm4 <wm4@nowhere>2017-08-14 14:02:13 +0200
commit68201f4591bd07c7d7027d50fdb6cc5500c7382c (patch)
treefeb6fe9402487d6ce8a11656eda548e21c29b7b9 /player/core.h
parentb6d79deebbbb9aa95b176ad099abd5695d0a2366 (diff)
downloadmpv-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/core.h')
-rw-r--r--player/core.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/player/core.h b/player/core.h
index d341aeb529..bdb8b4c3a5 100644
--- a/player/core.h
+++ b/player/core.h
@@ -73,8 +73,8 @@ enum seek_type {
};
enum seek_precision {
- MPSEEK_DEFAULT = 0,
// The following values are numerically sorted by increasing precision
+ MPSEEK_DEFAULT = 0,
MPSEEK_KEYFRAME,
MPSEEK_EXACT,
MPSEEK_VERY_EXACT,
@@ -85,6 +85,13 @@ enum seek_flags {
MPSEEK_FLAG_NOFLUSH = 1 << 1, // keeping remaining data for seamless loops
};
+struct seek_params {
+ enum seek_type type;
+ enum seek_precision exact;
+ double amount;
+ unsigned flags; // MPSEEK_FLAG_*
+};
+
enum video_sync {
VS_DEFAULT = 0,
VS_DISP_RESAMPLE,
@@ -339,6 +346,7 @@ typedef struct MPContext {
bool hrseek_lastframe; // drop everything until last frame reached
bool hrseek_backstep; // go to frame before seek target
double hrseek_pts;
+ struct seek_params current_seek;
bool ab_loop_clip; // clip to the "b" part of an A-B loop if available
// AV sync: the next frame should be shown when the audio out has this
// much (in seconds) buffered data left. Increased when more data is
@@ -367,8 +375,6 @@ typedef struct MPContext {
double last_frame_duration;
// Video PTS, or audio PTS if video has ended.
double playback_pts;
- // Last known "good" PTS
- double canonical_pts;
// audio stats only
int64_t audio_stat_start;
double written_audio;
@@ -398,13 +404,7 @@ typedef struct MPContext {
// Used to turn a new time value to a delta from last time.
int64_t last_time;
- // Used to communicate the parameters of a seek between parts
- struct seek_params {
- enum seek_type type;
- enum seek_precision exact;
- double amount;
- unsigned flags; // MPSEEK_FLAG_*
- } seek;
+ struct seek_params seek;
// Allow audio to issue a second seek if audio is too far ahead (for non-hr
// seeks with external audio tracks).
@@ -532,6 +532,7 @@ struct MPContext *mp_create(void);
void mp_destroy(struct MPContext *mpctx);
void mp_print_version(struct mp_log *log, int always);
void mp_update_logging(struct MPContext *mpctx, bool preinit);
+void issue_refresh_seek(struct MPContext *mpctx, enum seek_precision min_prec);
// misc.c
double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t);