[vlc-commits] vout:win32: separate the display area structure from the display_sys

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar 25 11:13:23 2019 +0100| [abf7aab70370a310d43679b203624c01c114c43a] | committer: Steve Lhomme

vout:win32: separate the display area structure from the display_sys

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

 modules/video_output/win32/common.c     | 17 ++++++-----------
 modules/video_output/win32/common.h     |  4 +++-
 modules/video_output/win32/direct3d11.c |  7 ++++---
 modules/video_output/win32/direct3d9.c  |  3 ++-
 modules/video_output/win32/glwin32.c    |  3 ++-
 modules/video_output/win32/wingdi.c     |  3 ++-
 6 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 094b3f2202..10072047b1 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -73,7 +73,7 @@ static bool GetExternalDimensions(void *opaque, UINT *width, UINT *height)
     return true;
 }
 
-static void InitArea(vout_display_t *vd, display_win32_area_t *area, const vout_display_cfg_t *vdcfg)
+void InitArea(vout_display_t *vd, display_win32_area_t *area, const vout_display_cfg_t *vdcfg)
 {
     area->place_changed = false;
     area->pf_GetDisplayDimensions = GetExternalDimensions;
@@ -83,10 +83,8 @@ static void InitArea(vout_display_t *vd, display_win32_area_t *area, const vout_
 
 /* */
 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)
+               bool b_windowless)
 {
-    InitArea(vd, area, vdcfg);
-
     sys->hwnd      = NULL;
     sys->hvideownd = NULL;
     sys->hparent   = NULL;
@@ -114,7 +112,7 @@ int CommonInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_
     var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
 
     /* */
-    sys->event = EventThreadCreate(vd, vdcfg);
+    sys->event = EventThreadCreate(vd, &area->vdcfg);
     if (!sys->event)
         return VLC_EGENERIC;
 
@@ -125,8 +123,8 @@ int CommonInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_
 #endif
     cfg.x      = var_InheritInteger(vd, "video-x");
     cfg.y      = var_InheritInteger(vd, "video-y");
-    cfg.width  = vdcfg->display.width;
-    cfg.height = vdcfg->display.height;
+    cfg.width  = area->vdcfg.display.width;
+    cfg.height = area->vdcfg.display.height;
 
     event_hwnd_t hwnd;
     if (EventThreadStart(sys->event, &hwnd, &cfg))
@@ -156,9 +154,6 @@ void UpdateRects(vout_display_t *vd, display_win32_area_t *area, vout_display_sy
 
     UINT  display_width, display_height;
 
-    /* */
-    const vout_display_cfg_t *cfg = &area->vdcfg;
-
     /* Retrieve the window size */
     if (!area->pf_GetDisplayDimensions(area->opaque_dimensions, &display_width, &display_height))
     {
@@ -167,7 +162,7 @@ void UpdateRects(vout_display_t *vd, display_win32_area_t *area, vout_display_sy
     }
 
     /* Update the window position and size */
-    vout_display_cfg_t place_cfg = *cfg;
+    vout_display_cfg_t place_cfg = area->vdcfg;
     place_cfg.display.width = display_width;
     place_cfg.display.height = display_height;
 
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index e3c85a27ea..97d8d63b60 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -80,7 +80,7 @@ typedef struct vout_display_sys_win32_t
 /*****************************************************************************
  * Prototypes from common.c
  *****************************************************************************/
-int  CommonInit(vout_display_t *, display_win32_area_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);
 #if !VLC_WINSTORE_APP
 void CommonClean(vlc_object_t *, vout_display_sys_win32_t *);
 #endif /* !VLC_WINSTORE_APP */
@@ -89,6 +89,8 @@ int  CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_wi
 
 void UpdateRects (vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *);
 
+void InitArea(vout_display_t *, display_win32_area_t *, const vout_display_cfg_t *);
+
 /*****************************************************************************
  * Constants
  *****************************************************************************/
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index a3b8eec408..3d480a41ce 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -479,12 +479,13 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         goto error;
     }
 #endif
-    if (CommonInit(vd, &sys->area, &sys->sys, d3d11_ctx != NULL, cfg))
+    InitArea(vd, &sys->area, cfg);
+    if (CommonInit(vd, &sys->area, &sys->sys, d3d11_ctx != NULL))
         goto error;
 
 #if VLC_WINSTORE_APP
-    sys->sys.area.pf_GetDisplayDimensions = GetExtenalSwapchainDimensions;
-    sys->sys.area.opaque_dimensions = sys;
+    sys->area.pf_GetDisplayDimensions = GetExtenalSwapchainDimensions;
+    sys->area.opaque_dimensions = sys;
 #endif
 
     if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR && sys->sys.hvideownd)
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index e0765f9c3a..57d60f4770 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1680,7 +1680,8 @@ 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->area, &sys->sys, d3d9_device != NULL, cfg))
+    InitArea(vd, &sys->area, cfg);
+    if (CommonInit(vd, &sys->area, &sys->sys, d3d9_device != NULL))
         goto error;
 
     /* */
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 5d58a87992..c26dbf0a02 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -122,7 +122,8 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_ENOMEM;
 
     /* */
-    if (CommonInit(vd, &sys->area, &sys->sys, false, cfg))
+    InitArea(vd, &sys->area, cfg);
+    if (CommonInit(vd, &sys->area, &sys->sys, false))
         goto error;
 
     if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 57d581022c..beb2f327ce 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -117,7 +117,8 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!sys)
         return VLC_ENOMEM;
 
-    if (CommonInit(vd, &sys->area, &sys->sys, false, cfg))
+    InitArea(vd, &sys->area, cfg);
+    if (CommonInit(vd, &sys->area, &sys->sys, false))
         goto error;
 
     /* */



More information about the vlc-commits mailing list