summaryrefslogtreecommitdiffstats
path: root/media/base/channel_layout.h
blob: ac10661daf90ebb4d223a73ba1ff56d6169a5a6f (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_
#define MEDIA_BASE_CHANNEL_LAYOUT_H_

#include "build/build_config.h"
#include "media/base/media_export.h"

enum ChannelLayout {
  CHANNEL_LAYOUT_NONE = 0,
  CHANNEL_LAYOUT_UNSUPPORTED,

  // Front C
  CHANNEL_LAYOUT_MONO,

  // Front L, Front R
  CHANNEL_LAYOUT_STEREO,

  // Front L, Front R, Back C
  CHANNEL_LAYOUT_2_1,

  // Front L, Front R, Front C
  CHANNEL_LAYOUT_SURROUND,

  // Front L, Front R, Front C, Back C
  CHANNEL_LAYOUT_4_0,

  // Front L, Front R, Side L, Side R
  CHANNEL_LAYOUT_2_2,

  // Front L, Front R, Back L, Back R
  CHANNEL_LAYOUT_QUAD,

  // Front L, Front R, Front C, Side L, Side R
  CHANNEL_LAYOUT_5_0,

  // Front L, Front R, Front C, Side L, Side R, LFE
  CHANNEL_LAYOUT_5_1,

  // Front L, Front R, Front C, Back L, Back R
  CHANNEL_LAYOUT_5_0_BACK,

  // Front L, Front R, Front C, Back L, Back R, LFE
  CHANNEL_LAYOUT_5_1_BACK,

  // Front L, Front R, Front C, Side L, Side R, Back L, Back R
  CHANNEL_LAYOUT_7_0,

  // Front L, Front R, Front C, Side L, Side R, LFE, Back L, Back R
  CHANNEL_LAYOUT_7_1,

  // Front L, Front R, Front C, Back L, Back R, LFE, Front LofC, Front RofC
  CHANNEL_LAYOUT_7_1_WIDE,

  // Stereo L, Stereo R
  CHANNEL_LAYOUT_STEREO_DOWNMIX,

  // Total number of layouts.
  CHANNEL_LAYOUT_MAX
};

enum Channels {
  LEFT = 0,
  RIGHT,
  CENTER,
  LFE,
  BACK_LEFT,
  BACK_RIGHT,
  LEFT_OF_CENTER,
  RIGHT_OF_CENTER,
  BACK_CENTER,
  SIDE_LEFT,
  SIDE_RIGHT,
  STEREO_LEFT,
  STEREO_RIGHT,
  CHANNELS_MAX
};

#if defined(OS_MACOSX) || defined(USE_PULSEAUDIO)
// The channel orderings for each layout as specified by FFmpeg.
// Values represent the index of each channel in each layout. For example, the
// left side surround sound channel in FFmpeg's 5.1 layout is in the 5th
// position (because the order is L, R, C, LFE, LS, RS), so
// kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4;
// Values of -1 mean the channel at that index is not used for that layout.
extern const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX];
#endif

// Returns the number of channels in a given ChannelLayout.
MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout);

#endif  // MEDIA_BASE_CHANNEL_LAYOUT_H_