mf: Add MFRequireProtectedEnvironment().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-04-05 09:10:56 +03:00 committed by Alexandre Julliard
parent ade7885529
commit c3c0e2a440
4 changed files with 60 additions and 1 deletions

View File

@ -1460,3 +1460,22 @@ HRESULT WINAPI MFCreateSimpleTypeHandler(IMFMediaTypeHandler **handler)
return S_OK;
}
HRESULT WINAPI MFRequireProtectedEnvironment(IMFPresentationDescriptor *pd)
{
BOOL selected, protected = FALSE;
unsigned int i = 0, value;
IMFStreamDescriptor *sd;
TRACE("%p.\n", pd);
while (SUCCEEDED(IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, i++, &selected, &sd)))
{
value = 0;
protected = SUCCEEDED(IMFStreamDescriptor_GetUINT32(sd, &MF_SD_PROTECTED, &value)) && value;
IMFStreamDescriptor_Release(sd);
if (protected) break;
}
return protected ? S_OK : S_FALSE;
}

View File

@ -77,7 +77,7 @@
@ stdcall MFGetSupportedSchemes(ptr)
@ stdcall MFGetTopoNodeCurrentType(ptr long long ptr)
@ stub MFReadSequencerSegmentOffset
@ stub MFRequireProtectedEnvironment
@ stdcall MFRequireProtectedEnvironment(ptr)
@ stdcall MFShutdownObject(ptr)
@ stub MFTranscodeGetAudioOutputAvailableTypes
@ stub MergePropertyStore

View File

@ -5185,6 +5185,44 @@ static void init_functions(void)
#undef X
}
static void test_MFRequireProtectedEnvironment(void)
{
IMFPresentationDescriptor *pd;
IMFMediaType *mediatype;
IMFStreamDescriptor *sd;
HRESULT hr;
hr = MFCreateMediaType(&mediatype);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = MFCreateStreamDescriptor(0, 1, &mediatype, &sd);
ok(hr == S_OK, "Failed to create stream descriptor, hr %#x.\n", hr);
hr = MFCreatePresentationDescriptor(1, &sd, &pd);
ok(hr == S_OK, "Failed to create presentation descriptor, hr %#x.\n", hr);
hr = IMFPresentationDescriptor_SelectStream(pd, 0);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = MFRequireProtectedEnvironment(pd);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMFStreamDescriptor_SetUINT32(sd, &MF_SD_PROTECTED, 1);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = MFRequireProtectedEnvironment(pd);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFPresentationDescriptor_DeselectStream(pd, 0);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = MFRequireProtectedEnvironment(pd);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IMFStreamDescriptor_Release(sd);
IMFPresentationDescriptor_Release(pd);
}
START_TEST(mf)
{
init_functions();
@ -5216,4 +5254,5 @@ START_TEST(mf)
test_sample_copier();
test_sample_copier_output_processing();
test_MFGetTopoNodeCurrentType();
test_MFRequireProtectedEnvironment();
}

View File

@ -698,6 +698,7 @@ cpp_quote("MFTIME WINAPI MFGetSystemTime(void);")
cpp_quote("HRESULT WINAPI MFGetTopoNodeCurrentType(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type);")
cpp_quote("HRESULT WINAPI MFShutdownObject(IUnknown *object);")
cpp_quote("HRESULT WINAPI MFCreateTrackedSample(IMFTrackedSample **sample);")
cpp_quote("HRESULT WINAPI MFRequireProtectedEnvironment(IMFPresentationDescriptor *pd);")
typedef enum _MFMEDIASOURCE_CHARACTERISTICS
{