IAudioClient::GetService method

The GetService method accesses additional services from the audio client object.

Syntax


HRESULT GetService(
  [in]   REFIID riid,
  [out]  void **ppv
);

Parameters

riid [in]

The interface ID for the requested service. The client should set this parameter to one of the following REFIID values:

IID_IAudioCaptureClient

IID_IAudioClock

IID_IAudioRenderClient

IID_IAudioSessionControl

IID_IAudioStreamVolume

IID_IChannelAudioVolume

IID_IMFTrustedOutput

IID_ISimpleAudioVolume

For more information, see Remarks.

ppv [out]

Pointer to a pointer variable into which the method writes the address of an instance of the requested interface. Through this method, the caller obtains a counted reference to the interface. The caller is responsible for releasing the interface, when it is no longer needed, by calling the interface's Release method. If the GetService call fails, *ppv is NULL.

Return value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return codeDescription
E_POINTER

Parameter ppv is NULL.

E_NOINTERFACE

The requested interface is not available.

AUDCLNT_E_NOT_INITIALIZED

The audio stream has not been initialized.

AUDCLNT_E_WRONG_ENDPOINT_TYPE

The caller tried to access an IAudioCaptureClient interface on a rendering endpoint, or an IAudioRenderClient interface on a capture endpoint.

AUDCLNT_E_DEVICE_INVALIDATED

The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured, disabled, removed, or otherwise made unavailable for use.

AUDCLNT_E_SERVICE_NOT_RUNNING

The Windows audio service is not running.

 

Remarks

This method requires prior initialization of the IAudioClient interface. All calls to this method will fail with the error AUDCLNT_E_NOT_INITIALIZED until the client initializes the audio stream by successfully calling the IAudioClient::Initialize method.

The GetService method supports the following service interfaces:

In Windows 7, a new service identifier, IID_IMFTrustedOutput, has been added that facilitates the use of output trust authority (OTA) objects. These objects can operate inside or outside the Media Foundation's protected media path (PMP) and send content outside the Media Foundation pipeline. If the caller is outside PMP, then the OTA may not operate in the PMP, and the protection settings are less robust. OTAs must implement the IMFTrustedOutput interface. By passing IID_IMFTrustedOutput in GetService, an application can retrieve a pointer to the object's IMFTrustedOutput interface. For more information about protected objects and IMFTrustedOutput, see "Protected Media Path" in the Media Foundation SDK documentation.

For information about using trusted audio drivers in OTAs, see Protected User Mode Audio (PUMA).

Note that activating IMFTrustedOutput through this mechanism works regardless of whether the caller is running in PMP. However, if the caller is not running in a protected process (that is, the caller is not within Media Foundation's PMP) then the audio OTA might not operate in the PMP and the protection settings are less robust.

To obtain the interface ID for a service interface, use the __uuidof operator. For example, the interface ID of IAudioCaptureClient is defined as follows:


const IID IID_IAudioCaptureClient  __uuidof(IAudioCaptureClient)

For information about the __uuidof operator, see the Windows SDK documentation.

To release the IAudioClient object and free all its associated resources, the client must release all references to any service objects that were created by calling GetService, in addition to calling Release on the IAudioClient interface itself. The client must release a service from the same thread that releases the IAudioClient object.

The IAudioSessionControl, IAudioStreamVolume, IChannelAudioVolume, and ISimpleAudioVolume interfaces control and monitor aspects of audio sessions and shared-mode streams. These interfaces do not work with exclusive-mode streams.

For code examples that call the GetService method, see the following topics:

Windows Phone 8: This API is supported.

Requirements

Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]

Header

Audioclient.h

See also

IAudioCaptureClient Interface
IAudioClient Interface
IAudioClient::Initialize
IAudioClock Interface
IAudioRenderClient Interface
IAudioSessionControl Interface
IAudioStreamVolume Interface
IChannelAudioVolume Interface
ISimpleAudioVolume Interface

 

 

Community Additions

ADD
Show:
© 2014 Microsoft