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

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

Issue 11198018: Move ChannelLayout into media namespace. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
« no previous file with comments | « media/base/channel_layout.h ('k') | media/mp4/aac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 namespace media {
8
7 static const int kLayoutToChannels[] = { 9 static const int kLayoutToChannels[] = {
8 0, // CHANNEL_LAYOUT_NONE 10 0, // CHANNEL_LAYOUT_NONE
9 0, // CHANNEL_LAYOUT_UNSUPPORTED 11 0, // CHANNEL_LAYOUT_UNSUPPORTED
10 1, // CHANNEL_LAYOUT_MONO 12 1, // CHANNEL_LAYOUT_MONO
11 2, // CHANNEL_LAYOUT_STEREO 13 2, // CHANNEL_LAYOUT_STEREO
12 3, // CHANNEL_LAYOUT_2_1 14 3, // CHANNEL_LAYOUT_2_1
13 3, // CHANNEL_LAYOUT_SURROUND 15 3, // CHANNEL_LAYOUT_SURROUND
14 4, // CHANNEL_LAYOUT_4POINT0 16 4, // CHANNEL_LAYOUT_4POINT0
15 4, // CHANNEL_LAYOUT_2_2 17 4, // CHANNEL_LAYOUT_2_2
16 4, // CHANNEL_LAYOUT_QUAD 18 4, // CHANNEL_LAYOUT_QUAD
17 5, // CHANNEL_LAYOUT_5POINT0 19 5, // CHANNEL_LAYOUT_5POINT0
18 6, // CHANNEL_LAYOUT_5POINT1 20 6, // CHANNEL_LAYOUT_5POINT1
19 5, // CHANNEL_LAYOUT_5POINT0_BACK 21 5, // CHANNEL_LAYOUT_5POINT0_BACK
20 6, // CHANNEL_LAYOUT_5POINT1_BACK 22 6, // CHANNEL_LAYOUT_5POINT1_BACK
21 7, // CHANNEL_LAYOUT_7POINT0 23 7, // CHANNEL_LAYOUT_7POINT0
22 8, // CHANNEL_LAYOUT_7POINT1 24 8, // CHANNEL_LAYOUT_7POINT1
23 8, // CHANNEL_LAYOUT_7POINT1_WIDE 25 8, // CHANNEL_LAYOUT_7POINT1_WIDE
24 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX 26 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX
25 27
26 const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { 28 // The channel orderings for each layout as specified by FFmpeg. Each value
29 // represents the index of each channel in each layout. Values of -1 mean the
30 // channel at that index is not used for that layout.For example, the left side
31 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because
32 // the order is L, R, C, LFE, LS, RS), so
33 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4;
34 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
27 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR 35 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR
28 36
29 // CHANNEL_LAYOUT_NONE 37 // CHANNEL_LAYOUT_NONE
30 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, 38 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 },
31 39
32 // CHANNEL_LAYOUT_UNSUPPORTED 40 // CHANNEL_LAYOUT_UNSUPPORTED
33 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, 41 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 },
34 42
35 // CHANNEL_LAYOUT_MONO 43 // CHANNEL_LAYOUT_MONO
36 { -1 , -1 , 0 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, 44 { -1 , -1 , 0 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 },
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 84
77 // CHANNEL_LAYOUT_STEREO_DOWNMIX 85 // CHANNEL_LAYOUT_STEREO_DOWNMIX
78 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , 0 , 1 }, 86 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , 0 , 1 },
79 87
80 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR 88 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR
81 }; 89 };
82 90
83 int ChannelLayoutToChannelCount(ChannelLayout layout) { 91 int ChannelLayoutToChannelCount(ChannelLayout layout) {
84 return kLayoutToChannels[layout]; 92 return kLayoutToChannels[layout];
85 } 93 }
94
95 int ChannelOrder(ChannelLayout layout, Channels channel) {
96 return kChannelOrderings[layout][channel];
Ami GONE FROM CHROMIUM 2012/10/17 03:54:49 Could DCHECK_LT(layout, arraysize(kChannelOrdering
DaleCurtis 2012/10/17 04:22:13 Done.
97 }
98
99 } // namespace media
OLDNEW
« no previous file with comments | « media/base/channel_layout.h ('k') | media/mp4/aac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698