MFCreateMediaSession function

Creates the Media Session in the application's process.


HRESULT MFCreateMediaSession(
  IMFAttributes   *pConfiguration,
  IMFMediaSession **ppMediaSession



Pointer to the IMFAttributes interface. This parameter can be NULL. See Remarks.


Receives a pointer to the Media Session's IMFMediaSession interface. The caller must release the interface. Before releasing the last reference to the IMFMediaSession pointer, the application must call the IMFMediaSession::Shutdown method.

Return Value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
The function succeeded.


If your application does not play protected content, you can use this function to create the Media Session in the application's process. To use the Media Session for protected content, you must call MFCreatePMPMediaSession.

You can use the pConfiguration parameter to specify any of the following attributes:


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header mfidl.h
Library Mf.lib
DLL Mf.dll

See Also

About the Media Session


Media Foundation Functions

Media Session