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

Unified 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: Fixes. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/channel_layout.h ('k') | media/mp4/aac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/channel_layout.cc
diff --git a/media/base/channel_layout.cc b/media/base/channel_layout.cc
index 8bf02ea18ad6c694978ad303c97ca5d3b773f176..7c2d2e5b9b7038c90955558516e8446f93ff1c8b 100644
--- a/media/base/channel_layout.cc
+++ b/media/base/channel_layout.cc
@@ -4,6 +4,11 @@
#include "media/base/channel_layout.h"
+#include "base/basictypes.h"
+#include "base/logging.h"
+
+namespace media {
+
static const int kLayoutToChannels[] = {
0, // CHANNEL_LAYOUT_NONE
0, // CHANNEL_LAYOUT_UNSUPPORTED
@@ -23,7 +28,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
@@ -81,5 +92,14 @@ const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
};
int ChannelLayoutToChannelCount(ChannelLayout layout) {
+ DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels));
return kLayoutToChannels[layout];
}
+
+int ChannelOrder(ChannelLayout layout, Channels channel) {
+ DCHECK_LT(static_cast<size_t>(layout), arraysize(kChannelOrderings));
+ DCHECK_LT(static_cast<size_t>(channel), arraysize(kChannelOrderings[0]));
+ return kChannelOrderings[layout][channel];
+}
+
+} // namespace media
« 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