]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/alsa.c
PulseAudio: remove the base volume hack
[vlc] / modules / audio_output / alsa.c
index c285d5f04b6e2eb62879fa77083ba4a492d5bf8b..1aafeb646fda6aa1531e6cbaa0e1701d260e3c61 100644 (file)
@@ -327,7 +327,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     const char *device = sys->device;
     char *devbuf = NULL;
     /* Choose the IEC device for S/PDIF output */
-    if (spdif && !strcmp (device, "default"))
+    if (spdif)
     {
         unsigned aes3;
 
@@ -345,8 +345,23 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
                 break;
         }
 
+        char *opt = NULL;
+        if (!strcmp (device, "default"))
+            device = "iec958"; /* TODO: hdmi */
+        else
+        {
+            opt = strchr(device, ':');
+            if (opt && opt[1] == '\0') {
+                /* if device is terminated by : but there's no options,
+                 * remove ':', we'll add it back in the format string. */
+                *opt = '\0';
+                opt = NULL;
+            }
+        }
+
         if (asprintf (&devbuf,
-                      "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x",
+                      "%s%cAES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x", device,
+                      opt ? ',' : ':',
                       IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO,
                       IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
                       0, aes3) == -1)