From 83889cebbc78e4a9087d95633ded1d65d5690c24 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 26 Oct 2011 15:19:58 +0200 Subject: vo_direct3d: don't framestep when paused and OSD is updated The required feature for this, VOCTRL_REDRAW_OSD, was unimplemented for unknown reasons. It is trivial to add. There is still a weird issue when switching the fullscreen state while paused. I have no idea why this happens. The contents of the video should survive the window reconfiguration (at least we don't free it), and we explicitly redraw the screen after fullscreen. --- libvo/vo_direct3d.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index 4955c91afe..218dd761df 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -590,11 +590,13 @@ static void uninit_d3d(void) priv->d3d_handle = NULL; } +static uint32_t d3d_draw_frame(void); + /** @brief Render a frame on the screen. * @param mpi mpi structure with the decoded frame inside * @return VO_TRUE on success, VO_ERROR on failure */ -static uint32_t render_d3d_frame(mp_image_t *mpi) +static uint32_t d3d_upload_and_render_frame(mp_image_t *mpi) { /* Uncomment when direct rendering is implemented. * if (mpi->flags & MP_IMGFLAG_DIRECT) ... @@ -626,13 +628,18 @@ static uint32_t render_d3d_frame(mp_image_t *mpi) mpi->height, priv->locked_rect.Pitch, mpi->stride[0]); skip_upload: - /* This unlock is used for both slice_draw path and render_d3d_frame path. */ + /* This unlock is used for both slice_draw path and DRAW_IMAGE path. */ if (FAILED(IDirect3DSurface9_UnlockRect(priv->d3d_surface))) { mp_msg(MSGT_VO, MSGL_V, "Surface unlock failed.\n"); return VO_ERROR; } priv->locked_rect.pBits = NULL; + return d3d_draw_frame(); +} + +static uint32_t d3d_draw_frame(void) +{ if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) { mp_msg(MSGT_VO, MSGL_ERR, "BeginScene failed.\n"); return VO_ERROR; @@ -816,7 +823,14 @@ err_out: return -1; } - +static void full_redraw(void) +{ + priv->is_clear_needed = 1; + d3d_draw_frame(); + draw_osd(); + draw_eosd(); + flip_page(); +} /** @brief libvo Callback: Handle control requests. * @return VO_TRUE on success, VO_NOTIMPL when not implemented @@ -831,10 +845,11 @@ static int control(uint32_t request, void *data) "Direct Rendering request. Not implemented yet.\n"); return VO_NOTIMPL; case VOCTRL_DRAW_IMAGE: - return render_d3d_frame(data); + return d3d_upload_and_render_frame(data); case VOCTRL_FULLSCREEN: vo_w32_fullscreen(); resize_d3d(); + full_redraw(); return VO_TRUE; case VOCTRL_RESET: return VO_NOTIMPL; @@ -844,6 +859,10 @@ static int control(uint32_t request, void *data) case VOCTRL_RESUME: priv->is_paused = 0; return VO_TRUE; + case VOCTRL_REDRAW_FRAME: + priv->is_clear_needed = 1; + d3d_draw_frame(); + return VO_TRUE; case VOCTRL_SET_EQUALIZER: return VO_NOTIMPL; case VOCTRL_GET_EQUALIZER: -- cgit v1.2.3