mfplay: Fix IsProtected() return value.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2022-02-14 14:49:13 +03:00 committed by Alexandre Julliard
parent 28f9cd5b5d
commit a408bba226
2 changed files with 10 additions and 2 deletions

View File

@ -627,10 +627,13 @@ static HRESULT WINAPI media_item_IsProtected(IMFPMediaItem *iface, BOOL *protect
TRACE("%p, %p.\n", iface, protected); TRACE("%p, %p.\n", iface, protected);
if (!protected)
return E_POINTER;
EnterCriticalSection(&item->player->cs); EnterCriticalSection(&item->player->cs);
if (SUCCEEDED(hr = media_item_get_pd(item, &pd))) if (SUCCEEDED(hr = media_item_get_pd(item, &pd)))
{ {
*protected = MFRequireProtectedEnvironment(pd) == S_OK; *protected = (hr = MFRequireProtectedEnvironment(pd)) == S_OK;
IMFPresentationDescriptor_Release(pd); IMFPresentationDescriptor_Release(pd);
} }
LeaveCriticalSection(&item->player->cs); LeaveCriticalSection(&item->player->cs);

View File

@ -328,8 +328,10 @@ static void test_media_item(void)
hr = IMFPMediaItem_HasAudio(item, &ret, &selected); hr = IMFPMediaItem_HasAudio(item, &ret, &selected);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFPMediaItem_IsProtected(item, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IMFPMediaItem_IsProtected(item, &ret); hr = IMFPMediaItem_IsProtected(item, &ret);
todo_wine
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IMFPMediaItem_GetDuration(item, &MFP_POSITIONTYPE_100NS, &propvar); hr = IMFPMediaItem_GetDuration(item, &MFP_POSITIONTYPE_100NS, &propvar);
@ -380,6 +382,9 @@ static void test_media_item(void)
hr = IMFPMediaItem_HasAudio(item, &ret, &selected); hr = IMFPMediaItem_HasAudio(item, &ret, &selected);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
hr = IMFPMediaItem_IsProtected(item, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IMFPMediaItem_IsProtected(item, &ret); hr = IMFPMediaItem_IsProtected(item, &ret);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);