Skip to content

libvlc_audio_output_device_list_get not returning devices

With LibVLC 3.x the libvlc_audio_output_device_list_get API call returns a device list:

  # Name         Description                              Devices                                  Long Name
  = ====         ===========                              =======                                  =========
  1 pulse        Pulseaudio audio output                  (0)                                      
  2 amem         Audio memory output                      (0)                                      
  3 sndio        OpenBSD sndio audio output               (0)                                      
  4 afile        File audio output                        (0)                                      
  5 adummy       Dummy audio output                       (0)                                      
  6 alsa         ALSA audio output                        (86)                                     
                                                          default                                  Playback/recording through the PulseAudio sound server
                                                          surround21                               2.1 Surround output to Front and Subwoofer speakers
                                                          surround40                               4.0 Surround output to Front and Rear speakers
                                                          surround41                               4.1 Surround output to Front, Rear and Subwoofer speakers
                                                          surround50                               5.0 Surround output to Front, Center and Rear speakers
                                                          surround51                               5.1 Surround output to Front, Center, Rear and Subwoofer speakers
                                                          surround71                               7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
                                                          null                                     Discard all samples (playback) or generate zero samples (capture)
                                                          samplerate                               Rate Converter Plugin Using Samplerate Library
                                                          speexrate                                Rate Converter Plugin Using Speex Resampler
                                                          [...cut a lot of devices here...]
  7 jack         JACK audio output                        (0)                                      

With LibVLC 4.x the same API call does not return those devices:

  # Name         Description                              Devices                                  Long Name
  = ====         ===========                              =======                                  =========
  1 pulse        Pulseaudio audio output                  (0)                                      
  2 amem         Audio memory output                      (0)                                      
  3 sndio        OpenBSD sndio audio output               (0)                                      
  4 afile        File audio output                        (0)                                      
  5 adummy       Dummy audio output                       (0)                                      
  6 alsa         ALSA audio output                        (0)                                      
  7 jack         JACK audio output                        (0)                                      

In lib/audio.c:

libvlc_audio_output_device_t *
libvlc_audio_output_device_list_get( libvlc_instance_t *p_instance,
                                     const char *aout )
{
    char varname[32];
    if( (size_t)snprintf( varname, sizeof(varname), "%s-audio-device", aout )
                                                           >= sizeof(varname) )
        return NULL;

    if( config_GetType(varname) != VLC_VAR_STRING )
        return NULL;

    libvlc_audio_output_device_t *list = NULL, **pp = &list;
    char **values, **texts;
    ssize_t count = config_GetPszChoices( varname, &values, &texts ); <--- count is zero
    for( ssize_t i = 0; i < count; i++ )
    {
        libvlc_audio_output_device_t *item = malloc( sizeof(*item) );
        if( unlikely(item == NULL) )
            break;

        *pp = item;
        pp = &item->p_next;
        item->psz_device = values[i];
        item->psz_description = texts[i];
    }

    *pp = NULL;
    free( texts );
    free( values );
    (void) p_instance;
    return list;
}

The count is seemingly zero here:

ssize_t count = config_GetPszChoices( varname, &values, &texts ); <--- count is zero

My platform is 64-bit Linux.

I am always pretty much up to date with latest vlc master, for this issue I'm at commit bce57ed7 which is the latest commit as of the time of creating this issue.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information