[vlc-commits] vout:win32: isolate the window placement fields in a structure

Steve Lhomme git at videolan.org
Mon Apr 1 16:56:01 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Mar 21 16:21:27 2019 +0100| [6c995ea924f11af87afd202cff5079b0103ae232] | committer: Steve Lhomme

vout:win32: isolate the window placement fields in a structure

These fields are needed even when there's no window to handle. For example if
the display dimensions/position are used for external rendering.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c995ea924f11af87afd202cff5079b0103ae232
---

 modules/video_output/win32/common.c     | 62 ++++++++++++++++-----------------
 modules/video_output/win32/common.h     | 30 ++++++++--------
 modules/video_output/win32/direct3d11.c | 49 +++++++++++++-------------
 modules/video_output/win32/direct3d9.c  | 29 +++++++--------
 modules/video_output/win32/glwin32.c    | 11 +++---
 modules/video_output/win32/wingdi.c     | 17 ++++-----
 6 files changed, 102 insertions(+), 96 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 34e59d9de9..d951fafd00 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -74,35 +74,35 @@ static bool GetExternalDimensions(void *opaque, UINT *width, UINT *height)
 }
 
 /* */
-int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowless, const vout_display_cfg_t *vdcfg)
+int CommonInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys,
+               bool b_windowless, const vout_display_cfg_t *vdcfg)
 {
+    area->place_changed = false;
+    area->pf_GetDisplayDimensions = GetExternalDimensions;
+    area->opaque_dimensions = vd;
+    area->vdcfg = *vdcfg;
+
     sys->hwnd      = NULL;
     sys->hvideownd = NULL;
     sys->hparent   = NULL;
     sys->hfswnd    = NULL;
-    sys->place_changed = false;
     sys->b_windowless = b_windowless;
     sys->is_first_placement = true;
     sys->is_on_top        = false;
 
-    sys->pf_GetDisplayDimensions = GetExternalDimensions;
-    sys->opaque_dimensions = vd;
-
 #if !VLC_WINSTORE_APP
 #if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
     sys->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
 #endif
     if (!b_windowless)
     {
-        sys->pf_GetDisplayDimensions = GetWindowDimensions;
-        sys->opaque_dimensions = sys;
+        area->pf_GetDisplayDimensions = GetWindowDimensions;
+        area->opaque_dimensions = sys;
     }
     SetRectEmpty(&sys->rect_parent);
 
     var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
 
-    sys->vdcfg = *vdcfg;
-
     if (b_windowless)
         return VLC_SUCCESS;
 
@@ -145,17 +145,17 @@ int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowl
 * its job is to update the source and destination RECTs used to display the
 * picture.
 *****************************************************************************/
-void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys)
+void UpdateRects(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys)
 {
     const video_format_t *source = &vd->source;
 
     UINT  display_width, display_height;
 
     /* */
-    const vout_display_cfg_t *cfg = &sys->vdcfg;
+    const vout_display_cfg_t *cfg = &area->vdcfg;
 
     /* Retrieve the window size */
-    if (!sys->pf_GetDisplayDimensions(sys->opaque_dimensions, &display_width, &display_height))
+    if (!area->pf_GetDisplayDimensions(area->opaque_dimensions, &display_width, &display_height))
     {
         msg_Err(vd, "could not get the window dimensions");
         return;
@@ -174,13 +174,13 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys)
         place_cfg.align.vertical = VLC_VIDEO_ALIGN_TOP;
 #endif
 
-    vout_display_place_t before_place = sys->place;
-    vout_display_PlacePicture(&sys->place, source, &place_cfg);
+    vout_display_place_t before_place = area->place;
+    vout_display_PlacePicture(&area->place, source, &place_cfg);
 
     /* Signal the change in size/position */
-    if (!vout_display_PlaceEquals(&before_place, &sys->place))
+    if (!vout_display_PlaceEquals(&before_place, &area->place))
     {
-        sys->place_changed |= true;
+        area->place_changed |= true;
 
 #ifndef NDEBUG
         msg_Dbg(vd, "DirectXUpdateRects source"
@@ -190,14 +190,14 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys)
             source->i_width, source->i_height);
         msg_Dbg(vd, "DirectXUpdateRects image_dst"
             " coords: %i,%i,%i,%i",
-            sys->place.x, sys->place.y,
-            sys->place.x + sys->place.width, sys->place.y + sys->place.height);
+            area->place.x, area->place.y,
+            area->place.x + area->place.width, area->place.y + area->place.height);
 #endif
 
 #if !VLC_WINSTORE_APP
         if (sys != NULL)
         {
-            EventThreadUpdatePlace(sys->event, &sys->place);
+            EventThreadUpdatePlace(sys->event, &area->place);
 
             if (sys->hvideownd)
             {
@@ -208,7 +208,7 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys)
                     sys->is_first_placement = false;
                 }
                 SetWindowPos(sys->hvideownd, 0,
-                    sys->place.x, sys->place.y, sys->place.width, sys->place.height,
+                    area->place.x, area->place.y, area->place.width, area->place.height,
                     swpFlags);
             }
 
