From ed9295c250ddfb845e48f123343e7b02326e8920 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 1 Oct 2013 23:35:51 +0200 Subject: video/out: always support redrawing VO window at any point Before, a VO could easily refuse to respond to VOCTRL_REDRAW_FRAME, which means the VO wouldn't redraw OSD and window contents, and the player would appear frozen to the user. This was a bit stupid, and makes dealing with some corner cases much harder (think of --keep-open, which was hard to implement, because the VO gets into this state if there are no new video frames after a seek reset). Change this, and require VOs to always react to VOCTRL_REDRAW_FRAME. There are two aspects of this: First, behavior after a (successful) vo_reconfig() call, but before any video frame has been displayed. Second, behavior after a vo_seek_reset(). For the first issue, we define that sending VOCTRL_REDRAW_FRAME after vo_reconfig() should clear the window with black. This requires minor changes to some VOs. In particular vaapi makes this horribly complicated, because OSD rendering is bound to a video surface. We create a black dummy surface for this purpose. The second issue is much simpler and works already with most VOs: they simply redraw whatever has been uploaded previously. The exception is vdpau, which has a complicated mechanism to track and filter video frames. The state associated with this mechanism is completely cleared with vo_seek_reset(), so implementing this to work as expected is not trivial. For now, we just clear the window with black. --- video/out/vo_vdpau.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'video/out/vo_vdpau.c') diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 5045ecce1f..581daf2659 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -222,8 +222,15 @@ static int render_video_to_output_surface(struct vo *vo, struct vdp_functions *vdp = vc->vdp; VdpTime dummy; VdpStatus vdp_st; - if (vc->deint_queue_pos < 0) + if (vc->deint_queue_pos < 0) { + // At least clear the screen if there is nothing to render + int flags = VDP_OUTPUT_SURFACE_RENDER_ROTATE_0; + vdp_st = vdp->output_surface_render_output_surface(output_surface, + NULL, vc->black_pixel, + NULL, NULL, NULL, + flags); return -1; + } struct buffered_video_surface *bv = vc->buffered_video; unsigned int dp = vc->deint_queue_pos; -- cgit v1.2.3