Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 16 matching lines...) Expand all Loading... | |
| 27 8, // CHANNEL_LAYOUT_7POINT1 | 27 8, // CHANNEL_LAYOUT_7POINT1 |
| 28 8, // CHANNEL_LAYOUT_7POINT1_WIDE | 28 8, // CHANNEL_LAYOUT_7POINT1_WIDE |
| 29 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX | 29 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX |
| 30 | 30 |
| 31 // The channel orderings for each layout as specified by FFmpeg. Each value | 31 // The channel orderings for each layout as specified by FFmpeg. Each value |
| 32 // represents the index of each channel in each layout. Values of -1 mean the | 32 // represents the index of each channel in each layout. Values of -1 mean the |
| 33 // channel at that index is not used for that layout.For example, the left side | 33 // channel at that index is not used for that layout.For example, the left side |
| 34 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because | 34 // surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because |
| 35 // the order is L, R, C, LFE, LS, RS), so | 35 // the order is L, R, C, LFE, LS, RS), so |
| 36 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; | 36 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; |
| 37 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { | 37 static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { |
|
scherkus (not reviewing)
2012/10/18 01:30:39
random thought: I don't suspect we'll have to chan
DaleCurtis
2012/10/18 01:56:44
I think a better approach would be the bitmask met
| |
| 38 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR | 38 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR |
| 39 | 39 |
| 40 // CHANNEL_LAYOUT_NONE | 40 // CHANNEL_LAYOUT_NONE |
| 41 { -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 }, |
| 42 | 42 |
| 43 // CHANNEL_LAYOUT_UNSUPPORTED | 43 // CHANNEL_LAYOUT_UNSUPPORTED |
| 44 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, | 44 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, |
| 45 | 45 |
| 46 // CHANNEL_LAYOUT_MONO | 46 // CHANNEL_LAYOUT_MONO |
| 47 { -1 , -1 , 0 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, | 47 { -1 , -1 , 0 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 // CHANNEL_LAYOUT_7POINT0 | 79 // CHANNEL_LAYOUT_7POINT0 |
| 80 { 0 , 1 , 2 , -1 , 5 , 6 , -1 , -1 , -1 , 3 , 4 , -1 , -1 }, | 80 { 0 , 1 , 2 , -1 , 5 , 6 , -1 , -1 , -1 , 3 , 4 , -1 , -1 }, |
| 81 | 81 |
| 82 // CHANNEL_LAYOUT_7POINT1 | 82 // CHANNEL_LAYOUT_7POINT1 |
| 83 { 0 , 1 , 2 , 3 , 6 , 7 , -1 , -1 , -1 , 4 , 5 , -1 , -1 }, | 83 { 0 , 1 , 2 , 3 , 6 , 7 , -1 , -1 , -1 , 4 , 5 , -1 , -1 }, |
| 84 | 84 |
| 85 // CHANNEL_LAYOUT_7POINT1_WIDE | 85 // CHANNEL_LAYOUT_7POINT1_WIDE |
| 86 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , -1 , -1 , -1 , -1 , -1 }, | 86 { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , -1 , -1 , -1 , -1 , -1 }, |
| 87 | 87 |
| 88 // CHANNEL_LAYOUT_STEREO_DOWNMIX | 88 // CHANNEL_LAYOUT_STEREO_DOWNMIX |
| 89 { -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , 0 , 1 }, | 89 { 0 , 1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, |
|
scherkus (not reviewing)
2012/10/18 01:30:39
is this a bug fix that didn't happen when DOWNMIX
DaleCurtis
2012/10/18 01:56:44
I'm not sure what those channels actually mean and
scherkus (not reviewing)
2012/10/18 02:24:03
No clue. You'll have to dig through commit logs +
DaleCurtis
2012/10/18 05:22:04
Removed. History shows they were just added becaus
| |
| 90 | 90 |
| 91 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR | 91 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 int ChannelLayoutToChannelCount(ChannelLayout layout) { | 94 int ChannelLayoutToChannelCount(ChannelLayout layout) { |
| 95 DCHECK_LT(layout, arraysize(kLayoutToChannels)); | 95 DCHECK_LT(layout, arraysize(kLayoutToChannels)); |
| 96 return kLayoutToChannels[layout]; | 96 return kLayoutToChannels[layout]; |
| 97 } | 97 } |
| 98 | 98 |
| 99 int ChannelOrder(ChannelLayout layout, Channels channel) { | 99 int ChannelOrder(ChannelLayout layout, Channels channel) { |
| 100 DCHECK_LT(layout, arraysize(kChannelOrderings)); | 100 DCHECK_LT(layout, arraysize(kChannelOrderings)); |
| 101 DCHECK_LT(channel, arraysize(kChannelOrderings[0])); | 101 DCHECK_LT(channel, arraysize(kChannelOrderings[0])); |
| 102 return kChannelOrderings[layout][channel]; | 102 return kChannelOrderings[layout][channel]; |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace media | 105 } // namespace media |
| OLD | NEW |