[vlc-commits] vout:win32: add a flag to allow display modules handle the full display size

Steve Lhomme git at videolan.org
Tue Apr 30 11:13:43 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Apr 16 08:59:45 2019 +0200| [900e2f5e838fb3457316e859f16646c1bbfb5ff2] | committer: Steve Lhomme

vout:win32: add a flag to allow display modules handle the full display size

Right now all Windows display module render on the hvideownd which is already
cropped and positioned according to the PlacePicture results.
In external rendering we do not have this mechanism and so we need to be able
to render on the full display but cropping according to the PlacePicture result.

Ultimately that should be the only mode. D3D and OpenGL should have no problem
cropping and stretching in the proper area. WinGDI should also be able to only
draw on a portion of a HWND. It can already stretch.

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

 modules/video_output/win32/common.c     | 15 +++++++++++----
 modules/video_output/win32/common.h     |  4 +++-
 modules/video_output/win32/direct3d11.c |  2 +-
 modules/video_output/win32/direct3d9.c  |  2 +-
 modules/video_output/win32/glwin32.c    |  2 +-
 modules/video_output/win32/wingdi.c     |  2 +-
 6 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 5a82e2abd8..baedab4090 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -79,7 +79,8 @@ static bool GetWindowDimensions(void *opaque, UINT *width, UINT *height)
 
 /* */
 int CommonInit(vlc_object_t *obj, display_win32_area_t *area,
-               vout_display_sys_win32_t *sys, bool projection_gestures)
+               vout_display_sys_win32_t *sys,
+               bool projection_gestures, bool full_size_video)
 {
     if (unlikely(area->vdcfg.window == NULL))
         return VLC_EGENERIC;
@@ -95,6 +96,7 @@ int CommonInit(vlc_object_t *obj, display_win32_area_t *area,
     sys->hvideownd = NULL;
     sys->hparent   = NULL;
     sys->is_first_placement = true;
+    sys->full_size_video = full_size_video;
 
     /* */
     sys->event = EventThreadCreate(obj, area->vdcfg.window);
@@ -184,9 +186,14 @@ void UpdateRects(vout_display_t *vd, display_win32_area_t *area, vout_display_sy
                     swpFlags |= SWP_SHOWWINDOW;
                     sys->is_first_placement = false;
                 }
-                SetWindowPos(sys->hvideownd, 0,
-                    area->place.x, area->place.y, area->place.width, area->place.height,
-                    swpFlags);
+                if (sys->full_size_video)
+                    SetWindowPos(sys->hvideownd, 0,
+                        0, 0, display_width, display_height,
+                        swpFlags);
+                else
+                    SetWindowPos(sys->hvideownd, 0,
+                        area->place.x, area->place.y, area->place.width, area->place.height,
+                        swpFlags);
             }
 
             CommonChangeThumbnailClip(VLC_OBJECT(vd), sys, true);
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 4d81df87be..bf4f61b80e 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -67,6 +67,7 @@ typedef struct vout_display_sys_win32_t
 
     /* Misc */
     bool is_first_placement;
+    bool full_size_video; /* true if hvideownd should have the same size as hwnd */
 } vout_display_sys_win32_t;
 
 
@@ -74,7 +75,8 @@ typedef struct vout_display_sys_win32_t
  * Prototypes from common.c
  *****************************************************************************/
 #if !VLC_WINSTORE_APP
-int  CommonInit(vlc_object_t *, display_win32_area_t *, vout_display_sys_win32_t *, bool projection_gestures);
+int  CommonInit(vlc_object_t *, display_win32_area_t *, vout_display_sys_win32_t *,
+                bool projection_gestures, bool full_size_video);
 void CommonClean(vlc_object_t *, vout_display_sys_win32_t *);
 #endif /* !VLC_WINSTORE_APP */
 int  CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, int , va_list );
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index df389c6752..0ad8942f3d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -476,7 +476,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (d3d11_ctx == NULL)
     {
         if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys,
-                       vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR))
+                       vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR, false))
             goto error;
     }
 #else /* !VLC_WINSTORE_APP */
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index ed98acdafc..e9d372aef3 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1624,7 +1624,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     InitArea(vd, &sys->area, cfg);
     if (d3d9_device == NULL)
     {
-        if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false))
+        if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false, false))
             goto error;
     }
 
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 65269e9840..3626d056d6 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -124,7 +124,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     /* */
     InitArea(vd, &sys->area, cfg);
     if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys,
-                   vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR))
+                   vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR, 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 e160a804ad..0c092cbf85 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -118,7 +118,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_ENOMEM;
 
     InitArea(vd, &sys->area, cfg);
-    if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false))
+    if (CommonInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false, false))
         goto error;
 
     /* */



More information about the vlc-commits mailing list