mfmediaengine: Implement GetNumberOfStreams().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-05-16 23:12:28 +02:00 committed by Alexandre Julliard
parent b9bfd74acc
commit a79d27c04a
2 changed files with 28 additions and 5 deletions

View file

@ -2517,9 +2517,19 @@ static HRESULT WINAPI media_engine_GetPresentationAttribute(IMFMediaEngineEx *if
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,

View file

@ -1035,7 +1035,7 @@ static void test_SetSourceFromByteStream(void)
struct media_engine_notify *notify;
IMFMediaEngineEx *media_engine;
PROPVARIANT propvar;
DWORD flags;
DWORD count, flags;
HRESULT hr;
notify = create_callback();
@ -1063,6 +1063,14 @@ static void test_SetSourceFromByteStream(void)
hr = IMFMediaEngineEx_GetStreamAttribute(media_engine, 0, &MF_SD_PROTECTED, &propvar);
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);
IMFMediaEngineNotify_Release(&notify->IMFMediaEngineNotify_iface);
}
@ -1203,7 +1211,7 @@ static IMFMediaEngineNotifyVtbl test_transfer_notify_vtbl =
test_transfer_notify_EventNotify,
};
static void test_TransferVideoFrames(void)
static void test_TransferVideoFrame(void)
{
struct test_transfer_notify notify = {{&test_transfer_notify_vtbl}};
WCHAR url[] = {L"i420-64x64.avi"};
@ -1267,6 +1275,11 @@ static void test_TransferVideoFrames(void)
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 */
res = WaitForSingleObject(notify.ready_event, 500);
/* It's also missing the MF_MEDIA_ENGINE_EVENT_TIMEUPDATE notifications */
@ -1343,7 +1356,7 @@ START_TEST(mfmediaengine)
test_time_range();
test_SetSourceFromByteStream();
test_audio_configuration();
test_TransferVideoFrames();
test_TransferVideoFrame();
IMFMediaEngineClassFactory_Release(factory);