Commit a79d27c0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfmediaengine: Implement GetNumberOfStreams().

parent b9bfd74a
...@@ -2517,9 +2517,19 @@ static HRESULT WINAPI media_engine_GetPresentationAttribute(IMFMediaEngineEx *if ...@@ -2517,9 +2517,19 @@ static HRESULT WINAPI media_engine_GetPresentationAttribute(IMFMediaEngineEx *if
static HRESULT WINAPI media_engine_GetNumberOfStreams(IMFMediaEngineEx *iface, DWORD *stream_count) static HRESULT WINAPI media_engine_GetNumberOfStreams(IMFMediaEngineEx *iface, DWORD *stream_count)
{ {
FIXME("%p, %p stub.\n", iface, stream_count); struct media_engine *engine = impl_from_IMFMediaEngineEx(iface);
HRESULT hr = E_FAIL;
return E_NOTIMPL; TRACE("%p, %p.\n", iface, stream_count);
EnterCriticalSection(&engine->cs);
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
hr = MF_E_SHUTDOWN;
else if (engine->presentation.pd)
hr = IMFPresentationDescriptor_GetStreamDescriptorCount(engine->presentation.pd, stream_count);
LeaveCriticalSection(&engine->cs);
return hr;
} }
static HRESULT WINAPI media_engine_GetStreamAttribute(IMFMediaEngineEx *iface, DWORD stream_index, REFGUID attribute, static HRESULT WINAPI media_engine_GetStreamAttribute(IMFMediaEngineEx *iface, DWORD stream_index, REFGUID attribute,
......
...@@ -1035,7 +1035,7 @@ static void test_SetSourceFromByteStream(void) ...@@ -1035,7 +1035,7 @@ static void test_SetSourceFromByteStream(void)
struct media_engine_notify *notify; struct media_engine_notify *notify;
IMFMediaEngineEx *media_engine; IMFMediaEngineEx *media_engine;
PROPVARIANT propvar; PROPVARIANT propvar;
DWORD flags; DWORD count, flags;
HRESULT hr; HRESULT hr;
notify = create_callback(); notify = create_callback();
...@@ -1063,6 +1063,14 @@ static void test_SetSourceFromByteStream(void) ...@@ -1063,6 +1063,14 @@ static void test_SetSourceFromByteStream(void)
hr = IMFMediaEngineEx_GetStreamAttribute(media_engine, 0, &MF_SD_PROTECTED, &propvar); hr = IMFMediaEngineEx_GetStreamAttribute(media_engine, 0, &MF_SD_PROTECTED, &propvar);
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaEngineEx_GetNumberOfStreams(media_engine, NULL);
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
count = 123;
hr = IMFMediaEngineEx_GetNumberOfStreams(media_engine, &count);
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
ok(count == 123, "Unexpected value %lu.\n", count);
IMFMediaEngineEx_Release(media_engine); IMFMediaEngineEx_Release(media_engine);
IMFMediaEngineNotify_Release(&notify->IMFMediaEngineNotify_iface); IMFMediaEngineNotify_Release(&notify->IMFMediaEngineNotify_iface);
} }
...@@ -1203,7 +1211,7 @@ static IMFMediaEngineNotifyVtbl test_transfer_notify_vtbl = ...@@ -1203,7 +1211,7 @@ static IMFMediaEngineNotifyVtbl test_transfer_notify_vtbl =
test_transfer_notify_EventNotify, test_transfer_notify_EventNotify,
}; };
static void test_TransferVideoFrames(void) static void test_TransferVideoFrame(void)
{ {
struct test_transfer_notify notify = {{&test_transfer_notify_vtbl}}; struct test_transfer_notify notify = {{&test_transfer_notify_vtbl}};
WCHAR url[] = {L"i420-64x64.avi"}; WCHAR url[] = {L"i420-64x64.avi"};
...@@ -1267,6 +1275,11 @@ static void test_TransferVideoFrames(void) ...@@ -1267,6 +1275,11 @@ static void test_TransferVideoFrames(void)
goto done; goto done;
} }
res = 0;
hr = IMFMediaEngineEx_GetNumberOfStreams(media_engine, &res);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(res == 1, "Unexpected stream count %lu.\n", res);
/* FIXME: Wine first video frame is often full of garbage, wait for another update */ /* FIXME: Wine first video frame is often full of garbage, wait for another update */
res = WaitForSingleObject(notify.ready_event, 500); res = WaitForSingleObject(notify.ready_event, 500);
/* It's also missing the MF_MEDIA_ENGINE_EVENT_TIMEUPDATE notifications */ /* It's also missing the MF_MEDIA_ENGINE_EVENT_TIMEUPDATE notifications */
...@@ -1343,7 +1356,7 @@ START_TEST(mfmediaengine) ...@@ -1343,7 +1356,7 @@ START_TEST(mfmediaengine)
test_time_range(); test_time_range();
test_SetSourceFromByteStream(); test_SetSourceFromByteStream();
test_audio_configuration(); test_audio_configuration();
test_TransferVideoFrames(); test_TransferVideoFrame();
IMFMediaEngineClassFactory_Release(factory); IMFMediaEngineClassFactory_Release(factory);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment