Chromium Code Reviews| Index: media/base/channel_layout.cc |
| diff --git a/media/base/channel_layout.cc b/media/base/channel_layout.cc |
| index 8bf02ea18ad6c694978ad303c97ca5d3b773f176..e97cb62bef7c44e1647912aac1c404199e4c26c9 100644 |
| --- a/media/base/channel_layout.cc |
| +++ b/media/base/channel_layout.cc |
| @@ -4,6 +4,8 @@ |
| #include "media/base/channel_layout.h" |
| +namespace media { |
| + |
| static const int kLayoutToChannels[] = { |
| 0, // CHANNEL_LAYOUT_NONE |
| 0, // CHANNEL_LAYOUT_UNSUPPORTED |
| @@ -23,7 +25,13 @@ static const int kLayoutToChannels[] = { |
| 8, // CHANNEL_LAYOUT_7POINT1_WIDE |
| 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX |
| -const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { |
| +// The channel orderings for each layout as specified by FFmpeg. Each value |
| +// represents the index of each channel in each layout. Values of -1 mean the |
| +// channel at that index is not used for that layout.For example, the left side |
| +// surround sound channel in FFmpeg's 5.1 layout is in the 5th position (because |
| +// the order is L, R, C, LFE, LS, RS), so |
| +// kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; |
| +static const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { |
| // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR |
| // CHANNEL_LAYOUT_NONE |
| @@ -83,3 +91,9 @@ const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { |
| int ChannelLayoutToChannelCount(ChannelLayout layout) { |
| return kLayoutToChannels[layout]; |
| } |
| + |
| +int ChannelOrder(ChannelLayout layout, Channels channel) { |
| + 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.
|
| +} |
| + |
| +} // namespace media |