3 * Copyright (C) 2011-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
24 #if defined(TARGET_DARWIN_OSX)
29 #include <CoreAudio/CoreAudio.h>
31 typedef std::vector<SInt32> CoreAudioChannelList;
32 typedef std::list<AudioChannelLayoutTag> AudioChannelLayoutList;
34 const AudioChannelLayoutTag g_LayoutMap[] =
36 kAudioChannelLayoutTag_Stereo, // PCM_LAYOUT_2_0 = 0,
37 kAudioChannelLayoutTag_Stereo, // PCM_LAYOUT_2_0 = 0,
38 kAudioChannelLayoutTag_DVD_4, // PCM_LAYOUT_2_1,
39 kAudioChannelLayoutTag_MPEG_3_0_A, // PCM_LAYOUT_3_0,
40 kAudioChannelLayoutTag_DVD_10, // PCM_LAYOUT_3_1,
41 kAudioChannelLayoutTag_DVD_3, // PCM_LAYOUT_4_0,
42 kAudioChannelLayoutTag_DVD_6, // PCM_LAYOUT_4_1,
43 kAudioChannelLayoutTag_MPEG_5_0_A, // PCM_LAYOUT_5_0,
44 kAudioChannelLayoutTag_MPEG_5_1_A, // PCM_LAYOUT_5_1,
45 kAudioChannelLayoutTag_AudioUnit_7_0, // PCM_LAYOUT_7_0, ** This layout may be incorrect...no content to testß˚ **
46 kAudioChannelLayoutTag_MPEG_7_1_A, // PCM_LAYOUT_7_1
49 const AudioChannelLabel g_LabelMap[] =
51 kAudioChannelLabel_Unused, // PCM_FRONT_LEFT,
52 kAudioChannelLabel_Left, // PCM_FRONT_LEFT,
53 kAudioChannelLabel_Right, // PCM_FRONT_RIGHT,
54 kAudioChannelLabel_Center, // PCM_FRONT_CENTER,
55 kAudioChannelLabel_LFEScreen, // PCM_LOW_FREQUENCY,
56 kAudioChannelLabel_LeftSurroundDirect, // PCM_BACK_LEFT, *** This is incorrect, but has been changed to match dvdplayer
57 kAudioChannelLabel_RightSurroundDirect, // PCM_BACK_RIGHT, *** This is incorrect, but has been changed to match dvdplayer
58 kAudioChannelLabel_LeftCenter, // PCM_FRONT_LEFT_OF_CENTER,
59 kAudioChannelLabel_RightCenter, // PCM_FRONT_RIGHT_OF_CENTER,
60 kAudioChannelLabel_CenterSurround, // PCM_BACK_CENTER,
61 kAudioChannelLabel_LeftSurround, // PCM_SIDE_LEFT, *** This is incorrect, but has been changed to match dvdplayer
62 kAudioChannelLabel_RightSurround, // PCM_SIDE_RIGHT, *** This is incorrect, but has been changed to match dvdplayer
63 kAudioChannelLabel_VerticalHeightLeft, // PCM_TOP_FRONT_LEFT,
64 kAudioChannelLabel_VerticalHeightRight, // PCM_TOP_FRONT_RIGHT,
65 kAudioChannelLabel_VerticalHeightCenter, // PCM_TOP_FRONT_CENTER,
66 kAudioChannelLabel_TopCenterSurround, // PCM_TOP_CENTER,
67 kAudioChannelLabel_TopBackLeft, // PCM_TOP_BACK_LEFT,
68 kAudioChannelLabel_TopBackRight, // PCM_TOP_BACK_RIGHT,
69 kAudioChannelLabel_TopBackCenter // PCM_TOP_BACK_CENTER
72 class CCoreAudioChannelLayout
75 CCoreAudioChannelLayout();
76 CCoreAudioChannelLayout(AudioChannelLayout &layout);
77 virtual ~CCoreAudioChannelLayout();
79 operator AudioChannelLayout*() {return m_pLayout;}
81 bool CopyLayout(AudioChannelLayout &layout);
82 static UInt32 GetChannelCountForLayout(AudioChannelLayout &layout);
83 static const char* ChannelLabelToString(UInt32 label);
84 static const char* ChannelLayoutToString(AudioChannelLayout &layout, std::string &str);
85 bool AllChannelUnknown();
87 AudioChannelLayout* m_pLayout;