[alsa-devel] Detecting if a pcm device is a digital or analog one

James Courtier-Dutton james.dutton at gmail.com
Fri Jun 25 18:55:12 CEST 2010

On 25 June 2010 09:21, Clemens Ladisch <clemens at ladisch.de> wrote:
> Jean-Yves Avenard wrote:
>> I was wondering if there was any way to accurately distinguish between
>> audio device, if it has an analog or a digital output.
> Not really.  There are devices where the same stream is routed to both
> analog and digital outputs, and sometimes the driver cannot know if
> there is a DAC further down the line.  In any case, this would be very
> hardware specific.
> What do you need this for?
My guess is that if one knew, one could decide if it was sensible to
send AC3 encoded data to the PCM or not.
Without knowing which PCM is sending data to which outputs, it would
be very difficult to accurately distinguish them.
Alsa does have a device name "iec958" that one can use instead of
"front" or "default" that will ensure the output goes to a digital
output if one exists.


More information about the Alsa-devel mailing list