Export (0) Print
Expand All
Expand Minimize

MFInitVideoFormat function

[This API is not supported and may be altered or unavailable in the future. Applications should avoid using the MFVIDEOFORMAT structure, and use media type attributes instead. For more information, see Video Media Types.]

Initializes an MFVIDEOFORMAT structure for a standard video format such as DVD, analog television, or ATSC digital television.

Syntax


HRESULT MFInitVideoFormat(
  _Out_  MFVIDEOFORMAT *pVideoFormat,
  _In_   MFStandardVideoFormat type
);

Parameters

pVideoFormat [out]

A pointer to an MFVIDEOFORMAT structure. The function fills in the structure members based on the video format specified in the type parameter.

type [in]

The video format, specified as a member of the MFStandardVideoFormat enumeration.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Note  Prior to Windows 7, this function was exported from evr.dll. Starting in Windows 7, this function is exported from mfplat.dll, and evr.dll exports a stub function that calls into mfplat.dll. For more information, see Library Changes in Windows 7.

Examples

The following example creates a media type object for a standard video format.


// Creates a media type for a standard video format.
HRESULT CreateStandardVideoMediaType(MFStandardVideoFormat type, IMFMediaType **ppMediaType)
{
    IMFMediaType *pMediaType = NULL;

    MFVIDEOFORMAT format;

    // Fill in the MFVIDEOFORMAT structure for the video format.
    HRESULT hr = MFInitVideoFormat(&format, type);
    if (FAILED(hr))
    {
        goto done;
    }

    // Create a new (empty) media type.
    hr = MFCreateMediaType(&pMediaType);
    if (FAILED(hr))
    {
        goto done;
    }

    // Initialize the media type from the MFVIDEOFORMAT structure.
    hr = MFInitMediaTypeFromMFVideoFormat(pMediaType, &format, sizeof(format));
    if (FAILED(hr))
    {
        goto done;
    }

    // Return the pointer to the caller.
    *ppMediaType = pMediaType;
    (*ppMediaType)->AddRef();

done:
    SafeRelease(&pMediaType);
    return hr;
}


Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Mfapi.h

Library

Evr.lib

DLL

Mfplat.dll

See also

Media Foundation Functions
Media Types
Video Media Types

 

 

Community Additions

ADD
Show:
© 2014 Microsoft