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

mfplat: Implement MFCompareFullToPartialMediaType().

parent abcea9a3
......@@ -1496,3 +1496,22 @@ HRESULT WINAPI MFCalculateImageSize(REFGUID subtype, UINT32 width, UINT32 height
return format ? S_OK : E_INVALIDARG;
}
/***********************************************************************
* MFCompareFullToPartialMediaType (mfplat.@)
*/
BOOL WINAPI MFCompareFullToPartialMediaType(IMFMediaType *full_type, IMFMediaType *partial_type)
{
BOOL result;
GUID major;
TRACE("%p, %p.\n", full_type, partial_type);
if (FAILED(IMFMediaType_GetMajorType(partial_type, &major)))
return FALSE;
if (FAILED(IMFMediaType_Compare(partial_type, (IMFAttributes *)full_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &result)))
return FALSE;
return result;
}
......@@ -29,7 +29,7 @@
@ stdcall MFCalculateImageSize(ptr long long ptr)
@ stub MFCancelCreateFile
@ stdcall MFCancelWorkItem(int64)
@ stub MFCompareFullToPartialMediaType
@ stdcall MFCompareFullToPartialMediaType(ptr ptr)
@ stub MFCompareSockaddrAddresses
@ stub MFConvertColorInfoFromDXVA
@ stub MFConvertColorInfoToDXVA
......
......@@ -2480,6 +2480,46 @@ static void test_MFCalculateImageSize(void)
}
}
static void test_MFCompareFullToPartialMediaType(void)
{
IMFMediaType *full_type, *partial_type;
HRESULT hr;
BOOL ret;
hr = MFCreateMediaType(&full_type);
ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
hr = MFCreateMediaType(&partial_type);
ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
ret = MFCompareFullToPartialMediaType(full_type, partial_type);
ok(!ret, "Unexpected result %d.\n", ret);
hr = IMFMediaType_SetGUID(full_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
ok(hr == S_OK, "Failed to set major type, hr %#x.\n", hr);
hr = IMFMediaType_SetGUID(partial_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
ok(hr == S_OK, "Failed to set major type, hr %#x.\n", hr);
ret = MFCompareFullToPartialMediaType(full_type, partial_type);
ok(ret, "Unexpected result %d.\n", ret);
hr = IMFMediaType_SetGUID(full_type, &MF_MT_SUBTYPE, &MFMediaType_Audio);
ok(hr == S_OK, "Failed to set major type, hr %#x.\n", hr);
ret = MFCompareFullToPartialMediaType(full_type, partial_type);
ok(ret, "Unexpected result %d.\n", ret);
hr = IMFMediaType_SetGUID(partial_type, &MF_MT_SUBTYPE, &MFMediaType_Video);
ok(hr == S_OK, "Failed to set major type, hr %#x.\n", hr);
ret = MFCompareFullToPartialMediaType(full_type, partial_type);
ok(!ret, "Unexpected result %d.\n", ret);
IMFMediaType_Release(full_type);
IMFMediaType_Release(partial_type);
}
START_TEST(mfplat)
{
CoInitialize(NULL);
......@@ -2510,6 +2550,7 @@ START_TEST(mfplat)
test_MFInvokeCallback();
test_stream_descriptor();
test_MFCalculateImageSize();
test_MFCompareFullToPartialMediaType();
CoUninitialize();
}
......@@ -188,6 +188,7 @@ HRESULT WINAPI MFAllocateWorkQueue(DWORD *queue);
HRESULT WINAPI MFAllocateWorkQueueEx(MFASYNC_WORKQUEUE_TYPE queue_type, DWORD *queue);
HRESULT WINAPI MFCalculateImageSize(REFGUID subtype, UINT32 width, UINT32 height, UINT32 *size);
HRESULT WINAPI MFCancelWorkItem(MFWORKITEM_KEY key);
BOOL WINAPI MFCompareFullToPartialMediaType(IMFMediaType *full_type, IMFMediaType *partial_type);
HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines);
HRESULT WINAPI MFCreateAlignedMemoryBuffer(DWORD max_length, DWORD alignment, IMFMediaBuffer **buffer);
HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size);
......
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