Commit ad4c734c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Fix media type compare logic regarding user data.

parent d38bd69b
......@@ -514,13 +514,14 @@ static HRESULT WINAPI mediatype_IsEqual(IMFMediaType *iface, IMFMediaType *type,
PropVariantInit(&right.value);
right.hr = IMFAttributes_GetItem(right.type, &MF_MT_USER_DATA, &right.value);
if (SUCCEEDED(left.hr) && SUCCEEDED(left.hr))
/* Compare user data if both types have it, otherwise simply check if both don't. */
if (SUCCEEDED(left.hr) && SUCCEEDED(right.hr))
{
result = FALSE;
IMFAttributes_CompareItem(left.type, &MF_MT_USER_DATA, &left.value, &result);
}
else if (FAILED(left.hr) && FAILED(left.hr))
result = TRUE;
else
result = FAILED(left.hr) && FAILED(right.hr);
PropVariantClear(&left.value);
PropVariantClear(&right.value);
......
......@@ -762,6 +762,19 @@ if(0)
ok(flags == (MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA
| MF_MEDIATYPE_EQUAL_FORMAT_USER_DATA), "Unexpected flags %#x.\n", flags);
/* Different user data. */
hr = IMFMediaType_SetBlob(mediatype, &MF_MT_USER_DATA, (const UINT8 *)&flags, sizeof(flags));
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
flags = 0;
hr = IMFMediaType_IsEqual(mediatype, mediatype2, &flags);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
ok(flags == (MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA),
"Unexpected flags %#x.\n", flags);
hr = IMFMediaType_DeleteItem(mediatype, &MF_MT_USER_DATA);
ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr);
hr = IMFMediaType_SetGUID(mediatype, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32);
ok(hr == S_OK, "Failed to set subtype, hr %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment