xbmc/xbmc — pull request #1512 by anssih (2012-09-30 18:28:54+00:00)
Title: [AE] drop AE_FMT_LPCM from non-CoreAudio builds

While looking at AudioEngine I got confused by AE_FMT_LPCM and what it is used for. Turns out it actually seems to only be used as a hack on CoreAudio to enable a "hog" mode needed for multichannel (for some reason this is used instead of looking directly at the channel count).

To avoid future confusion, this will make AE_FMT_LPCM depend on TARGET_DARWIN. I guess one other alternative would be to simply rename it to something that clearly indicates its purpose.

Detailed commit message below:

AE has a separate AEDataFormat AE_FMT_LPCM for multichannel PCM audio.
However, the data content is actually the same as AE_FMT_FLOAT, and
AE_FMT_LPCM is only used by CoreAudioAE.

CoreAudio uses the AE_FMT_FLOAT <=> AE_FMT_LPCM differentation to enter
a special "hog" mode, which is reportedly needed for multichannel HDMI
playback on CoreAudio. AE_FMT_LPCM mode is entered on CoreAudio systems
instead of AE_FMT_FLOAT (or other regular modes) when the multichannel
LPCM playback option is enabled in audio settings and the output device
type is HDMI.

Since AE_FMT_LPCM has no meaning outside CoreAudio, clearly mark it as
CoreAudio specific by making it conditional on TARGET_DARWIN, to avoid
confusion regarding the actual use case of that format type.

AE_FMT_LPCM is currently also added in device enumeration to
m_dataFormats on ALSA devices when the HDMI sink EDID contains a Short
Audio Descriptor with audio code 1 (LPCM). However, that makes no sense,
since the audio code simply means that the device accepts PCM input,
which all HDMI audio devices have to (obviously) support according to
the specification. Also, AESinkWASAPI adds AE_FMT_LPCM to m_dataFormats
for devices with 4+ channels, which is pointless as there is a separate
m_channelLayout member in AEAudioFormat for this purpose.
Both of these can be safely removed since m_dataFormats is used for
debug log purposes only (any actual users should use m_channelLayout
instead, which works with all sinks).

In the future CoreAudio could probably be changed to enter hog mode
based on the stream channel count directly, in order to avoid having a
special CoreAudio-specific format and related code in general
AudioEngine part.