]> git.sesse.net Git - vlc/commitdiff
inhibit: add separate flags for audio and video
authorRémi Denis-Courmont <remi@remlab.net>
Fri, 30 Nov 2012 17:13:24 +0000 (19:13 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 30 Nov 2012 17:13:24 +0000 (19:13 +0200)
include/vlc_inhibit.h
modules/misc/inhibit/mce.c
modules/misc/inhibit/xdg.c
modules/misc/inhibit/xscreensaver.c
src/video_output/inhibit.h
src/video_output/window.c

index 5ac460c2035c3bd92b07d3d6b939f2063422b7bc..b1f73306312f5dee024f1b6639b689ee7ba0bdec 100644 (file)
 typedef struct vlc_inhibit vlc_inhibit_t;
 typedef struct vlc_inhibit_sys vlc_inhibit_sys_t;
 
+enum vlc_inhibit_flags
+{
+    VLC_INHIBIT_NONE=0 /*< No inhibition */,
+    VLC_INHIBIT_SUSPEND=0x1 /*< Processor is in use - do not suspend */,
+    VLC_INHIBIT_DISPLAY=0x2 /*< Display is in use - do not blank/lock */,
+#define VLC_INHIBIT_AUDIO (VLC_INHIBIT_SUSPEND)
+#define VLC_INHIBIT_VIDEO (VLC_INHIBIT_SUSPEND|VLC_INHIBIT_DISPLAY)
+};
+
 struct vlc_inhibit
 {
     VLC_COMMON_MEMBERS
 
     vlc_inhibit_sys_t *p_sys;
-    void             (*inhibit) (vlc_inhibit_t *, bool);
+    void (*inhibit) (vlc_inhibit_t *, unsigned flags);
 };
 
+static inline void vlc_inhibit_Set (vlc_inhibit_t *ih, unsigned flags)
+{
+    ih->inhibit (ih, flags);
+}
+
 #endif
index d49e969e1b1a61626f2123fd36bd387103d20b7c..71834b9c26eb8f50b60982b5c9e968a59431baac 100644 (file)
@@ -44,7 +44,7 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
 vlc_module_end ()
 
-static void Inhibit (vlc_inhibit_t *, bool);
+static void Inhibit (vlc_inhibit_t *, unsigned);
 static void Timer (void *data);
 
 struct vlc_inhibit_sys
@@ -97,9 +97,10 @@ static void Close (vlc_object_t *obj)
     free (sys);
 }
 
-static void Inhibit (vlc_inhibit_t *ih, bool unblank)
+static void Inhibit (vlc_inhibit_t *ih, unsigned flags)
 {
     vlc_inhibit_sys_t *sys = ih->p_sys;
+    bool unblank = (flags & VLC_INHIBIT_DISPLAY) != 0;
 
     /* The shortest blanking interval is 10s on N900, 15s on N9 */
     const mtime_t interval = 9 * CLOCK_FREQ;
index 56d065b7b5094d1d80a61611cc00ecc0144c0351..191568a9bb1077f7909b8694a5f0ad213ccf5cda 100644 (file)
@@ -75,9 +75,10 @@ static void Timer (void *data)
     }
 }
 
-static void Inhibit (vlc_inhibit_t *ih, bool suspend)
+static void Inhibit (vlc_inhibit_t *ih, unsigned mask)
 {
     vlc_inhibit_sys_t *sys = ih->p_sys;
+    bool suspend = (mask & VLC_INHIBIT_DISPLAY) != 0;
     mtime_t delay = suspend ? 30 * CLOCK_FREQ : INT64_C(0);
 
     vlc_timer_schedule (sys->timer, false, delay, delay);
index 819d74ff54f9f760825f04cb014d0adce15c9418..c219c66ce66a7caf53d7d7113959d088c78b7b20 100644 (file)
@@ -48,7 +48,7 @@ static int  Activate     ( vlc_object_t * );
 static void  Deactivate   ( vlc_object_t * );
 
 static void Timer( void * );
-static void Inhibit( vlc_inhibit_t *, bool );
+static void Inhibit( vlc_inhibit_t *, unsigned );
 
 struct vlc_inhibit_sys
 {
@@ -122,8 +122,9 @@ static void Deactivate( vlc_object_t *p_this )
     free( p_sys );
 }
 
-static void Inhibit( vlc_inhibit_t *p_ih, bool suspend )
+static void Inhibit( vlc_inhibit_t *p_ih, unsigned mask )
 {
+    bool suspend = (mask & VLC_INHIBIT_DISPLAY) != 0;
     mtime_t d = suspend ? 30*CLOCK_FREQ : 0;
     vlc_timer_schedule( p_ih->p_sys->timer, false, d, d );
 }
index 2df2c826ea33871c3da7a49aba9763fdd4f12f0b..764b8a946d413c7ee574363095c159090d68c7d9 100644 (file)
@@ -25,9 +25,4 @@
 
 vlc_inhibit_t *vlc_inhibit_Create (vlc_object_t *);
 void vlc_inhibit_Destroy (vlc_inhibit_t *);
-
-static inline void vlc_inhibit_Set (vlc_inhibit_t *ih, bool suspend)
-{
-    ih->inhibit (ih, suspend);
-}
 #endif
index 7efc8eb796ff0a7c5076ad4fccd5f815a888bc56..4f1951fea4a422afac6ce613e7cea1bddd19881c 100644 (file)
@@ -97,7 +97,7 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
         cfg->type == VOUT_WINDOW_TYPE_XID) {
         w->inhibit = vlc_inhibit_Create(VLC_OBJECT (window));
         if (w->inhibit != NULL)
-            vlc_inhibit_Set(w->inhibit, true);
+            vlc_inhibit_Set(w->inhibit, VLC_INHIBIT_VIDEO);
             /* FIXME: ^ wait for vout activation, pause */
     }
     else
@@ -121,7 +121,7 @@ void vout_window_Delete(vout_window_t *window)
     window_t *w = (window_t *)window;
     if (w->inhibit)
     {
-        vlc_inhibit_Set (w->inhibit, false);
+        vlc_inhibit_Set (w->inhibit, VLC_INHIBIT_NONE);
         vlc_inhibit_Destroy (w->inhibit);
     }