MFStartup

Initializes Microsoft Media Foundation.

Syntax

HRESULT MFStartup(
         ULONG Version,
         DWORD dwFlags
)  

Parameters

Version
Type: ULONG 

Version number. Use the value MF_VERSION, defined in mfapi.h.

dwFlags
Type: DWORD 

This parameter is optional when using C++ but required in C. The value must be one of the following flags:

Value Meaning
MFSTARTUP_NOSOCKET Do not initialize the sockets library.
MFSTARTUP_LITE Equivalent to MFSTARTUP_NOSOCKET.
MFSTARTUP_FULL Initialize the entire Media Foundation platform. This is the default value when dwFlags is not specified.

Return value

Type: HRESULT 

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

Return codes
Return code Description
S_OK The method succeeded.
MF_E_BAD_STARTUP_VERSION The Version parameter requires a newer version of Microsoft Media Foundation than the version that is running.
MF_E_DISABLED_IN_SAFEMODE The Media Foundation platform is disabled because the system was started in “Safe Mode” (fail-safe boot).
E_NOTIMPL Media Foundation is not implemented on the system. This error can occur if the media components are not present (See KB2703761 for more info).

Refer to Media Foundation return codes.

Remarks

An application must call this function before using Media Foundation. Before your application quits, call MFShutdown once for every previous call to MFStartup.

Do not call MFStartup or MFShutdown from work queue threads. For more information about work queues, see Work Queues.

Requirements

Header: Declared in mfapi.h.

Library: Use mfplat.lib.