Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ | 5 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ |
| 6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ | 6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "media/audio/audio_manager_base.h" | 14 #include "media/audio/audio_manager_base.h" |
| 15 #include "media/audio/win/audio_device_listener_win.h" | |
| 15 | 16 |
| 16 namespace media { | 17 namespace media { |
| 17 | 18 |
| 18 // Windows implementation of the AudioManager singleton. This class is internal | 19 // Windows implementation of the AudioManager singleton. This class is internal |
| 19 // to the audio output and only internal users can call methods not exposed by | 20 // to the audio output and only internal users can call methods not exposed by |
| 20 // the AudioManager class. | 21 // the AudioManager class. |
| 21 class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase { | 22 class MEDIA_EXPORT AudioManagerWin |
| 23 : public AudioManagerBase, | |
| 24 NON_EXPORTED_BASE(public AudioManager::AudioDeviceListener) { | |
|
scherkus (not reviewing)
2012/10/24 04:27:09
I still don't see a reason to use multiple inherit
DaleCurtis
2012/10/24 04:52:47
Hmm, I kept it this way because the unit test was
scherkus (not reviewing)
2012/10/24 16:52:11
Those darn unit tests!
OK what about using a call
DaleCurtis
2012/10/24 19:27:29
Done.
| |
| 22 public: | 25 public: |
| 23 AudioManagerWin(); | 26 AudioManagerWin(); |
| 27 | |
| 24 // Implementation of AudioManager. | 28 // Implementation of AudioManager. |
| 25 virtual bool HasAudioOutputDevices() OVERRIDE; | 29 virtual bool HasAudioOutputDevices() OVERRIDE; |
| 26 virtual bool HasAudioInputDevices() OVERRIDE; | 30 virtual bool HasAudioInputDevices() OVERRIDE; |
| 27 virtual string16 GetAudioInputDeviceModel() OVERRIDE; | 31 virtual string16 GetAudioInputDeviceModel() OVERRIDE; |
| 28 virtual bool CanShowAudioInputSettings() OVERRIDE; | 32 virtual bool CanShowAudioInputSettings() OVERRIDE; |
| 29 virtual void ShowAudioInputSettings() OVERRIDE; | 33 virtual void ShowAudioInputSettings() OVERRIDE; |
| 30 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) | 34 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) |
| 31 OVERRIDE; | 35 OVERRIDE; |
| 32 | 36 |
| 33 // Implementation of AudioManagerBase. | 37 // Implementation of AudioManagerBase. |
| 34 virtual AudioOutputStream* MakeLinearOutputStream( | 38 virtual AudioOutputStream* MakeLinearOutputStream( |
| 35 const AudioParameters& params) OVERRIDE; | 39 const AudioParameters& params) OVERRIDE; |
| 36 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 40 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
| 37 const AudioParameters& params) OVERRIDE; | 41 const AudioParameters& params) OVERRIDE; |
| 38 virtual AudioInputStream* MakeLinearInputStream( | 42 virtual AudioInputStream* MakeLinearInputStream( |
| 39 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 43 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
| 40 virtual AudioInputStream* MakeLowLatencyInputStream( | 44 virtual AudioInputStream* MakeLowLatencyInputStream( |
| 41 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 45 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
| 42 virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( | 46 virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( |
| 43 const AudioParameters& input_params) OVERRIDE; | 47 const AudioParameters& input_params) OVERRIDE; |
| 44 | 48 |
| 49 // AudioDeviceListener implementation. | |
| 50 virtual void OnDeviceChange() OVERRIDE; | |
| 51 | |
| 45 protected: | 52 protected: |
| 46 virtual ~AudioManagerWin(); | 53 virtual ~AudioManagerWin(); |
| 47 | 54 |
| 55 // Implementation of AudioManager. | |
| 56 virtual void InitializeOnAudioThread() OVERRIDE; | |
| 57 | |
| 48 private: | 58 private: |
| 49 enum EnumerationType { | 59 enum EnumerationType { |
| 50 kUninitializedEnumeration = 0, | 60 kUninitializedEnumeration = 0, |
| 51 kMMDeviceEnumeration, | 61 kMMDeviceEnumeration, |
| 52 kWaveEnumeration, | 62 kWaveEnumeration, |
| 53 }; | 63 }; |
| 54 | 64 |
| 55 // Allow unit test to modify the utilized enumeration API. | 65 // Allow unit test to modify the utilized enumeration API. |
| 56 friend class AudioInputDeviceTest; | 66 friend class AudioInputDeviceTest; |
| 57 | 67 |
| 58 EnumerationType enumeration_type_; | 68 EnumerationType enumeration_type_; |
| 59 EnumerationType enumeration_type() { return enumeration_type_; } | 69 EnumerationType enumeration_type() { return enumeration_type_; } |
| 60 void SetEnumerationType(EnumerationType type) { | 70 void SetEnumerationType(EnumerationType type) { |
| 61 enumeration_type_ = type; | 71 enumeration_type_ = type; |
| 62 } | 72 } |
| 63 | 73 |
| 64 // Returns a PCMWaveInAudioInputStream instance or NULL on failure. | 74 // Returns a PCMWaveInAudioInputStream instance or NULL on failure. |
| 65 // This method converts MMDevice-style device ID to WaveIn-style device ID if | 75 // This method converts MMDevice-style device ID to WaveIn-style device ID if |
| 66 // necessary. | 76 // necessary. |
| 67 // (Please see device_enumeration_win.h for more info about the two kinds of | 77 // (Please see device_enumeration_win.h for more info about the two kinds of |
| 68 // device IDs.) | 78 // device IDs.) |
| 69 AudioInputStream* CreatePCMWaveInAudioInputStream( | 79 AudioInputStream* CreatePCMWaveInAudioInputStream( |
| 70 const AudioParameters& params, | 80 const AudioParameters& params, |
| 71 const std::string& device_id); | 81 const std::string& device_id); |
| 72 | 82 |
| 83 // Listen for output device changes. | |
| 84 scoped_ptr<AudioDeviceListenerWin> output_device_listener_; | |
| 85 | |
| 73 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); | 86 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); |
| 74 }; | 87 }; |
| 75 | 88 |
| 76 } // namespace media | 89 } // namespace media |
| 77 | 90 |
| 78 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ | 91 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ |
| OLD | NEW |