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

hotkeys: adapt to new device selection

parent 429b94d0
...@@ -319,48 +319,28 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) ...@@ -319,48 +319,28 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
if( p_aout == NULL ) if( p_aout == NULL )
break; break;
vlc_value_t val, list, list2; vlc_value_t val, ids, names;
int i_count, i;
var_Get( p_aout, "audio-device", &val ); var_Get( p_aout, "device", &val );
var_Change( p_aout, "audio-device", VLC_VAR_GETCHOICES, var_Change( p_aout, "device", VLC_VAR_GETCHOICES, &ids, &names );
&list, &list2 );
i_count = list.p_list->i_count;
if( i_count > 1 ) for( int i = 0; i < ids.p_list->i_count; i++ )
{ {
for( i = 0; i < i_count; i++ ) if( !strcmp(val.psz_string,
{ ids.p_list->p_values[i].psz_string) )
if( val.i_int == list.p_list->p_values[i].i_int )
{
break;
}
}
if( i == i_count )
{ {
msg_Warn( p_aout, int j = i + 1;
"invalid current audio device, selecting 0" ); if( j >= ids.p_list->i_count )
var_Set( p_aout, "audio-device", j = 0;
list.p_list->p_values[0] );
i = 0; DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
} _("Audio Device: %s"),
else if( i == i_count -1 ) names.p_list->p_values[j].psz_string);
{ var_Set( p_aout, "device", ids.p_list->p_values[j] );
var_Set( p_aout, "audio-device", break;
list.p_list->p_values[0] );
i = 0;
}
else
{
var_Set( p_aout, "audio-device",
list.p_list->p_values[i+1] );
i++;
} }
DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
_("Audio Device: %s"),
list2.p_list->p_values[i].psz_string);
} }
var_FreeList( &list, &list2 ); var_FreeList( &ids, &names );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
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