}
const char *device = sys->device;
- char *devbuf = NULL;
+
/* Choose the IEC device for S/PDIF output */
- if (spdif && !strcmp (device, "default"))
+ char sep = '\0';
+ if (spdif)
+ {
+ const char *opt;
+
+ if (!strcmp (device, "default"))
+ device = "iec958"; /* TODO: hdmi */
+
+ if (!strncmp (device, "iec958", 6))
+ opt = device + 6;
+ if (!strncmp (device, "hdmi", 4))
+ opt = device + 4;
+
+ if (opt != NULL)
+ switch (*opt)
+ {
+ case ':': sep = ','; break;
+ case '\0': sep = ':'; break;
+ }
+ }
+
+ char *devbuf = NULL;
+ if (sep != '\0')
{
unsigned aes3;
break;
}
- if (asprintf (&devbuf,
- "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x",
+ if (asprintf (&devbuf, "%s%cAES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x",
+ device, sep,
IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO,
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
0, aes3) == -1)