diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index bb338a4423f..a191448b69f 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -2504,9 +2504,28 @@ static HRESULT WINAPI media_engine_GetNumberOfStreams(IMFMediaEngineEx *iface, D static HRESULT WINAPI media_engine_GetStreamAttribute(IMFMediaEngineEx *iface, DWORD stream_index, REFGUID attribute, PROPVARIANT *value) { - FIXME("%p, %ld, %s, %p stub.\n", iface, stream_index, debugstr_guid(attribute), value); + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + IMFStreamDescriptor *sd; + HRESULT hr = E_FAIL; + BOOL selected; - return E_NOTIMPL; + TRACE("%p, %ld, %s, %p.\n", iface, stream_index, debugstr_guid(attribute), value); + + EnterCriticalSection(&engine->cs); + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else if (engine->presentation.pd) + { + if (SUCCEEDED(hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(engine->presentation.pd, + stream_index, &selected, &sd))) + { + hr = IMFStreamDescriptor_GetItem(sd, attribute, value); + IMFStreamDescriptor_Release(sd); + } + } + LeaveCriticalSection(&engine->cs); + + return hr; } static HRESULT WINAPI media_engine_GetStreamSelection(IMFMediaEngineEx *iface, DWORD stream_index, BOOL *enabled) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 0eaf614fc66..ea2f570d721 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -497,6 +497,9 @@ static void test_Shutdown(void) hr = IMFMediaEngineEx_GetPresentationAttribute(media_engine_ex, &MF_PD_DURATION, &propvar); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaEngineEx_GetStreamAttribute(media_engine_ex, 0, &MF_SD_PROTECTED, &propvar); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + IMFMediaEngineEx_Release(media_engine_ex); } @@ -935,6 +938,9 @@ static void test_SetSourceFromByteStream(void) hr = IMFMediaEngineEx_GetPresentationAttribute(media_engine, &MF_PD_DURATION, &propvar); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaEngineEx_GetStreamAttribute(media_engine, 0, &MF_SD_PROTECTED, &propvar); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + IMFMediaEngineEx_Release(media_engine); IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface); }