+ // refresh if there arent devices
+ if( p_module_config->i_list < 2 && p_module_config->pf_update_list )
+ {
+ vlc_value_t val;
+ val.psz_string = strdup( p_module_config->value.psz );
+
+ p_module_config->pf_update_list(
+ VLC_OBJECT( p_instance->p_libvlc_int ), psz_config_name, val, val, NULL );
+ free( val.psz_string );
+ }
+ free( psz_config_name );
+
+ if( i_device >= 0 && i_device < p_module_config->i_list )
+ return strdup( p_module_config->ppsz_list[i_device] );
+
+ }
+
+ free( psz_config_name );
+ return NULL;
+}
+
+/*****************************
+ * Set device for using
+ *****************************/
+void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
+ const char *psz_audio_output,
+ const char *psz_device_id )
+{
+ char *psz_config_name;
+ if( !psz_audio_output || !psz_device_id )
+ return;
+ if( asprintf( &psz_config_name, "%s-audio-device", psz_audio_output ) == -1 )
+ return;
+ if( !var_Type( mp, psz_audio_output ) )
+ /* Don't recreate the same variable over and over and over... */
+ var_Create( mp, psz_audio_output, VLC_VAR_STRING );
+ var_SetString( mp, psz_config_name, psz_device_id );
+ free( psz_config_name );
+}
+
+/*****************************************************************************
+ * libvlc_audio_output_get_device_type : Get the current audio device type
+ *****************************************************************************/
+int libvlc_audio_output_get_device_type( libvlc_media_player_t *mp )
+{
+ aout_instance_t *p_aout = GetAOut( mp );
+ if( p_aout )
+ {
+ int i_device_type = var_GetInteger( p_aout, "audio-device" );
+ vlc_object_release( p_aout );
+ return i_device_type;