+ {
+ input_thread_t * p_input;
+ vlc_value_t val, list, list2;
+ int i_count, i;
+
+ p_playlist = pl_Yield( p_intf );
+
+ p_input = input_from_playlist( p_playlist );
+
+ vlc_object_release( p_playlist );
+
+ if( !p_input )
+ break;
+
+ var_Get( p_input, "audio-es", &val );
+ var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
+ &list, &list2 );
+ i_count = list.p_list->i_count;
+ if( i_count <= 1 )
+ {
+ vlc_object_release( p_input );
+ break;
+ }
+ for( i = 0; i < i_count; i++ )
+ {
+ if( val.i_int == list.p_list->p_values[i].i_int )
+ {
+ 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 );
+ }
+ break;
+ case GESTURE(DOWN,RIGHT,NONE,NONE):
+ {
+ input_thread_t * p_input;
+ vlc_value_t val, list, list2;
+ int i_count, i;
+
+ p_playlist = pl_Yield( p_intf );
+
+ p_input = input_from_playlist( p_playlist );
+ vlc_object_release( p_playlist );
+
+ if( !p_input )
+ break;
+
+ var_Get( p_input, "spu-es", &val );
+
+ var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
+ &list, &list2 );
+ i_count = list.p_list->i_count;
+ if( i_count <= 1 )
+ {
+ vlc_object_release( p_input );
+ break;
+ }
+ for( i = 0; i < i_count; i++ )
+ {
+ if( val.i_int == list.p_list->p_values[i].i_int )
+ {
+ break;
+ }
+ }
+ /* value of spu-es was not in choices list */
+ if( i == i_count )
+ {
+ msg_Warn( p_input,
+ "invalid current subtitle track, selecting 0" );
+ var_Set( p_input, "spu-es", list.p_list->p_values[0] );
+ i = 0;
+ }
+ else if( i == i_count - 1 )
+ {
+ var_Set( p_input, "spu-es", list.p_list->p_values[0] );
+ i = 0;
+ }
+ else
+ {
+ var_Set( p_input, "spu-es",
+ list.p_list->p_values[i+1] );
+ i = i + 1;
+ }
+ vlc_object_release( p_input );
+ }
+ break;
+ case GESTURE(UP,LEFT,NONE,NONE):