mfplat: Implement MFCompareFullToPartialMediaType().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-03-21 10:42:56 +03:00 committed by Alexandre Julliard
parent abcea9a35a
commit f3a72d4e91
4 changed files with 62 additions and 1 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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();
}

View File

@ -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);