Index: media/audio/win/core_audio_util_win.h |
diff --git a/media/audio/win/core_audio_util_win.h b/media/audio/win/core_audio_util_win.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..91517ec1767c1e343cdf5ddc75b3a989f35a307c |
--- /dev/null |
+++ b/media/audio/win/core_audio_util_win.h |
@@ -0,0 +1,98 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// TODO(henrika): add comments.... |
+ |
+// MMDevice API |
+// The Windows Multimedia Device (MMDevice) API enables audio clients to |
+// discover audio endpoint devices and determine their capabilities. |
+// |
+// WASAPI |
+// The Windows Audio Session API (WASAPI) enables client applications to |
+// manage the flow of audio data between the application and an audio endpoint |
+// device. |
+// |
+// DeviceTopology API |
+// Clients use this API to directly access the topological features |
+// (for example, volume controls and multiplexers) that lie along the data |
+// paths inside hardware devices in audio adapters. |
+// |
+// EndpointVolume API. |
+// Clients use this API to directly access the volume controls on audio |
+// endpoint devices. This API is primarily used by applications that manage |
+// exclusive-mode audio streams. |
+ |
+#ifndef MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |
+#define MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |
+ |
+#include <audioclient.h> |
+#include <mmdeviceapi.h> |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/win/scoped_comptr.h" |
+#include "media/audio/audio_device_name.h" |
+#include "media/base/media_export.h" |
+ |
+using base::win::ScopedComPtr; |
+ |
+namespace media { |
+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.
|
+ |
+// Returns true if Windows Core Audio is supported. |
+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.
|
+ |
+// --- MMDevice |
+ |
+// Number of active audio devices in the specified flow data flow direction. |
+// Set |data_flow| to eAll to retrive the total number of active audio devices. |
+MEDIA_EXPORT int NumberOfActiveAudioDevices(EDataFlow data_flow); |
+ |
+// Creates an IMMDeviceEnumerator interface which provides methods for |
+// enumerating audio endpoint devices. |
+MEDIA_EXPORT ScopedComPtr<IMMDeviceEnumerator> CreateDeviceEnumerator(); |
+ |
+// Create a default endpoint device that is specified by a data-flow |
+// direction and role, e.g. default render device. |
+MEDIA_EXPORT ScopedComPtr<IMMDevice> CreateDefaultAudioDevice( |
+ EDataFlow data_flow, ERole role); |
+ |
+// Create an endpoint device that is specified by a unique endpoint device- |
+// identification string. |
+MEDIA_EXPORT ScopedComPtr<IMMDevice> CreateAudioDevice( |
+ const std::string& device_id); |
+ |
+// Returns the unique ID and user-friendly name of a given endpoint device. |
+// Example: "{0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574}", and |
+// "Microphone (Realtek High Definition Audio)". |
+MEDIA_EXPORT HRESULT GetAudioDeviceName(IMMDevice* device, |
+ AudioDeviceName* name); |
+ |
+// Gets the user-friendly name of the endpoint devcice which is represented |
+// by a uniqe id in |device_id|. |
+MEDIA_EXPORT std::string GetFriendlyName(const std::string& device_id); |
+ |
+// Returns true if the provided uniqe |device_id| correspinds to the current |
+// default device for the specified by a data-flow direction and role. |
+MEDIA_EXPORT bool IsDeviceDefault(EDataFlow flow, ERole role, |
+ std::string device_id); |
+ |
+// Query if the audio endpoint device is a rendering device or a capture device. |
+MEDIA_EXPORT EDataFlow GetDataFlow(IMMDevice* device); |
+ |
+// --- WASAPI |
+ |
+// Create an IAudioClient interface for an existing IMMDevice given by |
+// |audio_device|. Flow direction and role is define by the |audio_device|. |
+// The IAudioClient interface enables a client to create and initialize an |
+// audio stream between an audio application and the audio engine (for a |
+// shared-mode stream) or the hardware buffer of an audio endpoint device |
+// (for an exclusive-mode stream). |
+MEDIA_EXPORT ScopedComPtr<IAudioClient> CreateAudioClient( |
+ IMMDevice* audio_device); |
+ |
+} // namespace win |
+} // namespace media |
+ |
+#endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |