Service Interfaces

Some interfaces in Media Foundation must be obtained by calling IMFGetService::GetService instead of by calling QueryInterface. The GetService method works like QueryInterface, but with the following differences:

  • It takes a service identifier GUID in addition to the interface identifier.
  • It can return a pointer to another object that implements the interface, instead of returning a pointer to the original object that is queried.


The IMFGetService interface is very similar to the IServiceProvider interface used in some other APIs.


A service is a particular interface obtained from a particular class of objects through the IMFGetService interface. The following services are defined.

Service identifier Interface Objects that might expose this service
MF_METADATA_PROVIDER_SERVICE IMFMetadataProvider Media sources
MF_MEDIASOURCE_SERVICE IMFMediaSource Supported in Windows 8.1 and later.
MF_PMP_SERVER_CONTEXT IMFPMPServer Protected media path (PMP) Media Session.
MF_QUALITY_SERVICES IMFQualityAdvise Media sources.
MF_RATE_CONTROL_SERVICE IMFRateControl Media sources, Media Session
MF_RATE_CONTROL_SERVICE IMFRateSupport Media sources, media sinks, Media Session
MF_REMOTE_PROXY IMFRemoteProxy Proxies for remote objects.
MF_SAMI_SERVICE IMFSAMIStyle Synchronized Accessible Media Interchange (SAMI) media source.
MF_SOURCE_PRESENTATION_PROVIDER_SERVICE IMFMediaSourcePresentationProvider Sequencer source
MF_TIMECODE_SERVICE IMFTimecodeTranslate ASF media source.
MF_TOPONODE_ATTRIBUTE_EDITOR_SERVICE IMFTopologyNodeAttributeEditor Media session
MF_WRAPPED_OBJECT IMFByteStream Wrapped objects
MF_WRAPPED_BUFFER_SERVICE Supported in Windows 8.1 and later.
MF_WRAPPED_SAMPLE_SERVIC Supported in Windows 8.1 and later.
MF_WORKQUEUE_SERVICES IMFWorkQueueServices Media session
MFNETSOURCE_STATISTICS_SERVICE IPropertyStore Network source. Use this service to retrieve network statistics. See MFNETSOURCE_STATISTICS Property.
MR_AUDIO_POLICY_SERVICE IMFAudioPolicy Audio renderer
MR_BUFFER_SERVICE IDirect3DSurface9 DirectX surface buffers
MR_CAPTURE_POLICY_VOLUME_SERVICE IMFSimpleAudioVolume Audio capture source
MR_POLICY_VOLUME_SERVICE IMFSimpleAudioVolume Audio renderer
MR_STREAM_VOLUME_SERVICE IMFAudioStreamVolume Audio renderer
MR_VIDEO_ACCELERATION_SERVICE IDirect3DDeviceManager9, IDirectXVideoAccelerationService Enhanced video renderer (EVR)
MR_VIDEO_ACCELERATION_SERVICE IDirectXVideoMemoryConfiguration Input pins on the DirectShow EVR filter
MR_VIDEO_ACCELERATION_SERVICE IMFVideoSampleAllocator Interface EVR stream sinks.
MR_VIDEO_MIXER_SERVICE Various interfaces exposed by the EVR mixer. See Using the Video Mixer Controls. EVR
MR_VIDEO_RENDER_SERVICE Various interfaces exposed by the EVR presenter. See Using the Video Display Controls. EVR


You must use GetService to get the interfaces listed in this table from the objects listed in this table.

In some cases, an interface is returned as a service by one class of objects, and returned through QueryInterface by another class of objects. The reference pages for each interface indicate when to use GetService and when to use QueryInterface.


An object might be implemented in such a way that it returns a service interface through QueryInterface as well as GetService. However, using QueryInterface when GetService is required might lead to compatibility problems later.


The MFGetService function is a helper function that queries an object for IMFGetService and then calls the object's GetService method.


The following example queries the Media Session for IMFGetService and gets the IMFRateControl interface.

IMFGetService *pGetService = NULL;
IMFRateControl *pRateControl = NULL;

hr = pMediaSession->QueryInterface(

if (SUCCEEDED(hr))
    hr = pGetService->GetService(
if (SUCCEEDED(hr))
    // Use IMFRateControl. (Not shown.)

// Clean up.

The following example is equivalent to the previous example but uses the MFGetService function.

IMFRateControl *pRateControl = NULL;

hr = MFGetService(
    (void**) &pRateCtl 
if (SUCCEEDED(hr))
    // Use IMFRateControl. (Not shown.)

// Clean up.

IMFGetService Interface

Media Foundation Platform APIs