Commit 405da960 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

inhibit: add separate flags for audio and video

parent 273641ac
......@@ -29,12 +29,26 @@
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
......@@ -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;
......
......@@ -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);
......
......@@ -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 );
}
......
......@@ -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
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment