OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" |
12 #include "media/audio/audio_manager_base.h" | 14 #include "media/audio/audio_manager_base.h" |
13 | 15 |
14 class PCMWaveOutAudioOutputStream; | 16 class PCMWaveOutAudioOutputStream; |
15 | 17 |
16 // Windows implementation of the AudioManager singleton. This class is internal | 18 // Windows implementation of the AudioManager singleton. This class is internal |
17 // to the audio output and only internal users can call methods not exposed by | 19 // to the audio output and only internal users can call methods not exposed by |
18 // the AudioManager class. | 20 // the AudioManager class. |
19 class AudioManagerWin : public AudioManagerBase { | 21 class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase { |
20 public: | 22 public: |
21 AudioManagerWin(); | 23 AudioManagerWin(); |
22 // Implementation of AudioManager. | 24 // Implementation of AudioManager. |
23 virtual bool HasAudioOutputDevices() OVERRIDE; | 25 virtual bool HasAudioOutputDevices() OVERRIDE; |
24 virtual bool HasAudioInputDevices() OVERRIDE; | 26 virtual bool HasAudioInputDevices() OVERRIDE; |
25 virtual AudioOutputStream* MakeAudioOutputStream( | 27 virtual AudioOutputStream* MakeAudioOutputStream( |
26 const AudioParameters& params) OVERRIDE; | 28 const AudioParameters& params) OVERRIDE; |
27 virtual AudioInputStream* MakeAudioInputStream( | 29 virtual AudioInputStream* MakeAudioInputStream( |
28 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 30 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
29 virtual void MuteAll() OVERRIDE; | 31 virtual void MuteAll() OVERRIDE; |
30 virtual void UnMuteAll() OVERRIDE; | 32 virtual void UnMuteAll() OVERRIDE; |
31 virtual string16 GetAudioInputDeviceModel() OVERRIDE; | 33 virtual string16 GetAudioInputDeviceModel() OVERRIDE; |
32 virtual bool CanShowAudioInputSettings() OVERRIDE; | 34 virtual bool CanShowAudioInputSettings() OVERRIDE; |
33 virtual void ShowAudioInputSettings() OVERRIDE; | 35 virtual void ShowAudioInputSettings() OVERRIDE; |
34 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) | 36 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) |
35 OVERRIDE; | 37 OVERRIDE; |
36 | 38 |
37 // Windows-only methods to free a stream created in MakeAudioStream. These | 39 // Windows-only methods to free a stream created in MakeAudioStream. These |
38 // are called internally by the audio stream when it has been closed. | 40 // are called internally by the audio stream when it has been closed. |
39 void ReleaseOutputStream(AudioOutputStream* stream); | 41 void ReleaseOutputStream(AudioOutputStream* stream); |
40 | 42 |
41 // Called internally by the audio stream when it has been closed. | 43 // Called internally by the audio stream when it has been closed. |
42 void ReleaseInputStream(AudioInputStream* stream); | 44 void ReleaseInputStream(AudioInputStream* stream); |
43 | 45 |
44 private: | 46 private: |
| 47 enum EnumerationType { |
| 48 kUninitializedEnumeration = 0, |
| 49 kMMDeviceEnumeration, |
| 50 kWaveEnumeration, |
| 51 }; |
| 52 |
45 virtual ~AudioManagerWin(); | 53 virtual ~AudioManagerWin(); |
46 | 54 |
| 55 // Allow unit test to modify the utilized enumeration API. |
| 56 friend class AudioInputDeviceTest; |
| 57 |
| 58 EnumerationType enumeration_type_; |
| 59 EnumerationType enumeration_type() { return enumeration_type_; } |
| 60 void SetEnumerationType(EnumerationType type) { |
| 61 enumeration_type_ = type; |
| 62 } |
| 63 |
47 // Number of currently open output streams. | 64 // Number of currently open output streams. |
48 int num_output_streams_; | 65 int num_output_streams_; |
49 | 66 |
50 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); | 67 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); |
51 }; | 68 }; |
52 | 69 |
53 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ | 70 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ |
OLD | NEW |