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 // Utility methods for the Core Audio API on Windows. | 5 // Utility methods for the Core Audio API on Windows. |
6 // Always ensure that Core Audio is supported before using these methods. | 6 // Always ensure that Core Audio is supported before using these methods. |
7 // Use media::CoreAudioIsSupported() for this purpose. | 7 // Use media::CoreAudioIsSupported() for this purpose. |
8 // Also, all methods must be called on a valid COM thread. This can be done | 8 // Also, all methods must be called on a valid COM thread. This can be done |
9 // by using the base::win::ScopedCOMInitializer helper class. | 9 // by using the base::win::ScopedCOMInitializer helper class. |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // the same controller so it is useful for doing things like determining | 73 // the same controller so it is useful for doing things like determining |
74 // whether a set of output and input devices belong to the same controller. | 74 // whether a set of output and input devices belong to the same controller. |
75 // The device enumerator is required as well as the device itself since | 75 // The device enumerator is required as well as the device itself since |
76 // looking at the device topology is required and we need to open up | 76 // looking at the device topology is required and we need to open up |
77 // associated devices to determine the controller id. | 77 // associated devices to determine the controller id. |
78 // If the ID could not be determined for some reason, an empty string is | 78 // If the ID could not be determined for some reason, an empty string is |
79 // returned. | 79 // returned. |
80 static std::string GetAudioControllerID(IMMDevice* device, | 80 static std::string GetAudioControllerID(IMMDevice* device, |
81 IMMDeviceEnumerator* enumerator); | 81 IMMDeviceEnumerator* enumerator); |
82 | 82 |
| 83 // Accepts an id of an input device and finds a matching output device id. |
| 84 // If the associated hardware does not have an audio output device (e.g. |
| 85 // a webcam with a mic), an empty string is returned. |
| 86 static std::string GetMatchingOutputDeviceID( |
| 87 const std::string& input_device_id); |
| 88 |
83 // Gets the user-friendly name of the endpoint device which is represented | 89 // Gets the user-friendly name of the endpoint device which is represented |
84 // by a unique id in |device_id|. | 90 // by a unique id in |device_id|. |
85 static std::string GetFriendlyName(const std::string& device_id); | 91 static std::string GetFriendlyName(const std::string& device_id); |
86 | 92 |
87 // Returns true if the provided unique |device_id| corresponds to the current | 93 // Returns true if the provided unique |device_id| corresponds to the current |
88 // default device for the specified by a data-flow direction and role. | 94 // default device for the specified by a data-flow direction and role. |
89 static bool DeviceIsDefault( | 95 static bool DeviceIsDefault( |
90 EDataFlow flow, ERole role, const std::string& device_id); | 96 EDataFlow flow, ERole role, const std::string& device_id); |
91 | 97 |
92 // Query if the audio device is a rendering device or a capture device. | 98 // Query if the audio device is a rendering device or a capture device. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 200 |
195 private: | 201 private: |
196 CoreAudioUtil() {} | 202 CoreAudioUtil() {} |
197 ~CoreAudioUtil() {} | 203 ~CoreAudioUtil() {} |
198 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); | 204 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); |
199 }; | 205 }; |
200 | 206 |
201 } // namespace media | 207 } // namespace media |
202 | 208 |
203 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | 209 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |
OLD | NEW |