Commit da8ff69a authored by Rémi Duraffort's avatar Rémi Duraffort

gestures:

 * add the possibility to go slower and faster (wasn't finished)
 * some cleaning and factorization
parent d935c55c
...@@ -198,107 +198,108 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -198,107 +198,108 @@ static void RunIntf( intf_thread_t *p_intf )
switch( p_intf->p_sys->i_pattern ) switch( p_intf->p_sys->i_pattern )
{ {
case LEFT: case LEFT:
// Get the current input msg_Dbg( p_intf, "Go backward in the movie!" );
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf ); pl_Release( p_intf );
if( !p_input ) if( p_input )
break;
i_interval = config_GetInt( p_intf , "short-jump-size" );
if ( i_interval > 0 )
{ {
val.i_time = ( (mtime_t)( -i_interval ) * 1000000L); i_interval = config_GetInt( p_intf , "short-jump-size" );
var_Set( p_input, "time-offset", val ); if ( i_interval > 0 )
{
val.i_time = ( (mtime_t)( -i_interval ) * 1000000L);
var_Set( p_input, "time-offset", val );
}
vlc_object_release( p_input );
} }
vlc_object_release( p_input );
msg_Dbg(p_intf, "Go backward in the movie!");
break; break;
case RIGHT: case RIGHT:
msg_Dbg( p_intf, "Go forward in the movie!" );
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf ); pl_Release( p_intf );
if( !p_input )
break;
i_interval = config_GetInt( p_intf , "short-jump-size" ); if( p_input )
if ( i_interval > 0 )
{ {
val.i_time = ( (mtime_t)( i_interval ) * 1000000L); i_interval = config_GetInt( p_intf , "short-jump-size" );
var_Set( p_input, "time-offset", val ); if ( i_interval > 0 )
{
val.i_time = ( (mtime_t)( i_interval ) * 1000000L);
var_Set( p_input, "time-offset", val );
}
vlc_object_release( p_input );
} }
vlc_object_release( p_input );
msg_Dbg(p_intf, "Go forward in the movie!");
break; break;
case GESTURE(LEFT,UP,NONE,NONE): case GESTURE(LEFT,UP,NONE,NONE):
/*FIXME BF*/ msg_Dbg( p_intf, "Going slower." );
msg_Dbg(p_intf, "Going slower."); p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input )
{
var_SetVoid( p_input, "rate-slower" );
vlc_object_release( p_input );
}
break; break;
case GESTURE(RIGHT,UP,NONE,NONE): case GESTURE(RIGHT,UP,NONE,NONE):
/*FIXME FF*/ msg_Dbg( p_intf, "Going faster." );
msg_Dbg(p_intf, "Going faster."); p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input )
{
var_SetVoid( p_input, "rate-faster" );
vlc_object_release( p_input );
}
break; break;
case GESTURE(LEFT,RIGHT,NONE,NONE): case GESTURE(LEFT,RIGHT,NONE,NONE):
case GESTURE(RIGHT,LEFT,NONE,NONE): case GESTURE(RIGHT,LEFT,NONE,NONE):
{ msg_Dbg( p_intf, "Play/Pause" );
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf ); pl_Release( p_intf );
if( !p_input )
break;
val.i_int = PLAYING_S; if( p_input )
if( p_input ) {
{ var_Get( p_input, "state", &val);
var_Get( p_input, "state", &val); val.i_int = ( val.i_int != PLAYING_S ) ? PLAYING_S : PAUSE_S;
if( val.i_int == PAUSE_S ) var_Set( p_input, "state", val);
{
val.i_int = PLAYING_S;
}
else
{
val.i_int = PAUSE_S;
}
var_Set( p_input, "state", val);
}
msg_Dbg(p_intf, "Play/Pause");
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
break; break;
case GESTURE(LEFT,DOWN,NONE,NONE): case GESTURE(LEFT,DOWN,NONE,NONE):
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
playlist_Prev( p_playlist ); playlist_Prev( p_playlist );
pl_Release( p_intf ); pl_Release( p_intf );
break; break;
case GESTURE(RIGHT,DOWN,NONE,NONE): case GESTURE(RIGHT,DOWN,NONE,NONE):
p_playlist = pl_Hold( p_intf ); p_playlist = pl_Hold( p_intf );
playlist_Next( p_playlist ); playlist_Next( p_playlist );
pl_Release( p_intf ); pl_Release( p_intf );
break; break;
case UP: case UP:
{ msg_Dbg(p_intf, "Louder");
audio_volume_t i_newvol; aout_VolumeUp( p_intf, 1, NULL );
aout_VolumeUp( p_intf, 1, &i_newvol );
msg_Dbg(p_intf, "Louder");
}
break; break;
case DOWN: case DOWN:
{ msg_Dbg(p_intf, "Quieter");
audio_volume_t i_newvol; aout_VolumeDown( p_intf, 1, NULL );
aout_VolumeDown( p_intf, 1, &i_newvol );
msg_Dbg(p_intf, "Quieter");
}
break; break;
case GESTURE(UP,DOWN,NONE,NONE): case GESTURE(UP,DOWN,NONE,NONE):
case GESTURE(DOWN,UP,NONE,NONE): case GESTURE(DOWN,UP,NONE,NONE):
{ msg_Dbg(p_intf, "Mute sound");
audio_volume_t i_newvol = -1; aout_VolumeMute( p_intf, NULL );
aout_VolumeMute( p_intf, &i_newvol );
msg_Dbg(p_intf, "Mute sound");
}
break; break;
case GESTURE(UP,RIGHT,NONE,NONE): case GESTURE(UP,RIGHT,NONE,NONE):
{ {
vlc_value_t val, list, list2; vlc_value_t val, list, list2;
...@@ -323,32 +324,21 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -323,32 +324,21 @@ static void RunIntf( intf_thread_t *p_intf )
for( i = 0; i < i_count; i++ ) for( i = 0; i < i_count; i++ )
{ {
if( val.i_int == list.p_list->p_values[i].i_int ) if( val.i_int == list.p_list->p_values[i].i_int )
{
break; break;
}
}
/* value of audio-es was not in choices list */
if( i == i_count )
{
msg_Warn( p_input,
"invalid current audio track, selecting 0" );
var_Set( p_input, "audio-es",
list.p_list->p_values[0] );
i = 0;
}
else if( i == i_count - 1 )
{
var_Set( p_input, "audio-es",
list.p_list->p_values[1] );
i = 1;
}
else
{
var_Set( p_input, "audio-es",
list.p_list->p_values[i+1] );
i++;
} }
vlc_object_release( p_input ); /* value of audio-es was not in choices list */
if( i == i_count )
{
msg_Warn( p_input,
"invalid current audio track, selecting 0" );
i = 0;
}
else if( i == i_count - 1 )
i = 1;
else
i++;
var_Set( p_input, "audio-es", list.p_list->p_values[i] );
vlc_object_release( p_input );
} }
break; break;
case GESTURE(DOWN,RIGHT,NONE,NONE): case GESTURE(DOWN,RIGHT,NONE,NONE):
...@@ -385,20 +375,13 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -385,20 +375,13 @@ static void RunIntf( intf_thread_t *p_intf )
{ {
msg_Warn( p_input, msg_Warn( p_input,
"invalid current subtitle track, selecting 0" ); "invalid current subtitle track, selecting 0" );
var_Set( p_input, "spu-es", list.p_list->p_values[0] );
i = 0; i = 0;
} }
else if( i == i_count - 1 ) else if( i == i_count - 1 )
{
var_Set( p_input, "spu-es", list.p_list->p_values[0] );
i = 0; i = 0;
}
else else
{ i++;
var_Set( p_input, "spu-es", var_Set( p_input, "spu-es", list.p_list->p_values[i] );
list.p_list->p_values[i+1] );
i = i + 1;
}
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
break; break;
......
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