Skip to content

Commit

Permalink
Merge pull request #5935 from Memphiz/osxallowsixteenunknownchannels
Browse files Browse the repository at this point in the history
[osx] - fix broken audio devices with more then 8 unknown channels in one stream
  • Loading branch information
topfs2 committed Dec 13, 2014
2 parents 3471cb9 + f5e68fd commit b024c3c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
14 changes: 11 additions & 3 deletions xbmc/cores/AudioEngine/Sinks/osx/AEDeviceEnumerationOSX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <sstream>

#define CA_MAX_CHANNELS 16
#define CA_MAX_CHANNELS 24
// default channel map - in case it can't be fetched from the device
static enum AEChannel CAChannelMap[CA_MAX_CHANNELS + 1] = {
AE_CH_FL , AE_CH_FR , AE_CH_BL , AE_CH_BR , AE_CH_FC , AE_CH_LFE , AE_CH_SL , AE_CH_SR ,
Expand All @@ -39,6 +39,14 @@ static enum AEChannel CAChannelMap[CA_MAX_CHANNELS + 1] = {
AE_CH_UNKNOWN6 ,
AE_CH_UNKNOWN7 ,
AE_CH_UNKNOWN8 ,
AE_CH_UNKNOWN9 ,
AE_CH_UNKNOWN10 ,
AE_CH_UNKNOWN11 ,
AE_CH_UNKNOWN12 ,
AE_CH_UNKNOWN13 ,
AE_CH_UNKNOWN14 ,
AE_CH_UNKNOWN15 ,
AE_CH_UNKNOWN16 ,
AE_CH_NULL
};

Expand Down Expand Up @@ -666,7 +674,7 @@ enum AEChannel AEDeviceEnumerationOSX::caChannelToAEChannel(const AudioChannelLa
default:
ret = (enum AEChannel)unknownChannel++;
}
if (unknownChannel > AE_CH_UNKNOWN8)
if (unknownChannel > AE_CH_UNKNOWN16)
unknownChannel = AE_CH_UNKNOWN1;

return ret;
Expand All @@ -684,7 +692,7 @@ void AEDeviceEnumerationOSX::GetAEChannelMap(CAEChannelInfo &channelMap, unsigne
CCoreAudioChannelLayout calayout;
bool logMapping = channelMap.Count() > 0; // only log if the engine requests a layout during init
bool mapAvailable = false;
unsigned int numberChannelsInDeviceLayout = CA_MAX_CHANNELS; // default 8 channels from CAChannelMap
unsigned int numberChannelsInDeviceLayout = CA_MAX_CHANNELS; // default number of channels from CAChannelMap
AudioChannelLayout *layout = NULL;

// try to fetch either the multichannel or the stereo channel layout from the device
Expand Down
8 changes: 8 additions & 0 deletions xbmc/cores/AudioEngine/Utils/AEChannelData.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ enum AEChannel
AE_CH_UNKNOWN6,
AE_CH_UNKNOWN7,
AE_CH_UNKNOWN8,
AE_CH_UNKNOWN9,
AE_CH_UNKNOWN10,
AE_CH_UNKNOWN11,
AE_CH_UNKNOWN12,
AE_CH_UNKNOWN13,
AE_CH_UNKNOWN14,
AE_CH_UNKNOWN15,
AE_CH_UNKNOWN16,

AE_CH_MAX
};
Expand Down
10 changes: 9 additions & 1 deletion xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,15 @@ const char* CAEChannelInfo::GetChName(const enum AEChannel ch)
"UNKNOWN5",
"UNKNOWN6",
"UNKNOWN7",
"UNKNOWN8"
"UNKNOWN8",
"UNKNOWN9",
"UNKNOWN10",
"UNKNOWN11",
"UNKNOWN12",
"UNKNOWN13",
"UNKNOWN14",
"UNKNOWN15",
"UNKNOWN16"
};

return channels[ch];
Expand Down

0 comments on commit b024c3c

Please sign in to comment.