i = 0;
else
i++;
- var_Set( p_input, "spu-es", list.p_list->p_values[i] );
+ var_SetInteger( p_input, "spu-es", list.p_list->p_values[i].i_int );
+ var_SetInteger( p_input, "spu-choice", list.p_list->p_values[i].i_int );
DisplayMessage( p_vout, _("Subtitle track: %s"),
list2.p_list->p_values[i].psz_string );
var_FreeList( &list, &list2 );
}
break;
+ case ACTIONID_SUBTITLE_TOGGLE:
+ if( p_input )
+ {
+ vlc_value_t list, list2;
+ int i_count, i_sel_index, i_sel_id, i_old_id, i_new_index;
+ i_old_id = var_GetInteger( p_input, "spu-es" );
+ i_sel_id = var_GetInteger( p_input, "spu-choice" );
+
+ var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
+ &list, &list2 );
+ i_count = list.p_list->i_count;
+ if( i_count <= 1 )
+ {
+ DisplayMessage( p_vout, _("Subtitle track: %s"),
+ _("N/A") );
+ var_FreeList( &list, &list2 );
+ break;
+ }
+ for( i_sel_index = 0; i_sel_index < i_count; i_sel_index++ )
+ {
+ if( i_sel_id == list.p_list->p_values[i_sel_index].i_int )
+ {
+ break;
+ }
+ }
+ /* if there is nothing to toggle choose the first track */
+ if( !i_sel_index ) {
+ i_sel_index = 1;
+ i_sel_id = list.p_list->p_values[1].i_int;
+ var_SetInteger( p_input, "spu-choice", i_sel_id );
+ }
+
+ i_new_index = 0;
+ if( i_old_id != i_sel_id )
+ {
+ if( i_sel_index >= i_count )
+ {
+ var_SetInteger( p_input, "spu-choice", list.p_list->p_values[0].i_int );
+ }
+ else
+ {
+ i_new_index = i_sel_index;
+ }
+ }
+ var_SetInteger( p_input, "spu-es", list.p_list->p_values[i_new_index].i_int );
+ DisplayMessage( p_vout, _("Subtitle track: %s"),
+ list2.p_list->p_values[i_new_index].psz_string );
+ var_FreeList( &list, &list2 );
+ }
+ break;
case ACTIONID_PROGRAM_SID_NEXT:
case ACTIONID_PROGRAM_SID_PREV:
if( p_input )