1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "media/base/audio_hardware_config.h" 6 7 using base::AutoLock; 8 using media::AudioParameters; 9 10 namespace media { 11 AudioHardwareConfig(const AudioParameters & input_params,const AudioParameters & output_params)12AudioHardwareConfig::AudioHardwareConfig( 13 const AudioParameters& input_params, 14 const AudioParameters& output_params) 15 : input_params_(input_params), 16 output_params_(output_params) { 17 } 18 ~AudioHardwareConfig()19AudioHardwareConfig::~AudioHardwareConfig() {} 20 GetOutputBufferSize() const21int AudioHardwareConfig::GetOutputBufferSize() const { 22 AutoLock auto_lock(config_lock_); 23 return output_params_.frames_per_buffer(); 24 } 25 GetOutputSampleRate() const26int AudioHardwareConfig::GetOutputSampleRate() const { 27 AutoLock auto_lock(config_lock_); 28 return output_params_.sample_rate(); 29 } 30 GetOutputChannelLayout() const31ChannelLayout AudioHardwareConfig::GetOutputChannelLayout() const { 32 AutoLock auto_lock(config_lock_); 33 return output_params_.channel_layout(); 34 } 35 GetOutputChannels() const36int AudioHardwareConfig::GetOutputChannels() const { 37 AutoLock auto_lock(config_lock_); 38 return output_params_.channels(); 39 } 40 GetInputSampleRate() const41int AudioHardwareConfig::GetInputSampleRate() const { 42 AutoLock auto_lock(config_lock_); 43 return input_params_.sample_rate(); 44 } 45 GetInputChannelLayout() const46ChannelLayout AudioHardwareConfig::GetInputChannelLayout() const { 47 AutoLock auto_lock(config_lock_); 48 return input_params_.channel_layout(); 49 } 50 GetInputChannels() const51int AudioHardwareConfig::GetInputChannels() const { 52 AutoLock auto_lock(config_lock_); 53 return input_params_.channels(); 54 } 55 56 media::AudioParameters GetInputConfig() const57AudioHardwareConfig::GetInputConfig() const { 58 AutoLock auto_lock(config_lock_); 59 return input_params_; 60 } 61 62 media::AudioParameters GetOutputConfig() const63AudioHardwareConfig::GetOutputConfig() const { 64 AutoLock auto_lock(config_lock_); 65 return output_params_; 66 } 67 UpdateInputConfig(const AudioParameters & input_params)68void AudioHardwareConfig::UpdateInputConfig( 69 const AudioParameters& input_params) { 70 AutoLock auto_lock(config_lock_); 71 input_params_ = input_params; 72 } 73 UpdateOutputConfig(const AudioParameters & output_params)74void AudioHardwareConfig::UpdateOutputConfig( 75 const AudioParameters& output_params) { 76 AutoLock auto_lock(config_lock_); 77 output_params_ = output_params; 78 } 79 80 } // namespace media 81