Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[AE] fixed: allow ALSA passthrough with non-native data format

The ALSA sink currently only tries SND_PCM_FORMAT_S16 for passthrough.
However, the non-native endianness format is not tried. The most common
case when this is needed is big-endian systems that commonly have an
ALSA device that still takes in S16_LE.

Fix that by trying both formats for passthrough if SND_PCM_FORMAT_S16
fails.
  • Loading branch information...
commit cd3fa45cc70a8b51b3591399a2430ba096899f53 1 parent 9df032a
@anssih authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
View
8 xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -193,13 +193,15 @@ bool CAESinkALSA::IsCompatible(const AEAudioFormat format, const std::string dev
snd_pcm_format_t CAESinkALSA::AEFormatToALSAFormat(const enum AEDataFormat format)
{
if (AE_IS_RAW(format))
- return SND_PCM_FORMAT_S16_LE;
+ return SND_PCM_FORMAT_S16;
switch (format)
{
case AE_FMT_S8 : return SND_PCM_FORMAT_S8;
case AE_FMT_U8 : return SND_PCM_FORMAT_U8;
case AE_FMT_S16NE : return SND_PCM_FORMAT_S16;
+ case AE_FMT_S16LE : return SND_PCM_FORMAT_S16_LE;
+ case AE_FMT_S16BE : return SND_PCM_FORMAT_S16_BE;
case AE_FMT_S24NE4: return SND_PCM_FORMAT_S24;
#ifdef __BIG_ENDIAN__
case AE_FMT_S24NE3: return SND_PCM_FORMAT_S24_3BE;
@@ -258,6 +260,10 @@ bool CAESinkALSA::InitializeHW(AEAudioFormat &format)
{
if (AE_IS_RAW(i) || i == AE_FMT_MAX)
continue;
+
+ if (m_passthrough && i != AE_FMT_S16BE && i != AE_FMT_S16LE)
+ continue;
+
fmt = AEFormatToALSAFormat(i);
if (fmt == SND_PCM_FORMAT_UNKNOWN || snd_pcm_hw_params_set_format(m_pcm, hw_params, fmt) < 0)
Please sign in to comment.
Something went wrong with that request. Please try again.