[vlc-devel] [PATCH] vout: Initialize screen saver inhibition from the vout thread

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Jan 24 11:11:16 CET 2018


Fix #19463
---
 include/vlc_vout_window.h       |  1 +
 src/video_output/video_output.c |  3 +++
 src/video_output/window.c       | 25 +++++++++++++++----------
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index 237e7b2aae..daf7c5136f 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -216,6 +216,7 @@ VLC_API vout_window_t * vout_window_New(vlc_object_t *, const char *module, cons
  */
 VLC_API void vout_window_Delete(vout_window_t *);
 
+void vout_window_InitInhibition(vout_window_t *window);
 void vout_window_SetInhibition(vout_window_t *window, bool enabled);
 
 static inline int vout_window_vaControl(vout_window_t *window, int query,
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 640d999e80..ab16180a35 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1716,6 +1716,9 @@ static void *Thread(void *object)
 
     mtime_t deadline = VLC_TS_INVALID;
     bool wait = false;
+
+    vout_window_InitInhibition(sys->window);
+
     for (;;) {
         vout_control_cmd_t cmd;
 
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 0eb055a47f..d9313dca1b 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -76,16 +76,6 @@ vout_window_t *vout_window_New(vlc_object_t *obj, const char *module,
         return NULL;
     }
 
-    /* Hook for screensaver inhibition */
-    if (var_InheritBool(obj, "disable-screensaver") &&
-        (window->type == VOUT_WINDOW_TYPE_XID || window->type == VOUT_WINDOW_TYPE_HWND))
-    {
-        w->inhibit = vlc_inhibit_Create(VLC_OBJECT (window));
-        if (w->inhibit != NULL)
-            vlc_inhibit_Set(w->inhibit, VLC_INHIBIT_VIDEO);
-    }
-    else
-        w->inhibit = NULL;
     return window;
 }
 
@@ -113,6 +103,21 @@ void vout_window_Delete(vout_window_t *window)
     vlc_object_release(window);
 }
 
+void vout_window_InitInhibition(vout_window_t *window)
+{
+    window_t* w = (window_t*)window;
+    /* Hook for screensaver inhibition */
+    if (var_InheritBool(window, "disable-screensaver") &&
+        (window->type == VOUT_WINDOW_TYPE_XID || window->type == VOUT_WINDOW_TYPE_HWND))
+    {
+        w->inhibit = vlc_inhibit_Create(VLC_OBJECT (window));
+        if (w->inhibit != NULL)
+            vlc_inhibit_Set(w->inhibit, VLC_INHIBIT_VIDEO);
+    }
+    else
+        w->inhibit = NULL;
+}
+
 void vout_window_SetInhibition(vout_window_t *window, bool enabled)
 {
     window_t *w = (window_t *)window;
-- 
2.11.0



More information about the vlc-devel mailing list