summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-12 23:17:35 +0200
committerwm4 <wm4@nowhere>2014-08-12 23:24:08 +0200
commit5ed7bc6321119365dc1a5d330774e32ac6b6a54e (patch)
tree941486fbb0c2e21fc093e55b7cbc8dfe08a370c6 /player/core.h
parentdf58e822377af0a3802bba862de80eafaea732cb (diff)
downloadmpv-5ed7bc6321119365dc1a5d330774e32ac6b6a54e.tar.bz2
mpv-5ed7bc6321119365dc1a5d330774e32ac6b6a54e.tar.xz
video: fix and simplify video format changes and last frame display
The previous commit broke these things, and fixing them is separate in this commit in order to reduce the volume of changes. Move the image queue from the VO to the playback core. The image queue is a remnant of the old way how vdpau was implemented, and increasingly became more and more an artifact. In the end, it did only one thing: computing the duration of the current frame. This was done by taking the PTS difference between the current and the future frame. We keep this, but by moving it out of the VO, we don't have to special-case format changes anymore. This simplifies the code a lot. Since we need the queue to compute the duration only, a queue size larger than 2 makes no sense, and we can hardcode that. Also change how the last frame is handled. The last frame is a bit of a problem, because video timing works by showing one frame after another, which makes it a special case. Make the VO provide a function to notify us when the frame is done, instead. The frame duration is used for that. This is not perfect. For example, changing playback speed during the last frame doesn't update the end time. Pausing will not stop the clock that times the last frame. But I don't think this matters for such a corner case.
Diffstat (limited to 'player/core.h')
-rw-r--r--player/core.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/core.h b/player/core.h
index 1a396cf25f..4ee2916bbb 100644
--- a/player/core.h
+++ b/player/core.h
@@ -240,6 +240,9 @@ typedef struct MPContext {
struct mp_audio_buffer *ao_buffer; // queued audio; passed to ao_play() later
struct vo *video_out;
+ // next_frame[0] is the next frame, next_frame[1] the one after that.
+ // Invariant: if next_frame[1] is set, next_frame[0] also is.
+ struct mp_image *next_frame[2];
enum playback_status video_status, audio_status;
bool restart_complete;
@@ -257,8 +260,6 @@ typedef struct MPContext {
double delay;
// AV sync: time until next frame should be shown
double time_frame;
- // Display duration (as "intended") of the last flipped frame.
- double last_frame_duration;
// Set to true some time after a new frame has been shown, and it turns out
// that this frame was the last one before video ends.
bool playing_last_frame;