Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: media/base/channel_layout.cc

Issue 12662038: Revert 187936 "Pass more detailed audio hardware configuration i..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1440/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/channel_layout.h ('k') | media/base/channel_mixer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/channel_layout.h" 5 #include "media/base/channel_layout.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 21 matching lines...) Expand all
32 5, // CHANNEL_LAYOUT_4_1 32 5, // CHANNEL_LAYOUT_4_1
33 6, // CHANNEL_LAYOUT_6_0 33 6, // CHANNEL_LAYOUT_6_0
34 6, // CHANNEL_LAYOUT_6_0_FRONT 34 6, // CHANNEL_LAYOUT_6_0_FRONT
35 6, // CHANNEL_LAYOUT_HEXAGONAL 35 6, // CHANNEL_LAYOUT_HEXAGONAL
36 7, // CHANNEL_LAYOUT_6_1 36 7, // CHANNEL_LAYOUT_6_1
37 7, // CHANNEL_LAYOUT_6_1_BACK 37 7, // CHANNEL_LAYOUT_6_1_BACK
38 7, // CHANNEL_LAYOUT_6_1_FRONT 38 7, // CHANNEL_LAYOUT_6_1_FRONT
39 7, // CHANNEL_LAYOUT_7_0_FRONT 39 7, // CHANNEL_LAYOUT_7_0_FRONT
40 8, // CHANNEL_LAYOUT_7_1_WIDE_BACK 40 8, // CHANNEL_LAYOUT_7_1_WIDE_BACK
41 8, // CHANNEL_LAYOUT_OCTAGONAL 41 8, // CHANNEL_LAYOUT_OCTAGONAL
42 0, // CHANNEL_LAYOUT_DISCRETE
43 }; 42 };
44 43
45 // The channel orderings for each layout as specified by FFmpeg. Each value 44 // The channel orderings for each layout as specified by FFmpeg. Each value
46 // represents the index of each channel in each layout. Values of -1 mean the 45 // represents the index of each channel in each layout. Values of -1 mean the
47 // channel at that index is not used for that layout.For example, the left side 46 // channel at that index is not used for that layout.For example, the left side
48 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because 47 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because
49 // the order is L, R, C, LFE, LS, RS), so 48 // the order is L, R, C, LFE, LS, RS), so
50 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; 49 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4;
51 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { 50 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
52 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR 51 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 134
136 // CHANNEL_LAYOUT_7_0_FRONT 135 // CHANNEL_LAYOUT_7_0_FRONT
137 { 0 , 1 , 2 , -1 , -1 , -1 , 5 , 6 , -1 , 3 , 4 }, 136 { 0 , 1 , 2 , -1 , -1 , -1 , 5 , 6 , -1 , 3 , 4 },
138 137
139 // CHANNEL_LAYOUT_7_1_WIDE_BACK 138 // CHANNEL_LAYOUT_7_1_WIDE_BACK
140 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , -1 , -1 , -1 }, 139 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , -1 , -1 , -1 },
141 140
142 // CHANNEL_LAYOUT_OCTAGONAL 141 // CHANNEL_LAYOUT_OCTAGONAL
143 { 0 , 1 , 2 , -1 , 5 , 6 , -1 , -1 , 7 , 3 , 4 }, 142 { 0 , 1 , 2 , -1 , 5 , 6 , -1 , -1 , 7 , 3 , 4 },
144 143
145 // CHANNEL_LAYOUT_DISCRETE
146 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 },
147
148 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR 144 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR
149 }; 145 };
150 146
151 int ChannelLayoutToChannelCount(ChannelLayout layout) { 147 int ChannelLayoutToChannelCount(ChannelLayout layout) {
152 DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels)); 148 DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels));
153 return kLayoutToChannels[layout]; 149 return kLayoutToChannels[layout];
154 } 150 }
155 151
156 // Converts a channel count into a channel layout.
157 ChannelLayout GuessChannelLayout(int channels) {
158 switch (channels) {
159 case 1:
160 return CHANNEL_LAYOUT_MONO;
161 case 2:
162 return CHANNEL_LAYOUT_STEREO;
163 case 3:
164 return CHANNEL_LAYOUT_SURROUND;
165 case 4:
166 return CHANNEL_LAYOUT_QUAD;
167 case 5:
168 return CHANNEL_LAYOUT_5_0;
169 case 6:
170 return CHANNEL_LAYOUT_5_1;
171 case 7:
172 return CHANNEL_LAYOUT_6_1;
173 case 8:
174 return CHANNEL_LAYOUT_7_1;
175 default:
176 DVLOG(1) << "Unsupported channel count: " << channels;
177 }
178 return CHANNEL_LAYOUT_UNSUPPORTED;
179 }
180
181 int ChannelOrder(ChannelLayout layout, Channels channel) { 152 int ChannelOrder(ChannelLayout layout, Channels channel) {
182 DCHECK_LT(static_cast<size_t>(layout), arraysize(kChannelOrderings)); 153 DCHECK_LT(static_cast<size_t>(layout), arraysize(kChannelOrderings));
183 DCHECK_LT(static_cast<size_t>(channel), arraysize(kChannelOrderings[0])); 154 DCHECK_LT(static_cast<size_t>(channel), arraysize(kChannelOrderings[0]));
184 return kChannelOrderings[layout][channel]; 155 return kChannelOrderings[layout][channel];
185 } 156 }
186 157
187 } // namespace media 158 } // namespace media
OLDNEW
« no previous file with comments | « media/base/channel_layout.h ('k') | media/base/channel_mixer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698