From a09e5dd89110dd96a7342ff0c80c9ede0dadc3a9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 23 Mar 2015 18:15:40 +0100 Subject: vo_vdpau: remove some minor code duplication The way-too-big API call for clearing the screen can be easily shared between two completely different codepaths. --- video/out/vo_vdpau.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'video') diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 93b5cee5d3..3f5776ad36 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -163,19 +163,10 @@ static int render_video_to_output_surface(struct vo *vo, CHECK_VDP_WARNING(vo, "Error when calling " "vdp_presentation_queue_block_until_surface_idle"); - if (!mpi) { - // 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; - } - - if (vc->rgb_mode) { - // Clear the borders between video and window (if there are any). - // For some reason, video_mixer_render doesn't need it for YUV. + // Clear the borders between video and window (if there are any). + // For some reason, video_mixer_render doesn't need it for YUV. + // Also, if there is nothing to render, at least clear the screen. + if (vc->rgb_mode || !mpi) { int flags = VDP_OUTPUT_SURFACE_RENDER_ROTATE_0; vdp_st = vdp->output_surface_render_output_surface(output_surface, NULL, vc->black_pixel, @@ -184,6 +175,9 @@ static int render_video_to_output_surface(struct vo *vo, CHECK_VDP_WARNING(vo, "Error clearing screen"); } + if (!mpi) + return -1; + struct mp_vdpau_mixer_frame *frame = mp_vdpau_mixed_frame_get(mpi); struct mp_vdpau_mixer_opts opts = {0}; if (frame) -- cgit v1.2.3