1 /*****************************************************************************
2 * alsa.c : alsa plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2001 the VideoLAN team
7 * Authors: Henri Fallon <henri@videolan.org> - Original Author
8 * Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
9 * John Paul Lorenti <jpl31@columbia.edu> - Device selection
10 * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> - S/PDIF and aout3
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
36 #include <vlc_common.h>
37 #include <vlc_plugin.h>
39 #include <errno.h> /* ENOMEM */
40 #include <vlc_dialog.h>
46 Note: we use the new API which is available since 0.9.0beta10a. */
47 #define ALSA_PCM_NEW_HW_PARAMS_API
48 #define ALSA_PCM_NEW_SW_PARAMS_API
49 #include <alsa/asoundlib.h>
50 #include <alsa/version.h>
52 /*#define ALSA_DEBUG*/
54 /*****************************************************************************
55 * aout_sys_t: ALSA audio output method descriptor
56 *****************************************************************************
57 * This structure is part of the audio output thread descriptor.
58 * It describes the ALSA specific properties of an audio device.
59 *****************************************************************************/
62 snd_pcm_t * p_snd_pcm;
63 unsigned int i_period_time;
66 snd_output_t * p_snd_stderr;
74 #define A52_FRAME_NB 1536
76 /* These values are in frames.
77 To convert them to a number of bytes you have to multiply them by the
78 number of channel(s) (eg. 2 for stereo) and the size of a sample (eg.
80 #define ALSA_DEFAULT_PERIOD_SIZE 1024
81 #define ALSA_DEFAULT_BUFFER_SIZE ( ALSA_DEFAULT_PERIOD_SIZE << 8 )
82 #define ALSA_SPDIF_PERIOD_SIZE A52_FRAME_NB
83 #define ALSA_SPDIF_BUFFER_SIZE ( ALSA_SPDIF_PERIOD_SIZE << 4 )
84 /* Why << 4 ? --Meuuh */
85 /* Why not ? --Bozo */
88 #define DEFAULT_ALSA_DEVICE "default"
90 /*****************************************************************************
92 *****************************************************************************/
93 static int Open ( vlc_object_t * );
94 static void Close ( vlc_object_t * );
95 static void Play ( aout_instance_t * );
96 static void* ALSAThread ( void * );
97 static void ALSAFill ( aout_instance_t * );
98 static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
99 vlc_value_t newval, vlc_value_t oldval, void *p_unused );
100 static void GetDevices( vlc_object_t *, module_config_t * );
102 /*****************************************************************************
104 *****************************************************************************/
105 static const char *const ppsz_devices[] = {
106 "default", "plug:front",
107 "plug:side", "plug:rear", "plug:center_lfe",
108 "plug:surround40", "plug:surround41",
109 "plug:surround50", "plug:surround51",
113 static const char *const ppsz_devices_text[] = {
114 N_("Default"), N_("Front speakers"),
115 N_("Side speakers"), N_("Rear speakers"), N_("Center and subwoofer"),
116 N_("Surround 4.0"), N_("Surround 4.1"),
117 N_("Surround 5.0"), N_("Surround 5.1"),
119 N_("HDMI"), N_("S/PDIF"),
122 set_shortname( "ALSA" )
123 set_description( N_("ALSA audio output") )
124 set_category( CAT_AUDIO )
125 set_subcategory( SUBCAT_AUDIO_AOUT )
126 add_string( "alsa-audio-device", DEFAULT_ALSA_DEVICE,
127 N_("ALSA Device Name"), NULL, false )
128 add_deprecated_alias( "alsadev" ) /* deprecated since 0.9.3 */
129 change_string_list( ppsz_devices, ppsz_devices_text, FindDevicesCallback )
130 change_action_add( FindDevicesCallback, N_("Refresh list") )
132 set_capability( "audio output", 150 )
133 set_callbacks( Open, Close )
136 /* VLC will insert a resampling filter in any case, so it is best to turn off
137 * ALSA (plug) resampling. */
138 static const int mode = SND_PCM_NO_AUTO_RESAMPLE
139 /* VLC is currently unable to leverage ALSA softvol. Disable it. */
140 | SND_PCM_NO_SOFTVOL;
143 * Initializes list of devices.
145 static void Probe (vlc_object_t *obj)
147 /* Due to design bug in audio output core, this hack is required: */
148 if (var_Type (obj, "audio-device"))
151 /* The variable does not exist - first call. */
154 var_Create (obj, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
155 text.psz_string = _("Audio Device");
156 var_Change (obj, "audio-device", VLC_VAR_SETTEXT, &text, NULL);
158 GetDevices (obj, NULL);
160 var_AddCallback (obj, "audio-device", aout_ChannelsRestart, NULL);
161 var_TriggerCallback (obj, "intf-change");
164 /*****************************************************************************
165 * Open: create a handle and open an alsa device
166 *****************************************************************************
167 * This function opens an alsa device, through the alsa API.
169 * Note: the only heap-allocated string is psz_device. All the other pointers
170 * are references to psz_device or to stack-allocated data.
171 *****************************************************************************/
172 static int Open (vlc_object_t *obj)
174 aout_instance_t * p_aout = (aout_instance_t *)obj;
176 /* Get device name */
179 if (var_Type (p_aout, "audio-device"))
180 psz_device = var_GetString (p_aout, "audio-device");
182 psz_device = var_InheritString( p_aout, "alsa-audio-device" );
183 if (unlikely(psz_device == NULL))
186 snd_pcm_format_t pcm_format; /* ALSA sample format */
187 vlc_fourcc_t fourcc = p_aout->output.output.i_format;
193 pcm_format = SND_PCM_FORMAT_FLOAT64_BE;
196 pcm_format = SND_PCM_FORMAT_FLOAT64_LE;
199 pcm_format = SND_PCM_FORMAT_FLOAT_BE;
202 pcm_format = SND_PCM_FORMAT_FLOAT_LE;
205 fourcc = VLC_CODEC_FL32;
206 pcm_format = SND_PCM_FORMAT_FLOAT;
209 pcm_format = SND_PCM_FORMAT_S32_BE;
212 pcm_format = SND_PCM_FORMAT_S32_LE;
215 pcm_format = SND_PCM_FORMAT_S24_3BE;
218 pcm_format = SND_PCM_FORMAT_S24_3LE;
221 pcm_format = SND_PCM_FORMAT_U24_3BE;
224 pcm_format = SND_PCM_FORMAT_U24_3LE;
227 pcm_format = SND_PCM_FORMAT_S16_BE;
230 pcm_format = SND_PCM_FORMAT_S16_LE;
233 pcm_format = SND_PCM_FORMAT_U16_BE;
236 pcm_format = SND_PCM_FORMAT_U16_LE;
239 pcm_format = SND_PCM_FORMAT_S8;
242 pcm_format = SND_PCM_FORMAT_U8;
245 if (AOUT_FMT_NON_LINEAR(&p_aout->output.output))
246 spdif = var_InheritBool (p_aout, "spdif");
249 fourcc = VLC_CODEC_FL32;
250 pcm_format = SND_PCM_FORMAT_FLOAT;
254 fourcc = VLC_CODEC_S16N;
255 pcm_format = SND_PCM_FORMAT_S16;
259 /* Choose the IEC device for S/PDIF output:
260 if the device is overridden by the user then it will be the one
261 otherwise we compute the default device based on the output format. */
262 if (spdif && !strcmp (psz_device, DEFAULT_ALSA_DEVICE))
266 switch (p_aout->output.output.i_rate)
269 case freq: aes3 = IEC958_AES3_CON_FS_ ## freq; break;
270 FS( 44100) /* def. */ FS( 48000) FS( 32000)
271 FS( 22050) FS( 24000)
272 FS( 88200) FS(768000) FS( 96000)
273 FS(176400) FS(192000)
276 aes3 = IEC958_AES3_CON_FS_NOTID;
281 if (asprintf (&psz_device,
282 "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x",
283 IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO,
284 IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
289 /* Allocate structures */
290 aout_sys_t *p_sys = malloc (sizeof (*p_sys));
291 if (unlikely(p_sys == NULL))
296 p_aout->output.p_sys = p_sys;
299 snd_output_stdio_attach( &p_sys->p_snd_stderr, stderr, 0 );
302 /* Open the device */
303 msg_Dbg( p_aout, "opening ALSA device `%s'", psz_device );
304 int val = snd_pcm_open (&p_sys->p_snd_pcm, psz_device,
305 SND_PCM_STREAM_PLAYBACK, mode);
306 #if (SND_LIB_VERSION <= 0x010015)
307 # warning Please update alsa-lib to version > 1.0.21a.
308 var_Create (p_aout->p_libvlc, "alsa-working", VLC_VAR_BOOL);
309 if (val != 0 && var_GetBool (p_aout->p_libvlc, "alsa-working"))
310 dialog_Fatal (p_aout, "ALSA version problem",
311 "VLC failed to re-initialize your audio output device.\n"
312 "Please update alsa-lib to version 1.0.22 or higher "
313 "to fix this issue.");
314 var_SetBool (p_aout->p_libvlc, "alsa-working", !val);
318 #if (SND_LIB_VERSION <= 0x010017)
319 # warning Please update alsa-lib to version > 1.0.23.
320 var_Create (p_aout->p_libvlc, "alsa-broken", VLC_VAR_BOOL);
321 if (!var_GetBool (p_aout->p_libvlc, "alsa-broken"))
323 var_SetBool (p_aout->p_libvlc, "alsa-broken", true);
324 dialog_Fatal (p_aout, "Potential ALSA version problem",
325 "VLC failed to initialize your audio output device (if any).\n"
326 "Please update alsa-lib to version 1.0.24 or higher "
327 "to try to fix this issue.");
330 msg_Err (p_aout, "cannot open ALSA device `%s' (%s)",
331 psz_device, snd_strerror (val));
332 dialog_Fatal (p_aout, _("Audio output failed"),
333 _("The audio device \"%s\" could not be used:\n%s."),
334 psz_device, snd_strerror (val));
341 snd_pcm_uframes_t i_buffer_size;
342 snd_pcm_uframes_t i_period_size;
347 fourcc = VLC_CODEC_SPDIFL;
348 i_buffer_size = ALSA_SPDIF_BUFFER_SIZE;
349 pcm_format = SND_PCM_FORMAT_S16;
352 p_aout->output.i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE;
353 p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
354 p_aout->output.output.i_frame_length = A52_FRAME_NB;
356 aout_VolumeNoneInit( p_aout );
360 i_buffer_size = ALSA_DEFAULT_BUFFER_SIZE;
361 i_channels = aout_FormatNbChannels( &p_aout->output.output );
363 p_aout->output.i_nb_samples = i_period_size = ALSA_DEFAULT_PERIOD_SIZE;
365 aout_VolumeSoftInit( p_aout );
368 p_aout->output.pf_play = Play;
370 snd_pcm_hw_params_t *p_hw;
371 snd_pcm_sw_params_t *p_sw;
373 snd_pcm_hw_params_alloca(&p_hw);
374 snd_pcm_sw_params_alloca(&p_sw);
376 /* Get Initial hardware parameters */
377 val = snd_pcm_hw_params_any( p_sys->p_snd_pcm, p_hw );
380 msg_Err( p_aout, "unable to retrieve hardware parameters (%s)",
381 snd_strerror( val ) );
386 val = snd_pcm_hw_params_set_format (p_sys->p_snd_pcm, p_hw, pcm_format);
389 msg_Err (p_aout, "cannot set sample format: %s", snd_strerror (val));
393 p_aout->output.output.i_format = fourcc;
395 val = snd_pcm_hw_params_set_access( p_sys->p_snd_pcm, p_hw,
396 SND_PCM_ACCESS_RW_INTERLEAVED );
399 msg_Err( p_aout, "unable to set interleaved stream format (%s)",
400 snd_strerror( val ) );
405 val = snd_pcm_hw_params_set_channels( p_sys->p_snd_pcm, p_hw, i_channels );
408 msg_Err( p_aout, "unable to set number of output channels (%s)",
409 snd_strerror( val ) );
414 unsigned old_rate = p_aout->output.output.i_rate;
415 val = snd_pcm_hw_params_set_rate_near (p_sys->p_snd_pcm, p_hw,
416 &p_aout->output.output.i_rate,
420 msg_Err (p_aout, "unable to set sampling rate (%s)",
424 if (p_aout->output.output.i_rate != old_rate)
425 msg_Warn (p_aout, "resampling from %d Hz to %d Hz", old_rate,
426 p_aout->output.output.i_rate);
428 /* Set period size. */
429 val = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, p_hw,
430 &i_period_size, NULL );
433 msg_Err( p_aout, "unable to set period size (%s)",
434 snd_strerror( val ) );
437 p_aout->output.i_nb_samples = i_period_size;
439 /* Set buffer size. */
440 val = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, p_hw,
444 msg_Err( p_aout, "unable to set buffer size (%s)",
445 snd_strerror( val ) );
449 /* Commit hardware parameters. */
450 val = snd_pcm_hw_params( p_sys->p_snd_pcm, p_hw );
453 msg_Err( p_aout, "unable to commit hardware configuration (%s)",
454 snd_strerror( val ) );
458 val = snd_pcm_hw_params_get_period_time( p_hw, &p_sys->i_period_time,
462 msg_Err( p_aout, "unable to get period time (%s)",
463 snd_strerror( val ) );
467 /* Get Initial software parameters */
468 snd_pcm_sw_params_current( p_sys->p_snd_pcm, p_sw );
470 snd_pcm_sw_params_set_avail_min( p_sys->p_snd_pcm, p_sw,
471 p_aout->output.i_nb_samples );
472 /* start playing when one period has been written */
473 val = snd_pcm_sw_params_set_start_threshold( p_sys->p_snd_pcm, p_sw,
474 ALSA_DEFAULT_PERIOD_SIZE);
477 msg_Err( p_aout, "unable to set start threshold (%s)",
478 snd_strerror( val ) );
482 /* Commit software parameters. */
483 if ( snd_pcm_sw_params( p_sys->p_snd_pcm, p_sw ) < 0 )
485 msg_Err( p_aout, "unable to set software configuration" );
490 snd_output_printf( p_sys->p_snd_stderr, "\nALSA hardware setup:\n\n" );
491 snd_pcm_dump_hw_setup( p_sys->p_snd_pcm, p_sys->p_snd_stderr );
492 snd_output_printf( p_sys->p_snd_stderr, "\nALSA software setup:\n\n" );
493 snd_pcm_dump_sw_setup( p_sys->p_snd_pcm, p_sys->p_snd_stderr );
494 snd_output_printf( p_sys->p_snd_stderr, "\n" );
497 p_sys->start_date = 0;
498 vlc_sem_init( &p_sys->wait, 0 );
500 /* Create ALSA thread and wait for its readiness. */
501 if( vlc_clone( &p_sys->thread, ALSAThread, p_aout,
502 VLC_THREAD_PRIORITY_OUTPUT ) )
504 msg_Err( p_aout, "cannot create ALSA thread (%m)" );
505 vlc_sem_destroy( &p_sys->wait );
513 snd_pcm_close( p_sys->p_snd_pcm );
515 snd_output_close( p_sys->p_snd_stderr );
521 static void PlayIgnore( aout_instance_t *p_aout )
522 { /* Already playing - nothing to do */
526 /*****************************************************************************
527 * Play: start playback
528 *****************************************************************************/
529 static void Play( aout_instance_t *p_aout )
531 p_aout->output.pf_play = PlayIgnore;
533 /* get the playing date of the first aout buffer */
534 p_aout->output.p_sys->start_date =
535 aout_FifoFirstDate( p_aout, &p_aout->output.fifo );
537 /* wake up the audio output thread */
538 sem_post( &p_aout->output.p_sys->wait );
541 /*****************************************************************************
542 * Close: close the ALSA device
543 *****************************************************************************/
544 static void Close (vlc_object_t *obj)
546 aout_instance_t *p_aout = (aout_instance_t *)obj;
547 struct aout_sys_t * p_sys = p_aout->output.p_sys;
549 /* Make sure that the thread will stop once it is waken up */
550 vlc_cancel( p_sys->thread );
551 vlc_join( p_sys->thread, NULL );
552 vlc_sem_destroy( &p_sys->wait );
554 snd_pcm_drop( p_sys->p_snd_pcm );
555 snd_pcm_close( p_sys->p_snd_pcm );
557 snd_output_close( p_sys->p_snd_stderr );
562 /*****************************************************************************
563 * ALSAThread: asynchronous thread used to DMA the data to the device
564 *****************************************************************************/
565 static void* ALSAThread( void *data )
567 aout_instance_t * p_aout = data;
568 struct aout_sys_t * p_sys = p_aout->output.p_sys;
570 /* Wait for the exact time to start playing (avoids resampling) */
571 vlc_sem_wait( &p_sys->wait );
572 mwait( p_sys->start_date - AOUT_PTS_TOLERANCE / 4 );
580 /*****************************************************************************
581 * ALSAFill: function used to fill the ALSA buffer as much as possible
582 *****************************************************************************/
583 static void ALSAFill( aout_instance_t * p_aout )
585 struct aout_sys_t * p_sys = p_aout->output.p_sys;
586 snd_pcm_t *p_pcm = p_sys->p_snd_pcm;
587 snd_pcm_status_t * p_status;
591 int canc = vlc_savecancel();
592 /* Fill in the buffer until space or audio output buffer shortage */
595 snd_pcm_status_alloca(&p_status);
596 i_snd_rc = snd_pcm_status( p_pcm, p_status );
599 msg_Err( p_aout, "cannot get device status" );
603 /* Handle buffer underruns and get the status again */
604 if( snd_pcm_status_get_state( p_status ) == SND_PCM_STATE_XRUN )
606 /* Prepare the device */
607 i_snd_rc = snd_pcm_prepare( p_pcm );
610 msg_Err( p_aout, "cannot recover from buffer underrun" );
614 msg_Dbg( p_aout, "recovered from buffer underrun" );
616 /* Get the new status */
617 i_snd_rc = snd_pcm_status( p_pcm, p_status );
620 msg_Err( p_aout, "cannot get device status after recovery" );
624 /* Underrun, try to recover as quickly as possible */
629 /* Here the device should be in RUNNING state, p_status is valid. */
630 snd_pcm_sframes_t delay = snd_pcm_status_get_delay( p_status );
631 if( delay == 0 ) /* workaround buggy alsa drivers */
632 if( snd_pcm_delay( p_pcm, &delay ) < 0 )
633 delay = 0; /* FIXME: use a positive minimal delay */
635 size_t i_bytes = snd_pcm_frames_to_bytes( p_pcm, delay );
636 mtime_t delay_us = CLOCK_FREQ * i_bytes
637 / p_aout->output.output.i_bytes_per_frame
638 / p_aout->output.output.i_rate
639 * p_aout->output.output.i_frame_length;
642 snd_pcm_state_t state = snd_pcm_status_get_state( p_status );
643 if( state != SND_PCM_STATE_RUNNING )
644 msg_Err( p_aout, "pcm status (%d) != RUNNING", state );
646 msg_Dbg( p_aout, "Delay is %ld frames (%zu bytes)", delay, i_bytes );
648 msg_Dbg( p_aout, "Bytes per frame: %d", p_aout->output.output.i_bytes_per_frame );
649 msg_Dbg( p_aout, "Rate: %d", p_aout->output.output.i_rate );
650 msg_Dbg( p_aout, "Frame length: %d", p_aout->output.output.i_frame_length );
651 msg_Dbg( p_aout, "Next date: in %"PRId64" microseconds", delay_us );
653 next_date = mdate() + delay_us;
656 block_t *p_buffer = aout_OutputNextBuffer( p_aout, next_date,
657 (p_aout->output.output.i_format == VLC_CODEC_SPDIFL) );
659 /* Audio output buffer shortage -> stop the fill process and wait */
660 if( p_buffer == NULL )
663 block_cleanup_push( p_buffer );
666 int n = snd_pcm_poll_descriptors_count(p_pcm);
667 struct pollfd ufd[n];
668 unsigned short revents;
670 snd_pcm_poll_descriptors(p_pcm, ufd, n);
673 vlc_restorecancel(canc);
675 canc = vlc_savecancel();
676 snd_pcm_poll_descriptors_revents(p_pcm, ufd, n, &revents);
680 if(revents & POLLOUT)
682 i_snd_rc = snd_pcm_writei( p_pcm, p_buffer->p_buffer,
683 p_buffer->i_nb_samples );
684 if( i_snd_rc != -ESTRPIPE )
688 /* a suspend event occurred
689 * (stream is suspended and waiting for an application recovery) */
690 msg_Dbg( p_aout, "entering in suspend mode, trying to resume..." );
692 while( ( i_snd_rc = snd_pcm_resume( p_pcm ) ) == -EAGAIN )
694 vlc_restorecancel(canc);
695 msleep(CLOCK_FREQ); /* device still suspended, wait... */
696 canc = vlc_savecancel();
700 /* Device does not support resuming, restart it */
701 i_snd_rc = snd_pcm_prepare( p_pcm );
706 msg_Err( p_aout, "cannot write: %s", snd_strerror( i_snd_rc ) );
708 vlc_restorecancel(canc);
714 msg_Err( p_aout, "ALSA error: %s", snd_strerror( i_snd_rc ) );
716 vlc_restorecancel(canc);
717 msleep(p_sys->i_period_time / 2);
720 /*****************************************************************************
721 * config variable callback
722 *****************************************************************************/
723 static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
724 vlc_value_t newval, vlc_value_t oldval, void *p_unused )
726 module_config_t *p_item;
731 p_item = config_FindConfig( p_this, psz_name );
732 if( !p_item ) return VLC_SUCCESS;
734 /* Clear-up the current list */
739 /* Keep the first entrie */
740 for( i = 1; i < p_item->i_list; i++ )
742 free( (char *)p_item->ppsz_list[i] );
743 free( (char *)p_item->ppsz_list_text[i] );
745 /* TODO: Remove when no more needed */
746 p_item->ppsz_list[i] = NULL;
747 p_item->ppsz_list_text[i] = NULL;
751 GetDevices( p_this, p_item );
753 /* Signal change to the interface */
754 p_item->b_dirty = true;
760 static void GetDevices (vlc_object_t *obj, module_config_t *item)
764 msg_Dbg(obj, "Available ALSA PCM devices:");
766 if (snd_device_name_hint(-1, "pcm", &hints) < 0)
769 for (size_t i = 0; hints[i] != NULL; i++)
771 void *hint = hints[i];
774 char *name = snd_device_name_get_hint(hint, "NAME");
775 if (unlikely(name == NULL))
777 if (unlikely(asprintf (&dev, "plug:'%s'", name) == -1))
783 char *desc = snd_device_name_get_hint(hint, "DESC");
785 for (char *lf = strchr(desc, '\n'); lf; lf = strchr(lf, '\n'))
787 msg_Dbg(obj, " %s (%s)", (desc != NULL) ? desc : name, name);
791 item->ppsz_list = xrealloc(item->ppsz_list,
792 (item->i_list + 2) * sizeof(char *));
793 item->ppsz_list_text = xrealloc(item->ppsz_list_text,
794 (item->i_list + 2) * sizeof(char *));
795 item->ppsz_list[item->i_list] = dev;
798 item->ppsz_list_text[item->i_list] = desc;
803 vlc_value_t val, text;
805 val.psz_string = dev;
806 text.psz_string = desc;
807 var_Change(obj, "audio-device", VLC_VAR_ADDCHOICE, &val, &text);
814 snd_device_name_free_hint(hints);
818 item->ppsz_list[item->i_list] = NULL;
819 item->ppsz_list_text[item->i_list] = NULL;