summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-12 23:49:00 +0100
committerwm4 <wm4@nowhere>2016-01-12 23:49:00 +0100
commite420464ba693a5920d4dc172b3f7e9a0c725e3d4 (patch)
treee149445377e94da3274f7d3f588449ed24ece3c1 /player/core.h
parent6fc0fe4426c1b71630d281cbc9e0406f8ad7deee (diff)
downloadmpv-e420464ba693a5920d4dc172b3f7e9a0c725e3d4.tar.bz2
mpv-e420464ba693a5920d4dc172b3f7e9a0c725e3d4.tar.xz
player: simplify backstepping
Basically reimplement it. The old implementation was quite stupid, and was probably done this way because video filtering and output used to be way less decoupled. Now we can reimplement it in a very simple way: when backstepping, seek to current time, but keep the last frame that was supposed to be discarded when reaching the target time. When the seek finishes, prepend the saved frame to the video frame queue. A disadvantage is that the new implementation fails to skip over timeline boundaries (ordered chapters etc.), but this never worked properly anyway. It's possible that this will be fixed some time in the future.
Diffstat (limited to 'player/core.h')
-rw-r--r--player/core.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/player/core.h b/player/core.h
index 7098b3bd46..5c5466a3ae 100644
--- a/player/core.h
+++ b/player/core.h
@@ -66,6 +66,7 @@ enum seek_type {
MPSEEK_RELATIVE,
MPSEEK_ABSOLUTE,
MPSEEK_FACTOR,
+ MPSEEK_BACKSTEP,
};
enum seek_precision {
@@ -259,9 +260,10 @@ typedef struct MPContext {
struct vo *video_out;
// next_frame[0] is the next frame, next_frame[1] the one after that.
- struct mp_image *next_frames[VO_MAX_REQ_FRAMES];
+ // The +1 is for adding 1 additional frame in backstep mode.
+ struct mp_image *next_frames[VO_MAX_REQ_FRAMES + 1];
int num_next_frames;
- struct mp_image *saved_frame; // for hrseek_lastframe
+ struct mp_image *saved_frame; // for hrseek_lastframe and hrseek_backstep
enum playback_status video_status, audio_status;
bool restart_complete;
@@ -285,6 +287,7 @@ typedef struct MPContext {
bool hrseek_active; // skip all data until hrseek_pts
bool hrseek_framedrop; // allow decoder to drop frames before hrseek_pts
bool hrseek_lastframe; // drop everything until last frame reached
+ bool hrseek_backstep; // go to frame before seek target
double hrseek_pts;
// 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
@@ -320,15 +323,7 @@ typedef struct MPContext {
int last_chapter;
- // History of video frames timestamps that were queued in the VO
- // This includes even skipped frames during hr-seek
- double vo_pts_history_pts[MAX_NUM_VO_PTS];
- // Whether the PTS at vo_pts_history[n] is after a seek reset
- uint64_t vo_pts_history_seek[MAX_NUM_VO_PTS];
- uint64_t vo_pts_history_seek_ts;
- uint64_t backstep_start_seek_ts;
- bool backstep_active;
- // Past timestamps etc. (stupidly duplicated with vo_pts_history).
+ // Past timestamps etc.
// The newest frame is at index 0.
struct frame_info *past_frames;
int num_past_frames;