| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 std::string GetDefaultOutputDeviceID() override; | 57 std::string GetDefaultOutputDeviceID() override; |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 ~AudioManagerWin() override; | 60 ~AudioManagerWin() override; |
| 61 | 61 |
| 62 AudioParameters GetPreferredOutputStreamParameters( | 62 AudioParameters GetPreferredOutputStreamParameters( |
| 63 const std::string& output_device_id, | 63 const std::string& output_device_id, |
| 64 const AudioParameters& input_params) override; | 64 const AudioParameters& input_params) override; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 enum EnumerationType { | |
| 68 kMMDeviceEnumeration, | |
| 69 kWaveEnumeration, | |
| 70 }; | |
| 71 | |
| 72 // Allow unit test to modify the utilized enumeration API. | 67 // Allow unit test to modify the utilized enumeration API. |
| 73 friend class AudioManagerTest; | 68 friend class AudioManagerTest; |
| 74 | 69 |
| 75 EnumerationType enumeration_type_; | |
| 76 EnumerationType enumeration_type() { return enumeration_type_; } | |
| 77 void SetEnumerationType(EnumerationType type) { | |
| 78 enumeration_type_ = type; | |
| 79 } | |
| 80 | |
| 81 inline bool core_audio_supported() const { | |
| 82 return enumeration_type_ == kMMDeviceEnumeration; | |
| 83 } | |
| 84 | |
| 85 // Returns a PCMWaveInAudioInputStream instance or NULL on failure. | |
| 86 // This method converts MMDevice-style device ID to WaveIn-style device ID if | |
| 87 // necessary. | |
| 88 // (Please see device_enumeration_win.h for more info about the two kinds of | |
| 89 // device IDs.) | |
| 90 AudioInputStream* CreatePCMWaveInAudioInputStream( | |
| 91 const AudioParameters& params, | |
| 92 const std::string& device_id); | |
| 93 | |
| 94 // Helper methods for performing expensive initialization tasks on the audio | 70 // Helper methods for performing expensive initialization tasks on the audio |
| 95 // thread instead of on the UI thread which AudioManager is constructed on. | 71 // thread instead of on the UI thread which AudioManager is constructed on. |
| 96 void InitializeOnAudioThread(); | 72 void InitializeOnAudioThread(); |
| 97 | 73 |
| 98 void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names); | 74 void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names); |
| 99 | 75 |
| 100 // Listen for output device changes. | 76 // Listen for output device changes. |
| 101 std::unique_ptr<AudioDeviceListenerWin> output_device_listener_; | 77 std::unique_ptr<AudioDeviceListenerWin> output_device_listener_; |
| 102 | 78 |
| 103 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); | 79 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); |
| 104 }; | 80 }; |
| 105 | 81 |
| 106 } // namespace media | 82 } // namespace media |
| 107 | 83 |
| 108 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ | 84 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ |
| OLD | NEW |