@@ -229,13 +229,13 @@ void CommonClean(vlc_object_t *obj, vout_display_sys_win32_t *sys)
     }
 }
 
-void CommonManage(vout_display_t *vd, vout_display_sys_win32_t *sys)
+void CommonManage(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys)
 {
     if (sys->b_windowless)
         return;
 
     if (EventThreadGetAndResetSizeChanged(sys->event))
-        UpdateRects(vd, sys);
+        UpdateRects(vd, area, sys);
 }
 
 /* */
@@ -373,27 +373,27 @@ static int CommonControlSetFullscreen(vlc_object_t *obj, vout_display_sys_win32_
 }
 #endif /* !VLC_WINSTORE_APP */
 
-int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query, va_list args)
+int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query, va_list args)
 {
     switch (query) {
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
     case VOUT_DISPLAY_CHANGE_ZOOM:           /* const vout_display_cfg_t *p_cfg */
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
-        sys->vdcfg = *va_arg(args, const vout_display_cfg_t *);
-        UpdateRects(vd, sys);
+        area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+        UpdateRects(vd, area, sys);
         return VLC_SUCCESS;
     }
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:   /* const vout_display_cfg_t *p_cfg */
     {   /* Update dimensions */
-        sys->vdcfg = *va_arg(args, const vout_display_cfg_t *);
+        area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
 #if !VLC_WINSTORE_APP
-        if (!sys->vdcfg.is_fullscreen && !sys->b_windowless) {
+        if (!area->vdcfg.is_fullscreen && !sys->b_windowless) {
             RECT rect_window = {
                 .top    = 0,
                 .left   = 0,
-                .right  = sys->vdcfg.display.width,
-                .bottom = sys->vdcfg.display.height,
+                .right  = area->vdcfg.display.width,
+                .bottom = area->vdcfg.display.height,
             };
             AdjustWindowRect(&rect_window, EventThreadGetWindowStyle(sys->event), 0);
             SetWindowPos(sys->hwnd, 0, 0, 0,
@@ -401,7 +401,7 @@ int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query,
                          RECTHeight(rect_window), SWP_NOMOVE);
         }
 #endif /* !VLC_WINSTORE_APP */
-        UpdateRects(vd, sys);
+        UpdateRects(vd, area, sys);
         return VLC_SUCCESS;
     }
 #if !VLC_WINSTORE_APP
@@ -428,7 +428,7 @@ int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query,
         bool fs = va_arg(args, int);
         if (CommonControlSetFullscreen(VLC_OBJECT(vd), sys, fs))
             return VLC_EGENERIC;
-        UpdateRects(vd, sys);
+        UpdateRects(vd, area, sys);
         return VLC_SUCCESS;
     }
 #endif /* !VLC_WINSTORE_APP */
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index bf8de014cc..e3c85a27ea 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -27,6 +27,18 @@
  *****************************************************************************/
 #include "events.h"
 
+typedef struct display_win32_area_t
+{
+    /* Coordinates of dest images (used when blitting to display) */
+    vout_display_place_t  place;
+    bool                  place_changed;
+
+    vout_display_cfg_t    vdcfg;
+
+    bool (*pf_GetDisplayDimensions)(void *opaque, UINT *w, UINT *h);
+    void *opaque_dimensions;
+} display_win32_area_t;
+
 #define RECTWidth(r)   (LONG)((r).right - (r).left)
 #define RECTHeight(r)  (LONG)((r).bottom - (r).top)
 
@@ -57,35 +69,25 @@ typedef struct vout_display_sys_win32_t
     HINSTANCE     dxgidebug_dll;
 # endif
 
-    bool         place_changed;
-
     /* Misc */
     bool is_first_placement;
     bool is_on_top;
 
-    /* Coordinates of dest images (used when blitting to display) */
-    vout_display_place_t  place;
-
-    vout_display_cfg_t vdcfg;
-
     bool use_desktop;     /* show video on desktop window ? */
-
-    bool (*pf_GetDisplayDimensions)(void *opaque, UINT *w, UINT *h);
-    void *opaque_dimensions;
 } vout_display_sys_win32_t;
 
 
 /*****************************************************************************
  * Prototypes from common.c
  *****************************************************************************/
