[vlc-commits] vout:win32: only hook the sensors when handling 360 videos

Steve Lhomme git at videolan.org
Mon Apr 1 12:03:27 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 27 09:21:09 2019 +0100| [b037cf1254b2d3fb9dd1dd6b6e275f9f5e43db25] | committer: Steve Lhomme

vout:win32: only hook the sensors when handling 360 videos

So we don't need it in modules that don't support it.

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

 modules/video_output/Makefile.am        | 2 --
 modules/video_output/win32/direct3d11.c | 7 +++++++
 modules/video_output/win32/events.c     | 7 -------
 modules/video_output/win32/glwin32.c    | 7 +++++++
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 51a09a30d3..bb307bb9b8 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -300,7 +300,6 @@ endif
 libdirect3d9_plugin_la_SOURCES = video_output/win32/direct3d9.c \
 	video_output/win32/common.c video_output/win32/common.h \
 	video_output/win32/events.c video_output/win32/events.h \
-	video_output/win32/sensors.cpp \
 	video_output/win32/builtin_shaders.h \
 	video_output/win32/win32touch.c video_output/win32/win32touch.h
 libdirect3d9_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
@@ -361,7 +360,6 @@ endif
 libwingdi_plugin_la_SOURCES = video_output/win32/wingdi.c \
 	video_output/win32/common.c video_output/win32/common.h \
 	video_output/win32/events.c video_output/win32/events.h \
-	video_output/win32/sensors.cpp \
 	video_output/win32/win32touch.c video_output/win32/win32touch.h
 libwingdi_plugin_la_LIBADD = libchroma_copy.la -lgdi32 $(LIBCOM) -luuid
 if HAVE_WIN32_DESKTOP
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index c830068ccd..28e999ac4c 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -91,6 +91,9 @@ struct vout_display_sys_t
 {
     vout_display_sys_win32_t sys;
 
+    /* Sensors */
+    void *p_sensors;
+
     display_info_t           display;
 
     d3d11_handle_t           hd3d;
@@ -498,6 +501,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     sys->sys.pf_GetPictureWidth  = GetPictureWidth;
     sys->sys.pf_GetPictureHeight = GetPictureHeight;
 
+    if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR && sys->sys.hwnd)
+        sys->p_sensors = HookWindowsSensors(vd, sys->sys.hwnd);
+
     if (!sys->swapCb || !sys->starRenderCb || !sys->endRenderCb || !sys->resizeCb)
     {
         sys->outside_opaque = vd;
@@ -549,6 +555,7 @@ error:
 static void Close(vout_display_t *vd)
 {
     Direct3D11Close(vd);
+    UnhookWindowsSensors(vd->sys->p_sensors);
 #if !VLC_WINSTORE_APP
     CommonClean(vd, &vd->sys->sys);
 #endif
diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 9a7627f8d8..ab7457753a 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -73,9 +73,6 @@ struct event_thread_t
     /* Gestures */
     win32_gesture_sys_t *p_gesture;
 
-    /* Sensors */
-    void *p_sensors;
-
     /* Title */
     char *psz_title;
 
@@ -795,8 +792,6 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
     bool b_isProjected  = (vd->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR);
     InitGestures( p_event->hwnd, &p_event->p_gesture, b_isProjected );
 
-    p_event->p_sensors = HookWindowsSensors(vd, p_event->hwnd);
-
     if( p_event->hparent )
     {
         /* We don't want the window owner to overwrite our client area */
@@ -879,8 +874,6 @@ static void Win32VoutCloseWindow( event_thread_t *p_event )
 
     DestroyCursor( p_event->cursor_empty );
 
-    UnhookWindowsSensors(p_event->p_sensors);
-
     CloseGestures( p_event->p_gesture);
 }
 
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index f026e45ae1..c3989682aa 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -65,6 +65,9 @@ struct vout_display_sys_t
     vlc_gl_t              *gl;
     vout_display_opengl_t *vgl;
     picture_pool_t        *pool;
+
+    /* Sensors */
+    void *p_sensors;
 };
 
 static picture_pool_t *Pool  (vout_display_t *, unsigned);
@@ -125,6 +128,9 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (CommonInit(vd, &sys->sys, false, cfg))
         goto error;
 
+    if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR)
+        sys->p_sensors = HookWindowsSensors(vd, sys->sys.hwnd);
+
     if (!sys->sys.b_windowless)
         EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (OpenGL output)");
 
@@ -193,6 +199,7 @@ static void Close(vout_display_t *vd)
         vlc_object_delete(surface);
     }
 
+    UnhookWindowsSensors(sys->p_sensors);
     CommonClean(vd, &sys->sys);
 
     free(sys);



More information about the vlc-commits mailing list