Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // TODO(henrika): add comments.... | |
| 6 | |
| 7 // MMDevice API | |
| 8 // The Windows Multimedia Device (MMDevice) API enables audio clients to | |
| 9 // discover audio endpoint devices and determine their capabilities. | |
| 10 // | |
| 11 // WASAPI | |
| 12 // The Windows Audio Session API (WASAPI) enables client applications to | |
| 13 // manage the flow of audio data between the application and an audio endpoint | |
| 14 // device. | |
| 15 // | |
| 16 // DeviceTopology API | |
| 17 // Clients use this API to directly access the topological features | |
| 18 // (for example, volume controls and multiplexers) that lie along the data | |
| 19 // paths inside hardware devices in audio adapters. | |
| 20 // | |
| 21 // EndpointVolume API. | |
| 22 // Clients use this API to directly access the volume controls on audio | |
| 23 // endpoint devices. This API is primarily used by applications that manage | |
| 24 // exclusive-mode audio streams. | |
| 25 | |
| 26 #ifndef MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | |
| 27 #define MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | |
| 28 | |
| 29 #include <audioclient.h> | |
| 30 #include <mmdeviceapi.h> | |
| 31 #include <string> | |
| 32 | |
| 33 #include "base/basictypes.h" | |
| 34 #include "base/win/scoped_comptr.h" | |
| 35 #include "media/audio/audio_device_name.h" | |
| 36 #include "media/base/media_export.h" | |
| 37 | |
| 38 using base::win::ScopedComPtr; | |
| 39 | |
| 40 namespace media { | |
| 41 namespace win { | |
|
scherkus (not reviewing)
2012/10/23 20:57:55
jam@ has a preference to avoid nested namespaces,
henrika (OOO until Aug 14)
2012/10/24 13:50:28
I will remove win namespace and modify signatures.
| |
| 42 | |
| 43 // Returns true if Windows Core Audio is supported. | |
| 44 MEDIA_EXPORT bool CoreAudioIsSupported(); | |
|
scherkus (not reviewing)
2012/10/23 20:57:55
if this returns false will some of the methods bel
henrika (OOO until Aug 14)
2012/10/24 13:50:28
Good point. Added DCHECKs in all methods.
| |
| 45 | |
| 46 // --- MMDevice | |
| 47 | |
| 48 // Number of active audio devices in the specified flow data flow direction. | |
| 49 // Set |data_flow| to eAll to retrive the total number of active audio devices. | |
| 50 MEDIA_EXPORT int NumberOfActiveAudioDevices(EDataFlow data_flow); | |
| 51 | |
| 52 // Creates an IMMDeviceEnumerator interface which provides methods for | |
| 53 // enumerating audio endpoint devices. | |
| 54 MEDIA_EXPORT ScopedComPtr<IMMDeviceEnumerator> CreateDeviceEnumerator(); | |
| 55 | |
| 56 // Create a default endpoint device that is specified by a data-flow | |
| 57 // direction and role, e.g. default render device. | |
| 58 MEDIA_EXPORT ScopedComPtr<IMMDevice> CreateDefaultAudioDevice( | |
| 59 EDataFlow data_flow, ERole role); | |
| 60 | |
| 61 // Create an endpoint device that is specified by a unique endpoint device- | |
| 62 // identification string. | |
| 63 MEDIA_EXPORT ScopedComPtr<IMMDevice> CreateAudioDevice( | |
| 64 const std::string& device_id); | |
| 65 | |
| 66 // Returns the unique ID and user-friendly name of a given endpoint device. | |
| 67 // Example: "{0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574}", and | |
| 68 // "Microphone (Realtek High Definition Audio)". | |
| 69 MEDIA_EXPORT HRESULT GetAudioDeviceName(IMMDevice* device, | |
| 70 AudioDeviceName* name); | |
| 71 | |
| 72 // Gets the user-friendly name of the endpoint devcice which is represented | |
| 73 // by a uniqe id in |device_id|. | |
| 74 MEDIA_EXPORT std::string GetFriendlyName(const std::string& device_id); | |
| 75 | |
| 76 // Returns true if the provided uniqe |device_id| correspinds to the current | |
| 77 // default device for the specified by a data-flow direction and role. | |
| 78 MEDIA_EXPORT bool IsDeviceDefault(EDataFlow flow, ERole role, | |
| 79 std::string device_id); | |
| 80 | |
| 81 // Query if the audio endpoint device is a rendering device or a capture device. | |
| 82 MEDIA_EXPORT EDataFlow GetDataFlow(IMMDevice* device); | |
| 83 | |
| 84 // --- WASAPI | |
| 85 | |
| 86 // Create an IAudioClient interface for an existing IMMDevice given by | |
| 87 // |audio_device|. Flow direction and role is define by the |audio_device|. | |
| 88 // The IAudioClient interface enables a client to create and initialize an | |
| 89 // audio stream between an audio application and the audio engine (for a | |
| 90 // shared-mode stream) or the hardware buffer of an audio endpoint device | |
| 91 // (for an exclusive-mode stream). | |
| 92 MEDIA_EXPORT ScopedComPtr<IAudioClient> CreateAudioClient( | |
| 93 IMMDevice* audio_device); | |
| 94 | |
| 95 } // namespace win | |
| 96 } // namespace media | |
| 97 | |
| 98 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | |
| OLD | NEW |