Fix style for cast_unittest: Add newlines at EOF
[chromium-blink-merge.git] / media / base / channel_layout.h
blob9354eee850d2718306166119bade0e6252401a70
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_
6 #define MEDIA_BASE_CHANNEL_LAYOUT_H_
8 #include "media/base/media_export.h"
10 namespace media {
12 // Enumerates the various representations of the ordering of audio channels.
13 // Logged to UMA, so never reuse a value, always add new/greater ones!
14 enum ChannelLayout {
15 CHANNEL_LAYOUT_NONE = 0,
16 CHANNEL_LAYOUT_UNSUPPORTED = 1,
18 // Front C
19 CHANNEL_LAYOUT_MONO = 2,
21 // Front L, Front R
22 CHANNEL_LAYOUT_STEREO = 3,
24 // Front L, Front R, Back C
25 CHANNEL_LAYOUT_2_1 = 4,
27 // Front L, Front R, Front C
28 CHANNEL_LAYOUT_SURROUND = 5,
30 // Front L, Front R, Front C, Back C
31 CHANNEL_LAYOUT_4_0 = 6,
33 // Front L, Front R, Side L, Side R
34 CHANNEL_LAYOUT_2_2 = 7,
36 // Front L, Front R, Back L, Back R
37 CHANNEL_LAYOUT_QUAD = 8,
39 // Front L, Front R, Front C, Side L, Side R
40 CHANNEL_LAYOUT_5_0 = 9,
42 // Front L, Front R, Front C, Side L, Side R, LFE
43 CHANNEL_LAYOUT_5_1 = 10,
45 // Front L, Front R, Front C, Back L, Back R
46 CHANNEL_LAYOUT_5_0_BACK = 11,
48 // Front L, Front R, Front C, Back L, Back R, LFE
49 CHANNEL_LAYOUT_5_1_BACK = 12,
51 // Front L, Front R, Front C, Side L, Side R, Back L, Back R
52 CHANNEL_LAYOUT_7_0 = 13,
54 // Front L, Front R, Front C, Side L, Side R, LFE, Back L, Back R
55 CHANNEL_LAYOUT_7_1 = 14,
57 // Front L, Front R, Front C, Side L, Side R, LFE, Front LofC, Front RofC
58 CHANNEL_LAYOUT_7_1_WIDE = 15,
60 // Stereo L, Stereo R
61 CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
63 // Stereo L, Stereo R, LFE
64 CHANNEL_LAYOUT_2POINT1 = 17,
66 // Stereo L, Stereo R, Front C, LFE
67 CHANNEL_LAYOUT_3_1 = 18,
69 // Stereo L, Stereo R, Front C, Rear C, LFE
70 CHANNEL_LAYOUT_4_1 = 19,
72 // Stereo L, Stereo R, Front C, Side L, Side R, Back C
73 CHANNEL_LAYOUT_6_0 = 20,
75 // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
76 CHANNEL_LAYOUT_6_0_FRONT = 21,
78 // Stereo L, Stereo R, Side L, Side R, Front C, Rear C.
79 CHANNEL_LAYOUT_HEXAGONAL = 22,
81 // Stereo L, Stereo R, Side L, Side R, Front C, Rear Center, LFE
82 CHANNEL_LAYOUT_6_1 = 23,
84 // Stereo L, Stereo R, Back L, Back R, Front C, Rear Center, LFE
85 CHANNEL_LAYOUT_6_1_BACK = 24,
87 // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
88 CHANNEL_LAYOUT_6_1_FRONT = 25,
90 // Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
91 CHANNEL_LAYOUT_7_0_FRONT = 26,
93 // Front L, Front R, Front C, Back L, Back R, LFE, Front LofC, Front RofC
94 CHANNEL_LAYOUT_7_1_WIDE_BACK = 27,
96 // Front L, Front R, Front C, Side L, Side R, Rear C, Back L, Back R.
97 CHANNEL_LAYOUT_OCTAGONAL = 28,
99 // Channels are not explicitly mapped to speakers.
100 CHANNEL_LAYOUT_DISCRETE = 29,
102 // Total number of layouts.
103 CHANNEL_LAYOUT_MAX // Must always be last!
106 enum Channels {
107 LEFT = 0,
108 RIGHT,
109 CENTER,
110 LFE,
111 BACK_LEFT,
112 BACK_RIGHT,
113 LEFT_OF_CENTER,
114 RIGHT_OF_CENTER,
115 BACK_CENTER,
116 SIDE_LEFT,
117 SIDE_RIGHT,
118 CHANNELS_MAX
121 // Returns the expected channel position in an interleaved stream. Values of -1
122 // mean the channel at that index is not used for that layout. Values range
123 // from 0 to CHANNELS_MAX - 1.
124 MEDIA_EXPORT int ChannelOrder(ChannelLayout layout, Channels channel);
126 // Returns the number of channels in a given ChannelLayout.
127 MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout);
129 // Given the number of channels, return the best layout,
130 // or return CHANNEL_LAYOUT_UNSUPPORTED if there is no good match.
131 MEDIA_EXPORT ChannelLayout GuessChannelLayout(int channels);
133 // Returns a string representation of the channel layout.
134 MEDIA_EXPORT const char* ChannelLayoutToString(ChannelLayout layout);
136 } // namespace media
138 #endif // MEDIA_BASE_CHANNEL_LAYOUT_H_