IMFMediaTypeHandler::SetCurrentMediaType Method

Sets the object’s media type.

Syntax

public:
HRESULT SetCurrentMediaType(
         IMFMediaType *pMediaType
)  

Parameters

pMediaType
Type: IMFMediaType *

Pointer to the IMFMediaType interface of the new media type.

Return value

Type: HRESULT 

The method 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_INVALIDREQUEST Invalid request.

Refer to Media Foundation return codes.

Remarks

For media sources, setting the media type means the source will generate data that conforms to that media type. For media sinks, setting the media type means the sink can receive data that conforms to that media type.

Any implementation of this method should check whether pMediaType differs from the object’s current media type. If the types are identical, the method should return S_OK but avoid releasing and recreating resources unnecessarily. If the types are not identical, the method should validate the new type.

Requirements

Header: Declared in mfidl.h.

Library: Use mfuuid.lib.