mfplat/tests: Fix a crash on Vista.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-02-04 12:49:15 +03:00 committed by Alexandre Julliard
parent 3b3dfda599
commit 9ec297e283
1 changed files with 27 additions and 21 deletions

View File

@ -136,6 +136,7 @@ static DXGI_FORMAT (WINAPI *pMFMapDX9FormatToDXGIFormat)(DWORD format);
static HRESULT (WINAPI *pMFCreateVideoSampleAllocatorEx)(REFIID riid, void **allocator); static HRESULT (WINAPI *pMFCreateVideoSampleAllocatorEx)(REFIID riid, void **allocator);
static HRESULT (WINAPI *pMFCreateDXGISurfaceBuffer)(REFIID riid, IUnknown *surface, UINT subresource, BOOL bottomup, static HRESULT (WINAPI *pMFCreateDXGISurfaceBuffer)(REFIID riid, IUnknown *surface, UINT subresource, BOOL bottomup,
IMFMediaBuffer **buffer); IMFMediaBuffer **buffer);
static HRESULT (WINAPI *pMFCreateVideoMediaTypeFromSubtype)(const GUID *subtype, IMFVideoMediaType **media_type);
static HWND create_window(void) static HWND create_window(void)
{ {
@ -799,6 +800,7 @@ static void init_functions(void)
X(MFCreateMFByteStreamOnStream); X(MFCreateMFByteStreamOnStream);
X(MFCreateTrackedSample); X(MFCreateTrackedSample);
X(MFCreateTransformActivate); X(MFCreateTransformActivate);
X(MFCreateVideoMediaTypeFromSubtype);
X(MFCreateVideoSampleAllocatorEx); X(MFCreateVideoSampleAllocatorEx);
X(MFGetPlaneSize); X(MFGetPlaneSize);
X(MFGetStrideForBitmapInfoHeader); X(MFGetStrideForBitmapInfoHeader);
@ -965,29 +967,33 @@ if(0)
IUnknown_Release(unk2); IUnknown_Release(unk2);
IUnknown_Release(unk); IUnknown_Release(unk);
hr = MFCreateVideoMediaTypeFromSubtype(&MFVideoFormat_RGB555, &video_type);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
check_interface(video_type, &IID_IMFMediaType, TRUE);
check_interface(video_type, &IID_IMFVideoMediaType, TRUE);
/* Major and subtype are set on creation. */
hr = IMFVideoMediaType_GetCount(video_type, &count);
ok(count == 2, "Unexpected attribute count %#x.\n", hr);
hr = IMFVideoMediaType_DeleteAllItems(video_type);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoMediaType_GetCount(video_type, &count);
ok(!count, "Unexpected attribute count %#x.\n", hr);
check_interface(video_type, &IID_IMFVideoMediaType, FALSE);
IMFVideoMediaType_Release(video_type);
IMFMediaType_Release(mediatype); IMFMediaType_Release(mediatype);
if (pMFCreateVideoMediaTypeFromSubtype)
{
hr = pMFCreateVideoMediaTypeFromSubtype(&MFVideoFormat_RGB555, &video_type);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
check_interface(video_type, &IID_IMFMediaType, TRUE);
check_interface(video_type, &IID_IMFVideoMediaType, TRUE);
/* Major and subtype are set on creation. */
hr = IMFVideoMediaType_GetCount(video_type, &count);
ok(count == 2, "Unexpected attribute count %#x.\n", hr);
hr = IMFVideoMediaType_DeleteAllItems(video_type);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoMediaType_GetCount(video_type, &count);
ok(!count, "Unexpected attribute count %#x.\n", hr);
check_interface(video_type, &IID_IMFVideoMediaType, FALSE);
IMFVideoMediaType_Release(video_type);
}
else
win_skip("MFCreateVideoMediaTypeFromSubtype() is not available.\n");
/* IMFAudioMediaType */ /* IMFAudioMediaType */
hr = MFCreateMediaType(&mediatype); hr = MFCreateMediaType(&mediatype);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);