Commit b4e738fd authored by Yoann Peronneau's avatar Yoann Peronneau

* modules/control/hotkeys.c : clean up

parent 3b6a46b8
......@@ -65,8 +65,8 @@ static int ActionKeyCB( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static void PlayBookmark( intf_thread_t *, int );
static void SetBookmark ( intf_thread_t *, int );
static int GetPosition ( intf_thread_t * );
static void DisplayPosition( input_thread_t * );
static void DisplayPosition( vout_thread_t *, input_thread_t * );
static void DisplayVolume ( vout_thread_t *, audio_volume_t );
/*****************************************************************************
* Module descriptor
......@@ -240,38 +240,13 @@ static void Run( intf_thread_t *p_intf )
{
audio_volume_t i_newvol;
aout_VolumeUp( p_intf, 1, &i_newvol );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
2*i_newvol*100/AOUT_VOLUME_MAX );
}
}
DisplayVolume( p_vout, i_newvol );
}
else if( i_action == ACTIONID_VOL_DOWN )
{
audio_volume_t i_newvol;
aout_VolumeDown( p_intf, 1, &i_newvol );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
2*i_newvol*100/AOUT_VOLUME_MAX );
}
}
DisplayVolume( p_vout, i_newvol );
}
else if( i_action == ACTIONID_VOL_MUTE )
{
......@@ -281,21 +256,11 @@ static void Run( intf_thread_t *p_intf )
{
if( i_newvol == 0 )
{
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) );
vout_OSDIcon( VLC_OBJECT( p_intf ), OSD_MUTE_ICON );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
i_newvol * 100 / AOUT_VOLUME_MAX );
}
DisplayVolume( p_vout, i_newvol );
}
}
}
......@@ -378,115 +343,37 @@ static void Run( intf_thread_t *p_intf )
{
val.i_time = -10000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
DisplayPosition( p_input );
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump -10 seconds" ) );
}
}
DisplayPosition( p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
{
val.i_time = 10000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
DisplayPosition( p_input );
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, POSITION_CHAN,
_( "Jump +10 seconds" ) );
}
}
DisplayPosition( p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_BACKWARD_1MIN && b_seekable )
{
val.i_time = -60000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
DisplayPosition( p_input );
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump -1 minute" ) );
}
}
DisplayPosition( p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_FORWARD_1MIN && b_seekable )
{
val.i_time = 60000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
DisplayPosition( p_input );
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump +1 minute" ) );
}
}
DisplayPosition( p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN && b_seekable )
{
val.i_time = -300000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
DisplayPosition( p_input );
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump -5 minutes" ) );
}
}
DisplayPosition( p_vout, p_input );
}
else if( i_action == ACTIONID_JUMP_FORWARD_5MIN && b_seekable )
{
val.i_time = 300000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
DisplayPosition( p_input );
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump +5 minutes" ) );
}
}
DisplayPosition( p_vout, p_input );
}
else if( i_action == ACTIONID_NEXT )
{
......@@ -530,7 +417,7 @@ static void Run( intf_thread_t *p_intf )
}
else if( i_action == ACTIONID_POSITION )
{
DisplayPosition( p_input );
DisplayPosition( p_vout, p_input );
}
else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
i_action <= ACTIONID_PLAY_BOOKMARK10 )
......@@ -657,28 +544,18 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
}
}
static int GetPosition( intf_thread_t *p_intf )
{
input_thread_t *p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
if( p_input )
{
vlc_value_t pos;
var_Get( p_input, "position", &pos );
vlc_object_release( p_input );
return pos.f_float * 100;
}
return -1;
}
static void DisplayPosition( input_thread_t *p_input )
static void DisplayPosition( vout_thread_t *p_vout, input_thread_t *p_input )
{
char psz_duration[MSTRTIME_MAX_SIZE];
char psz_time[MSTRTIME_MAX_SIZE];
vlc_value_t time;
vlc_value_t time, pos;
mtime_t i_seconds;
if( p_vout == NULL )
{
return;
}
var_Get( p_input, "time", &time );
i_seconds = time.i_time / 1000000;
secstotimestr ( psz_time, i_seconds );
......@@ -694,4 +571,30 @@ static void DisplayPosition( input_thread_t *p_input )
{
vout_OSDMessage( p_input, POSITION_CHAN, psz_time );
}
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
var_Get( p_input, "position", &pos );
vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_CHAN,
pos.f_float * 100, OSD_HOR_SLIDER );
}
}
static void DisplayVolume( vout_thread_t *p_vout, audio_volume_t i_vol )
{
if( p_vout == NULL )
{
return;
}
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_CHAN,
i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_vout, VOLUME_CHAN, "Vol %d%%",
2*i_vol*100/AOUT_VOLUME_MAX );
}
}
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