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

hotkeys: use aout_DeviceGet() and aout_DevicesList()

parent d7dd7e50
...@@ -319,27 +319,34 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) ...@@ -319,27 +319,34 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
if( p_aout == NULL ) if( p_aout == NULL )
break; break;
char *dev = var_GetNonEmptyString( p_aout, "device" ); char **ids, **names;
const char *devstr = (dev != NULL) ? dev : ""; int n = aout_DevicesList( p_aout, &ids, &names );
if( n == -1 )
break;
vlc_value_t ids, names; char *dev = aout_DeviceGet( p_aout );
var_Change( p_aout, "device", VLC_VAR_GETCHOICES, &ids, &names ); const char *devstr = (dev != NULL) ? dev : "";
int i = 0; int idx = 0;
for( i = 0; i < ids.p_list->i_count; i++ ) for( int i = 0; i < n; i++ )
if( !strcmp(devstr, ids.p_list->p_values[i].psz_string) ) {
break; if( !strcmp(devstr, ids[i]) )
idx = (i + 1) % n;
}
free( dev ); free( dev );
i++; if( !aout_DeviceSet( p_aout, ids[idx] ) )
if( i >= ids.p_list->i_count )
i = 0;
if( !aout_DeviceSet( p_aout, ids.p_list->p_values[i].psz_string ) )
DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
_("Audio Device: %s"), _("Audio Device: %s"), names[idx] );
names.p_list->p_values[i].psz_string);
var_FreeList( &ids, &names );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
for( int i = 0; i < n; i++ )
{
free( ids[i] );
free( names[i] );
}
free( ids );
free( names );
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