-int  CommonInit(vout_display_t *, vout_display_sys_win32_t *, bool b_windowless, const vout_display_cfg_t *);
+int  CommonInit(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, bool b_windowless, const vout_display_cfg_t *);
 #if !VLC_WINSTORE_APP
 void CommonClean(vlc_object_t *, vout_display_sys_win32_t *);
 #endif /* !VLC_WINSTORE_APP */
-void CommonManage(vout_display_t *, vout_display_sys_win32_t *);
-int  CommonControl(vout_display_t *, vout_display_sys_win32_t *, int , va_list );
+void CommonManage(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *);
+int  CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, int , va_list );
 
-void UpdateRects (vout_display_t *, vout_display_sys_win32_t *);
+void UpdateRects (vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *);
 
 /*****************************************************************************
  * Constants
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 216f055e2e..a3b8eec408 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -90,6 +90,7 @@ vlc_module_end ()
 struct vout_display_sys_t
 {
     vout_display_sys_win32_t sys;
+    display_win32_area_t     area;
 
     /* Sensors */
     void *p_sensors;
@@ -188,8 +189,8 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
     UINT i_width, i_height;
-    i_width  = sys->sys.place.width;
-    i_height = sys->sys.place.height;
+    i_width  = sys->area.place.width;
+    i_height = sys->area.place.height;
 
     if (!sys->resizeCb(sys->outside_opaque, i_width, i_height))
         return E_FAIL;
@@ -200,8 +201,8 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
 static void UpdateSize(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
-    msg_Dbg(vd, "Detected size change %dx%d", sys->sys.place.width,
-            sys->sys.place.height);
+    msg_Dbg(vd, "Detected size change %dx%d", sys->area.place.width,
+            sys->area.place.height);
 
     UpdateBackBuffer(vd);
 
@@ -285,15 +286,15 @@ static bool StartRendering(void *opaque)
 
 #if VLC_WINSTORE_APP
     /* TODO read the swapchain size and call VOUT_DISPLAY_CHANGE_DISPLAY_SIZE */
-    UpdateRects(vd, sys);
+    UpdateRects(vd, &sys->area, &sys->sys);
 #else /* !VLC_WINSTORE_APP */
-    CommonManage(vd, &sys->sys);
+    CommonManage(vd, &sys->area, &sys->sys);
 #endif
 
-    if ( sys->sys.place_changed )
+    if ( sys->area.place_changed )
     {
         UpdateSize(vd);
-        sys->sys.place_changed =false;
+        sys->area.place_changed =false;
     }
 
     D3D11_ClearRenderTargets( &sys->d3d_dev, sys->display.pixelFormat, sys->swapchainTargetView );
@@ -478,7 +479,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         goto error;
     }
 #endif
-    if (CommonInit(vd, &sys->sys, d3d11_ctx != NULL, cfg))
+    if (CommonInit(vd, &sys->area, &sys->sys, d3d11_ctx != NULL, cfg))
         goto error;
 
 #if VLC_WINSTORE_APP
@@ -721,7 +722,7 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
          f_fovx < -0.001f )
         return;
 
-    float f_sar = (float) sys->sys.vdcfg.display.width / sys->sys.vdcfg.display.height;
+    float f_sar = (float) sys->area.vdcfg.display.width / sys->area.vdcfg.display.height;
     float f_fovy = UpdateFOVy(f_fovx, f_sar);
     float f_z = UpdateZ(f_fovx, f_fovy);
 
@@ -743,7 +744,7 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
 static int Control(vout_display_t *vd, int query, va_list args)
 {
     vout_display_sys_t *sys = vd->sys;
-    int res = CommonControl( vd, &sys->sys, query, args );
+    int res = CommonControl( vd, &sys->area, &sys->sys, query, args );
 
     if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
     {
@@ -755,10 +756,10 @@ static int Control(vout_display_t *vd, int query, va_list args)
         }
     }
 
-    if ( sys->sys.place_changed )
+    if ( sys->area.place_changed )
     {
         UpdateSize(vd);
-        sys->sys.place_changed =false;
+        sys->area.place_changed =false;
     }
 
     return res;
@@ -846,7 +847,7 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
                 sys->picQuad.i_height = texDesc.Height;
                 sys->picQuad.i_width = texDesc.Width;
 
-                UpdateRects(vd, &sys->sys);
+                UpdateRects(vd, &sys->area, &sys->sys);
                 UpdateSize(vd);
             }
         }
@@ -1364,14 +1365,14 @@ static void UpdatePicQuadPosition(vout_display_t *vd)
 
     RECT rect_dst = {
         .left   = 0,
-        .right  = sys->sys.place.width,
+        .right  = sys->area.place.width,
         .top    = 0,
-        .bottom = sys->sys.place.height
+        .bottom = sys->area.place.height
     };
 
     D3D11_UpdateViewport( &sys->picQuad, &rect_dst, sys->display.pixelFormat );
 
-    SetQuadVSProjection(vd, &sys->picQuad, &sys->sys.vdcfg.viewpoint);
+    SetQuadVSProjection(vd, &sys->picQuad, &sys->area.vdcfg.viewpoint);
 
 #ifndef NDEBUG
     msg_Dbg( vd, "picQuad position (%.02f,%.02f) %.02fx%.02f",
@@ -1462,7 +1463,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
         sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
     }
 
-    UpdateRects(vd, &sys->sys);
+    UpdateRects(vd, &sys->area, &sys->sys);
 
     video_format_t surface_fmt = *fmt;
     surface_fmt.i_width  = sys->picQuad.i_width;
@@ -1489,7 +1490,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
 
     if ( vd->source.projection_mode == PROJECTION_MODE_EQUIRECTANGULAR ||
          vd->source.projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD )
-        SetQuadVSProjection( vd, &sys->picQuad, &sys->sys.vdcfg.viewpoint );
+        SetQuadVSProjection( vd, &sys->picQuad, &sys->area.vdcfg.viewpoint );
 
     if (is_d3d11_opaque(fmt->i_chroma)) {
         ID3D10Multithread *pMultithread;
@@ -1572,7 +1573,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
         ID3D11DepthStencilState_Release(pDepthStencilState);
     }
 
-    UpdateRects(vd, &sys->sys);
+    UpdateRects(vd, &sys->area, &sys->sys);
 
     hr = UpdateBackBuffer(vd);
     if (FAILED(hr)) {
@@ -1811,10 +1812,10 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
         d3d_quad_t *quad = (d3d_quad_t *) quad_picture->p_sys;
 
         RECT spuViewport;
-        spuViewport.left   = (FLOAT) r->i_x * sys->sys.place.width  / subpicture->i_original_picture_width;
-        spuViewport.top    = (FLOAT) r->i_y * sys->sys.place.height / subpicture->i_original_picture_height;
-        spuViewport.right  = (FLOAT) (r->i_x + r->fmt.i_visible_width)  * sys->sys.place.width  / subpicture->i_original_picture_width;
-        spuViewport.bottom = (FLOAT) (r->i_y + r->fmt.i_visible_height) * sys->sys.place.height / subpicture->i_original_picture_height;
+        spuViewport.left   = (FLOAT) r->i_x * sys->area.place.width  / subpicture->i_original_picture_width;
+        spuViewport.top    = (FLOAT) r->i_y * sys->area.place.height / subpicture->i_original_picture_height;
+        spuViewport.right  = (FLOAT) (r->i_x + r->fmt.i_visible_width)  * sys->area.place.width  / subpicture->i_original_picture_width;
+        spuViewport.bottom = (FLOAT) (r->i_y + r->fmt.i_visible_height) * sys->area.place.height / subpicture->i_original_picture_height;
 
         if (r->zoom_h.num != 0 && r->zoom_h.den != 0)
         {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 1e44b74f83..e0765f9c3a 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -138,6 +138,7 @@ typedef struct
 struct vout_display_sys_t
 {
     vout_display_sys_win32_t sys;
+    display_win32_area_t     area;
 
     bool allow_hw_yuv;    /* Should we use hardware YUV->RGB conversions */
     struct {
@@ -485,9 +486,9 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
     };
     RECT rect_dst = {
         .left   = 0,
-        .right  = vd->sys->sys.place.width,
+        .right  = vd->sys->area.place.width,
         .top    = 0,
-        .bottom = vd->sys->sys.place.height,
+        .bottom = vd->sys->area.place.height,
     };
     Direct3D9SetupVertices(region->vertex, &rect_src, &copy_rect,
                            &rect_dst, 255, vd->source.orientation);
@@ -899,7 +900,7 @@ static int Direct3D9Reset(vout_display_t *vd, video_format_t *fmtp)
         return VLC_EGENERIC;
     }
 
-    UpdateRects(vd, &sys->sys);
+    UpdateRects(vd, &sys->area, &sys->sys);
 
     /* re-create them */
     if (Direct3D9CreateResources(vd, fmtp)) {
@@ -915,7 +916,7 @@ static void UpdateDesktopMode(vout_display_t *vd)
 
     if (sys->sys.use_desktop) {
         /* Save non-desktop state */
-        sys->desktop_save.is_fullscreen = sys->sys.vdcfg.is_fullscreen;
+        sys->desktop_save.is_fullscreen = sys->area.vdcfg.is_fullscreen;
         sys->desktop_save.is_on_top     = sys->sys.is_on_top;
 
         /* Disable fullscreen/on_top while using desktop */
@@ -1026,8 +1027,8 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
         }
 
         /* Map the subpicture to sys->sys.sys.place */
-        const float scale_w = (float)(sys->sys.place.width)  / subpicture->i_original_picture_width;
-        const float scale_h = (float)(sys->sys.place.height) / subpicture->i_original_picture_height;
+        const float scale_w = (float)(sys->area.place.width)  / subpicture->i_original_picture_width;
+        const float scale_h = (float)(sys->area.place.height) / subpicture->i_original_picture_height;
 
         RECT dst;
         dst.left   =            scale_w * r->i_x,
@@ -1207,7 +1208,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
     VLC_UNUSED(date);
     vout_display_sys_t *sys = vd->sys;
 
-    CommonManage(vd, &sys->sys);
+    CommonManage(vd, &sys->area, &sys->sys);
 
     /* Desktop mode change */
     bool prev_desktop = sys->sys.use_desktop;
@@ -1216,7 +1217,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
         UpdateDesktopMode(vd);
 
     /* Position Change */
-    if (sys->sys.place_changed) {
+    if (sys->area.place_changed) {
 #if 0 /* need that when bicubic filter is available */
         RECT rect;
         UINT width, height;
@@ -1234,7 +1235,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
         }
 #endif
         sys->clear_scene = true;
-        sys->sys.place_changed = false;
+        sys->area.place_changed = false;
     }
 
     picture_sys_t *p_sys = picture->p_sys;
@@ -1333,9 +1334,9 @@ static void Swap(void *opaque)
     // No stretching should happen here !
     RECT src = {
         .left   = 0,
-        .right  = sys->sys.place.width,
+        .right  = sys->area.place.width,
         .top    = 0,
-        .bottom = sys->sys.place.height
+        .bottom = sys->area.place.height
     };
     
     HRESULT hr;
@@ -1504,7 +1505,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt,
     fmt->i_bmask  = d3dfmt->bmask;
     sys->sw_texture_fmt = d3dfmt;
 
-    UpdateRects(vd, &sys->sys);
+    UpdateRects(vd, &sys->area, &sys->sys);
 
     if (Direct3D9CreateResources(vd, fmt)) {
         msg_Err(vd, "Failed to allocate resources");
@@ -1555,7 +1556,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         return VLC_SUCCESS;
     }
     default:
-        return CommonControl(vd, &sys->sys, query, args);
+        return CommonControl(vd, &sys->area, &sys->sys, query, args);
     }
 }
 
@@ -1679,7 +1680,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     sys->desktop_save.is_fullscreen = cfg->is_fullscreen;
     sys->desktop_save.is_on_top     = false;
 
-    if (CommonInit(vd, &sys->sys, d3d9_device != NULL, cfg))
+    if (CommonInit(vd, &sys->area, &sys->sys, d3d9_device != NULL, cfg))
         goto error;
 
     /* */
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 80b6ec1e45..5d58a87992 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -61,6 +61,7 @@ vlc_module_end()
 struct vout_display_sys_t
 {
     vout_display_sys_win32_t sys;
+    display_win32_area_t     area;
 
     vlc_gl_t              *gl;
     vout_display_opengl_t *vgl;
@@ -82,7 +83,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         return vout_display_opengl_SetViewpoint(sys->vgl,
             &va_arg (args, const vout_display_cfg_t* )->viewpoint);
 
-    return CommonControl(vd, &sys->sys, query, args);
+    return CommonControl(vd, &sys->area, &sys->sys, query, args);
 }
 
 static const struct vout_window_operations embedVideoWindow_Ops =
@@ -121,7 +122,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_ENOMEM;
 
     /* */
-    if (CommonInit(vd, &sys->sys, false, cfg))
+    if (CommonInit(vd, &sys->area, &sys->sys, false, cfg))
         goto error;
 
     if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
@@ -220,10 +221,10 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
     VLC_UNUSED(date);
     vout_display_sys_t *sys = vd->sys;
 
-    CommonManage(vd, &sys->sys);
+    CommonManage(vd, &sys->area, &sys->sys);
 
-    const int width  = sys->sys.place.width;
-    const int height = sys->sys.place.height;
+    const int width  = sys->area.place.width;
+    const int height = sys->area.place.height;
     vlc_gl_Resize (sys->gl, width, height);
     if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
         return;
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 2f5c10e828..57d581022c 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -62,6 +62,7 @@ vlc_module_end ()
 struct vout_display_sys_t
 {
     vout_display_sys_win32_t sys;
+    display_win32_area_t     area;
 
     int  i_depth;
 
@@ -100,7 +101,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 static int Control(vout_display_t *vd, int query, va_list args)
 {
     vout_display_sys_t *sys = vd->sys;
-    return CommonControl(vd, &sys->sys, query, args);
+    return CommonControl(vd, &sys->area, &sys->sys, query, args);
 }
 
 /* */
@@ -116,7 +117,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!sys)
         return VLC_ENOMEM;
 
-    if (CommonInit(vd, &sys->sys, false, cfg))
+    if (CommonInit(vd, &sys->area, &sys->sys, false, cfg))
         goto error;
 
     /* */
@@ -155,10 +156,10 @@ static void Display(vout_display_t *vd, picture_t *picture)
 
     SelectObject(sys->off_dc, sys->off_bitmap);
 
-    if (sys->sys.place.width  != vd->source.i_visible_width ||
-        sys->sys.place.height != vd->source.i_visible_height) {
+    if (sys->area.place.width  != vd->source.i_visible_width ||
+        sys->area.place.height != vd->source.i_visible_height) {
         StretchBlt(hdc, 0, 0,
-                   sys->sys.place.width, sys->sys.place.height,
+                   sys->area.place.width, sys->area.place.height,
                    sys->off_dc,
                    vd->source.i_x_offset, vd->source.i_y_offset,
                    vd->source.i_x_offset + vd->source.i_visible_width,
@@ -166,7 +167,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
                    SRCCOPY);
     } else {
         BitBlt(hdc, 0, 0,
-               sys->sys.place.width, sys->sys.place.height,
+               sys->area.place.width, sys->area.place.height,
                sys->off_dc,
                vd->source.i_x_offset, vd->source.i_y_offset,
                SRCCOPY);
@@ -174,7 +175,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
 
     ReleaseDC(sys->sys.hvideownd, hdc);
 
-    CommonManage(vd, &sys->sys);
+    CommonManage(vd, &sys->area, &sys->sys);
 }
 
 static int Init(vout_display_t *vd, video_format_t *fmt)
@@ -262,7 +263,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
     if (!sys->sys.b_windowless)
         EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (WinGDI output)");
 
-    UpdateRects(vd, &sys->sys);
+    UpdateRects(vd, &sys->area, &sys->sys);
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list