summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-10 19:33:11 +0100
committerwm4 <wm4@nowhere>2013-12-10 20:07:39 +0100
commit227d087db601a02d4d71ea914f61e4d69fd34e6c (patch)
treeccedfff3c3123b7764a6c24a9e8b124bcf0dc403 /video
parent5135e93d0cec05047aeced889bbf740a7d091012 (diff)
downloadmpv-227d087db601a02d4d71ea914f61e4d69fd34e6c.tar.bz2
mpv-227d087db601a02d4d71ea914f61e4d69fd34e6c.tar.xz
video: display last frame, drain frames on video reconfig
Until now, the player didn't care to drain frames on video reconfig. Instead, the VO was reconfigured (i.e. resized) before the queued frames finished displaying. This can for example be observed by passing multiple images with different size as mf:// filename. Then the window would resize one frame before image with the new size is displayed. With --vo=vdpau, the effect is worse, because this VO queues more than 1 frame internally. Fix this by explicitly draining buffered frames before video reconfig. Raise the display time of the last frame. Otherwise, the last frame would be shown for a very short time only. This usually doesn't matter, but helps when playing image files. This is a byproduct of frame draining, because normally, video timing is based on the frames queued to the VO, and we can't do that with frames of different size or format. So we pretend that the frame before the change is the last frame in order to time it. This code is incorrect though: it tries to use the framerate, which often doesn't make sense. But it's good enough to test this code with mf://.
Diffstat (limited to 'video')
-rw-r--r--video/decode/dec_video.c2
-rw-r--r--video/decode/dec_video.h3
2 files changed, 5 insertions, 0 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 02e52368de..db9c318847 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -61,6 +61,7 @@ void video_reset_decoding(struct dec_video *d_video)
video_vd_control(d_video, VDCTRL_RESET, NULL);
if (d_video->vfilter && d_video->vfilter->initialized == 1)
vf_seek_reset(d_video->vfilter);
+ mp_image_unrefp(&d_video->waiting_decoded_mpi);
d_video->num_buffered_pts = 0;
d_video->last_pts = MP_NOPTS_VALUE;
d_video->last_packet_pdts = MP_NOPTS_VALUE;
@@ -116,6 +117,7 @@ int video_get_colors(struct dec_video *d_video, const char *item, int *value)
void video_uninit(struct dec_video *d_video)
{
+ mp_image_unrefp(&d_video->waiting_decoded_mpi);
if (d_video->vd_driver) {
mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Uninit video.\n");
d_video->vd_driver->uninit(d_video);
diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h
index c15f0d9aba..c0a8fcffe1 100644
--- a/video/decode/dec_video.h
+++ b/video/decode/dec_video.h
@@ -41,6 +41,9 @@ struct dec_video {
struct mp_image_params decoder_output; // last output of the decoder
struct mp_image_params vf_input; // video filter input params
+ // Used temporarily during format changes
+ struct mp_image *waiting_decoded_mpi;
+
void *priv; // for free use by vd_driver
// Last PTS from decoder (set with each vd_driver->decode() call)