| OLD | NEW |
| (Empty) |
| 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 #ifndef MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | |
| 6 #define MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/synchronization/lock.h" | |
| 11 #include "media/base/audio_parameters.h" | |
| 12 #include "media/base/channel_layout.h" | |
| 13 #include "media/base/media_export.h" | |
| 14 | |
| 15 namespace media { | |
| 16 | |
| 17 // Provides thread safe access to the audio hardware configuration. | |
| 18 class MEDIA_EXPORT AudioHardwareConfig { | |
| 19 public: | |
| 20 AudioHardwareConfig(const media::AudioParameters& input_params, | |
| 21 const media::AudioParameters& output_params); | |
| 22 virtual ~AudioHardwareConfig(); | |
| 23 | |
| 24 // Accessors for the currently cached hardware configuration. Safe to call | |
| 25 // from any thread. | |
| 26 int GetOutputBufferSize() const; | |
| 27 int GetOutputSampleRate() const; | |
| 28 ChannelLayout GetOutputChannelLayout() const; | |
| 29 int GetOutputChannels() const; | |
| 30 | |
| 31 int GetInputSampleRate() const; | |
| 32 ChannelLayout GetInputChannelLayout() const; | |
| 33 int GetInputChannels() const; | |
| 34 | |
| 35 media::AudioParameters GetInputConfig() const; | |
| 36 media::AudioParameters GetOutputConfig() const; | |
| 37 | |
| 38 // Allows callers to update the cached values for either input or output. The | |
| 39 // values are paired under the assumption that these values will only be set | |
| 40 // after an input or output device change respectively. Safe to call from | |
| 41 // any thread. | |
| 42 void UpdateInputConfig(const media::AudioParameters& input_params); | |
| 43 void UpdateOutputConfig(const media::AudioParameters& output_params); | |
| 44 | |
| 45 private: | |
| 46 // Cached values; access is protected by |config_lock_|. | |
| 47 mutable base::Lock config_lock_; | |
| 48 media::AudioParameters input_params_; | |
| 49 media::AudioParameters output_params_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); | |
| 52 }; | |
| 53 | |
| 54 } // namespace media | |
| 55 | |
| 56 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ | |
| OLD | NEW |