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

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

Issue 12387006: Pass more detailed audio hardware configuration information to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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
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
42 }; 43 };
43 44
44 // The channel orderings for each layout as specified by FFmpeg. Each value 45 // The channel orderings for each layout as specified by FFmpeg. Each value
45 // represents the index of each channel in each layout. Values of -1 mean the 46 // represents the index of each channel in each layout. Values of -1 mean the
46 // channel at that index is not used for that layout.For example, the left side 47 // channel at that index is not used for that layout.For example, the left side
47 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because 48 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because
48 // the order is L, R, C, LFE, LS, RS), so 49 // the order is L, R, C, LFE, LS, RS), so
49 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; 50 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4;
50 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { 51 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
51 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR 52 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 135
135 // CHANNEL_LAYOUT_7_0_FRONT 136 // CHANNEL_LAYOUT_7_0_FRONT
136 { 0 , 1 , 2 , -1 , -1 , -1 , 5 , 6 , -1 , 3 , 4 }, 137 { 0 , 1 , 2 , -1 , -1 , -1 , 5 , 6 , -1 , 3 , 4 },
137 138
138 // CHANNEL_LAYOUT_7_1_WIDE_BACK 139 // CHANNEL_LAYOUT_7_1_WIDE_BACK
139 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , -1 , -1 , -1 }, 140 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , -1 , -1 , -1 },
140 141
141 // CHANNEL_LAYOUT_OCTAGONAL 142 // CHANNEL_LAYOUT_OCTAGONAL
142 { 0 , 1 , 2 , -1 , 5 , 6 , -1 , -1 , 7 , 3 , 4 }, 143 { 0 , 1 , 2 , -1 , 5 , 6 , -1 , -1 , 7 , 3 , 4 },
143 144
145 // CHANNEL_LAYOUT_DISCRETE
146 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 },
147
144 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR 148 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR
145 }; 149 };
146 150
147 int ChannelLayoutToChannelCount(ChannelLayout layout) { 151 int ChannelLayoutToChannelCount(ChannelLayout layout) {
148 DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels)); 152 DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels));
149 return kLayoutToChannels[layout]; 153 return kLayoutToChannels[layout];
150 } 154 }
151 155
152 int ChannelOrder(ChannelLayout layout, Channels channel) { 156 int ChannelOrder(ChannelLayout layout, Channels channel) {
153 DCHECK_LT(static_cast<size_t>(layout), arraysize(kChannelOrderings)); 157 DCHECK_LT(static_cast<size_t>(layout), arraysize(kChannelOrderings));
154 DCHECK_LT(static_cast<size_t>(channel), arraysize(kChannelOrderings[0])); 158 DCHECK_LT(static_cast<size_t>(channel), arraysize(kChannelOrderings[0]));
155 return kChannelOrderings[layout][channel]; 159 return kChannelOrderings[layout][channel];
156 } 160 }
157 161
158 } // namespace media 162 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698