IMFMediaType::IsEqual method (mfobjects.h)

Compares two media types and determines whether they are identical. If they are not identical, the method indicates how the two formats differ.

Syntax

HRESULT IsEqual(
  [in]  IMFMediaType *pIMediaType,
  [out] DWORD        *pdwFlags
);

Parameters

[in] pIMediaType

Pointer to the IMFMediaType interface of the media type to compare.

[out] pdwFlags

Receives a bitwise OR of zero or more flags, indicating the degree of similarity between the two media types. The following flags are defined.

Value Meaning
MF_MEDIATYPE_EQUAL_MAJOR_TYPES
0x00000001
The major types are the same. The major type is specified by the MF_MT_MAJOR_TYPE attribute.
MF_MEDIATYPE_EQUAL_FORMAT_TYPES
0x00000002
The subtypes are the same, or neither media type has a subtype. The subtype is specified by the MF_MT_SUBTYPE attribute.
MF_MEDIATYPE_EQUAL_FORMAT_DATA
0x00000004
The attributes in one of the media types are a subset of the attributes in the other, and the values of these attributes match, excluding the value of the MF_MT_USER_DATA, MF_MT_FRAME_RATE_RANGE_MIN, and MF_MT_FRAME_RATE_RANGE_MAX attributes.

Specifically, the method takes the media type with the smaller number of attributes and checks whether each attribute from that type is present in the other media type and has the same value (not including MF_MT_USER_DATA, MF_MT_FRAME_RATE_RANGE_MIN, and MF_MT_FRAME_RATE_RANGE_MAX).

To perform other comparisons, use the IMFAttributes::Compare method. For example, the Compare method can test for identical attributes, or test the intersection of the two attribute sets. For more information, see MF_ATTRIBUTES_MATCH_TYPE.

MF_MEDIATYPE_EQUAL_FORMAT_USER_DATA
0x00000008
The user data is identical, or neither media type contains user data. User data is specified by the MF_MT_USER_DATA attribute.

Return value

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

Return code Description
S_FALSE
The types are not equal. Examine the pdwFlags parameter to determine how the types differ.
S_OK
The types are equal.
E_INVALIDARG
One or both media types are invalid.

Remarks

Both of the media types must have a major type, or the method returns E_INVALIDARG.

If the method succeeds and all of the comparison flags are set in pdwFlags, the return value is S_OK. If the method succeeds but one or more comparison flags are not set, the method returns S_FALSE.

This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header mfobjects.h (include Mfidl.h)
Library Mfuuid.lib

See also

IMFAttributes::Compare

IMFMediaType