From b630cb97c620593f9c987fdad0b3271ddbf39a3e Mon Sep 17 00:00:00 2001 From: "annacc@chromium.org" Date: Mon, 16 May 2011 22:18:32 +0000 Subject: 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 --- media/audio/audio_parameters.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'media/audio/audio_parameters.cc') diff --git a/media/audio/audio_parameters.cc b/media/audio/audio_parameters.cc index dfe2d07..029f831 100644 --- a/media/audio/audio_parameters.cc +++ b/media/audio/audio_parameters.cc @@ -8,28 +8,31 @@ AudioParameters::AudioParameters() : format(AUDIO_PCM_LINEAR), - channels(0), + channel_layout(CHANNEL_LAYOUT_NONE), sample_rate(0), bits_per_sample(0), - samples_per_packet(0) { + samples_per_packet(0), + channels(0) { } AudioParameters::AudioParameters(const media::AudioDecoderConfig& config) : format(AUDIO_PCM_LINEAR), - channels(config.channels_per_sample), + channel_layout(config.channel_layout), sample_rate(config.sample_rate), bits_per_sample(config.bits_per_channel), - samples_per_packet(0) { + samples_per_packet(0), + channels(ChannelLayoutToChannelCount(config.channel_layout)) { } -AudioParameters::AudioParameters(Format format, int channels, +AudioParameters::AudioParameters(Format format, ChannelLayout channel_layout, int sample_rate, int bits_per_sample, int samples_per_packet) : format(format), - channels(channels), + channel_layout(channel_layout), sample_rate(sample_rate), bits_per_sample(bits_per_sample), - samples_per_packet(samples_per_packet) { + samples_per_packet(samples_per_packet), + channels(ChannelLayoutToChannelCount(channel_layout)) { } bool AudioParameters::IsValid() const { -- cgit v1.1