Sets the object’s media type.
public:
HRESULT SetCurrentMediaType(
IMFMediaType *pMediaType
)
pMediaType
Type: IMFMediaType *
Pointer to the IMFMediaType interface of the new media type.
Type: HRESULT
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
| Return code | Description |
|---|---|
| S_OK | The method succeeded. |
| MF_E_INVALIDREQUEST | Invalid request. |
Refer to Media Foundation return codes.
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.
Header: Declared in mfidl.h.
Library: Use mfuuid.lib.