File: CoreAudioChannelLayout.h

package info (click to toggle)
kodi 2%3A20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 143,820 kB
  • sloc: cpp: 664,925; xml: 68,398; ansic: 37,223; python: 6,903; sh: 4,209; javascript: 2,325; makefile: 1,754; perl: 969; java: 513; cs: 390; objc: 340
file content (75 lines) | stat: -rw-r--r-- 3,428 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 *  Copyright (C) 2011-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include <list>
#include <string>
#include <vector>

#include <CoreAudio/CoreAudio.h>

typedef std::vector<SInt32> CoreAudioChannelList;
typedef std::list<AudioChannelLayoutTag> AudioChannelLayoutList;

const AudioChannelLayoutTag g_LayoutMap[] =
{
  kAudioChannelLayoutTag_Stereo,            // PCM_LAYOUT_2_0 = 0,
  kAudioChannelLayoutTag_Stereo,            // PCM_LAYOUT_2_0 = 0,
  kAudioChannelLayoutTag_DVD_4,             // PCM_LAYOUT_2_1,
  kAudioChannelLayoutTag_MPEG_3_0_A,        // PCM_LAYOUT_3_0,
  kAudioChannelLayoutTag_DVD_10,            // PCM_LAYOUT_3_1,
  kAudioChannelLayoutTag_DVD_3,             // PCM_LAYOUT_4_0,
  kAudioChannelLayoutTag_DVD_6,             // PCM_LAYOUT_4_1,
  kAudioChannelLayoutTag_MPEG_5_0_A,        // PCM_LAYOUT_5_0,
  kAudioChannelLayoutTag_MPEG_5_1_A,        // PCM_LAYOUT_5_1,
  kAudioChannelLayoutTag_AudioUnit_7_0,     // PCM_LAYOUT_7_0, ** This layout may be incorrect...no content to testß˚ **
  kAudioChannelLayoutTag_MPEG_7_1_A,        // PCM_LAYOUT_7_1
};

const AudioChannelLabel g_LabelMap[] =
{
  kAudioChannelLabel_Unused,                // PCM_FRONT_LEFT,
  kAudioChannelLabel_Left,                  // PCM_FRONT_LEFT,
  kAudioChannelLabel_Right,                 // PCM_FRONT_RIGHT,
  kAudioChannelLabel_Center,                // PCM_FRONT_CENTER,
  kAudioChannelLabel_LFEScreen,             // PCM_LOW_FREQUENCY,
  kAudioChannelLabel_LeftSurroundDirect,    // PCM_BACK_LEFT, *** This is incorrect, but has been changed to match VideoPlayer
  kAudioChannelLabel_RightSurroundDirect,   // PCM_BACK_RIGHT, *** This is incorrect, but has been changed to match VideoPlayer
  kAudioChannelLabel_LeftCenter,            // PCM_FRONT_LEFT_OF_CENTER,
  kAudioChannelLabel_RightCenter,           // PCM_FRONT_RIGHT_OF_CENTER,
  kAudioChannelLabel_CenterSurround,        // PCM_BACK_CENTER,
  kAudioChannelLabel_LeftSurround,          // PCM_SIDE_LEFT, *** This is incorrect, but has been changed to match VideoPlayer
  kAudioChannelLabel_RightSurround,         // PCM_SIDE_RIGHT, *** This is incorrect, but has been changed to match VideoPlayer
  kAudioChannelLabel_VerticalHeightLeft,    // PCM_TOP_FRONT_LEFT,
  kAudioChannelLabel_VerticalHeightRight,   // PCM_TOP_FRONT_RIGHT,
  kAudioChannelLabel_VerticalHeightCenter,  // PCM_TOP_FRONT_CENTER,
  kAudioChannelLabel_TopCenterSurround,     // PCM_TOP_CENTER,
  kAudioChannelLabel_TopBackLeft,           // PCM_TOP_BACK_LEFT,
  kAudioChannelLabel_TopBackRight,          // PCM_TOP_BACK_RIGHT,
  kAudioChannelLabel_TopBackCenter          // PCM_TOP_BACK_CENTER
};

class CCoreAudioChannelLayout
{
public:
  CCoreAudioChannelLayout();
  CCoreAudioChannelLayout(AudioChannelLayout &layout);
  virtual ~CCoreAudioChannelLayout();

  operator AudioChannelLayout*() {return m_pLayout;}

  bool                CopyLayout(AudioChannelLayout &layout);
  bool                CopyLayoutForStereo(UInt32 layout[2]);
  static UInt32       GetChannelCountForLayout(AudioChannelLayout &layout);
  static const char*  ChannelLabelToString(UInt32 label);
  static const char*  ChannelLayoutToString(AudioChannelLayout &layout, std::string &str);
  bool                AllChannelUnknown();
protected:
  AudioChannelLayout* m_pLayout;
};