diff options
author | annacc@chromium.org <annacc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 22:18:32 +0000 |
---|---|---|
committer | annacc@chromium.org <annacc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 22:18:32 +0000 |
commit | b630cb97c620593f9c987fdad0b3271ddbf39a3e (patch) | |
tree | 21295811329d31b302e29be7e16198fdfd5bc463 /media/base | |
parent | 99d22e8b1c2c0b6f6457147ab90ce2df98ef02d3 (diff) | |
download | chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.zip chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.tar.gz chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.tar.bz2 |
Description:
This patch gets the channel layout for surround sound channel order from ffmpeg and stores it so that chromium will be able to re-order the channels for various sound cards and OSes later.
- AudioParameters gets a new field (channel_layout).
- channel_layout.h stores an enum that we will use in chromium for channel values.
- ffmpeg_common.h gets a new method for mapping the channel layout received from ffmpeg to an internal chromium enum value.
BUG=None (though storing the channel order should help us solve some other bugs soon)
TEST=media_unittests
Review URL: http://codereview.chromium.org/6930039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/audio_decoder_config.h | 8 | ||||
-rw-r--r-- | media/base/channel_layout.cc | 28 | ||||
-rw-r--r-- | media/base/channel_layout.h | 60 |
3 files changed, 93 insertions, 3 deletions
diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h index 791d2cd..e2c848d 100644 --- a/media/base/audio_decoder_config.h +++ b/media/base/audio_decoder_config.h @@ -5,17 +5,19 @@ #ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_ +#include "media/base/channel_layout.h" + namespace media { struct AudioDecoderConfig { - AudioDecoderConfig(int bits, int channels, int rate) + AudioDecoderConfig(int bits, ChannelLayout layout, int rate) : bits_per_channel(bits), - channels_per_sample(channels), + channel_layout(layout), sample_rate(rate) { } int bits_per_channel; - int channels_per_sample; + ChannelLayout channel_layout; int sample_rate; }; diff --git a/media/base/channel_layout.cc b/media/base/channel_layout.cc new file mode 100644 index 0000000..8e3da4f --- /dev/null +++ b/media/base/channel_layout.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/base/channel_layout.h" + +static const int kLayoutToChannels[] = { + 0, // CHANNEL_LAYOUT_NONE + 0, // CHANNEL_LAYOUT_UNSUPPORTED + 1, // CHANNEL_LAYOUT_MONO + 2, // CHANNEL_LAYOUT_STEREO + 3, // CHANNEL_LAYOUT_2_1 + 3, // CHANNEL_LAYOUT_SURROUND + 4, // CHANNEL_LAYOUT_4POINT0 + 4, // CHANNEL_LAYOUT_2_2 + 4, // CHANNEL_LAYOUT_QUAD + 5, // CHANNEL_LAYOUT_5POINT0 + 6, // CHANNEL_LAYOUT_5POINT1 + 5, // CHANNEL_LAYOUT_5POINT0_BACK + 6, // CHANNEL_LAYOUT_5POINT1_BACK + 7, // CHANNEL_LAYOUT_7POINT0 + 8, // CHANNEL_LAYOUT_7POINT1 + 8, // CHANNEL_LAYOUT_7POINT1_WIDE + 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX + +int ChannelLayoutToChannelCount(ChannelLayout layout) { + return kLayoutToChannels[layout]; +} diff --git a/media/base/channel_layout.h b/media/base/channel_layout.h new file mode 100644 index 0000000..b8e1204 --- /dev/null +++ b/media/base/channel_layout.h @@ -0,0 +1,60 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_ +#define MEDIA_BASE_CHANNEL_LAYOUT_H_ + +enum ChannelLayout { + CHANNEL_LAYOUT_NONE = 0, + CHANNEL_LAYOUT_UNSUPPORTED, + + // Front C + CHANNEL_LAYOUT_MONO, + + // Front L, Front R + CHANNEL_LAYOUT_STEREO, + + // Front L, Front R, Back C + CHANNEL_LAYOUT_2_1, + + // Front L, Front R, Front C + CHANNEL_LAYOUT_SURROUND, + + // Front L, Front R, Front C, Back C + CHANNEL_LAYOUT_4POINT0, + + // Front L, Front R, Side L, Side R + CHANNEL_LAYOUT_2_2, + + // Front L, Front R, Back L, Back R + CHANNEL_LAYOUT_QUAD, + + // Front L, Front R, Front C, Side L, Side R + CHANNEL_LAYOUT_5POINT0, + + // Front L, Front R, Front C, Side L, Side R, LFE + CHANNEL_LAYOUT_5POINT1, + + // Front L, Front R, Front C, Back L, Back R + CHANNEL_LAYOUT_5POINT0_BACK, + + // Front L, Front R, Front C, Back L, Back R, LFE + CHANNEL_LAYOUT_5POINT1_BACK, + + // Front L, Front R, Front C, Side L, Side R, Back L, Back R + CHANNEL_LAYOUT_7POINT0, + + // Front L, Front R, Front C, Side L, Side R, LFE, Back L, Back R + CHANNEL_LAYOUT_7POINT1, + + // Front L, Front R, Front C, Back L, Back R, LFE, Front LofC, Front RofC + CHANNEL_LAYOUT_7POINT1_WIDE, + + // Stereo L, Stereo R + CHANNEL_LAYOUT_STEREO_DOWNMIX +}; + +int ChannelLayoutToChannelCount(ChannelLayout layout); + +#endif // MEDIA_BASE_CHANNEL_LAYOUT_H_ |