summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-07 02:47:09 +0100
committerwm4 <wm4@nowhere>2014-12-07 02:47:54 +0100
commit090f6cfc30a55c044b45dbd66cd46d8a66ce4b44 (patch)
treee0556ad41324eaf1a48bb368a3369abc59eaaee2 /player/core.h
parent6adaddbe63196ba0c75796ce157d2e041c390b71 (diff)
downloadmpv-090f6cfc30a55c044b45dbd66cd46d8a66ce4b44.tar.bz2
mpv-090f6cfc30a55c044b45dbd66cd46d8a66ce4b44.tar.xz
player: when seeking past EOF with --keep-open, seek to last frame
It feels strange that seeking past EOF with --keep-open actually leaves the player at a random position. You can't even unpause, because the demuxer is in the EOF state, and what you see on screen is just what was around before the seek. Improve this by attempting to seek to the last video frame if EOF happens. We explicitly don't do this if EOF was reached normally to increase robustness (if the VO got a frame since the last seek, it obviously means we had normal playback before EOF). If an error happens when trying to find the last frame (such as not actually finding a last frame because e.g. the demuxer misbehaves), this will probably turn your CPU into a heater. There is no logic to prevent reinitiating the last-frame search if the last-frame search reached EOF. (Pausing usually prevents that EOF is reached again after a successful last-frame search.) Fixes #819.
Diffstat (limited to 'player/core.h')
-rw-r--r--player/core.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/player/core.h b/player/core.h
index d3fc4195e2..1147d0e8f5 100644
--- a/player/core.h
+++ b/player/core.h
@@ -224,14 +224,16 @@ 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_frame[2];
+ struct mp_image *saved_frame; // for hrseek_lastframe
enum playback_status video_status, audio_status;
bool restart_complete;
/* Set if audio should be timed to start with video frame after seeking,
* not set when e.g. playing cover art */
bool sync_audio_to_video;
- bool hrseek_active;
- bool hrseek_framedrop;
+ 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
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