mfmediaengine/tests: Add tests for audio effects.

This commit is contained in:
Bernhard Kölbl 2023-07-04 18:54:37 +02:00 committed by Alexandre Julliard
parent 2238658e2f
commit 096b46cf8d
4 changed files with 50 additions and 8 deletions

View file

@ -1,5 +1,5 @@
TESTDLL = mfmediaengine.dll
IMPORTS = ole32 mfplat oleaut32 mfuuid uuid
IMPORTS = ole32 mf mfplat oleaut32 mfuuid uuid
C_SRCS = \
mfmediaengine.c

View file

@ -1307,7 +1307,7 @@ static void test_TransferVideoFrame(void)
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);
ok(res == 2, "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);
@ -1483,7 +1483,7 @@ static HRESULT WINAPI passthrough_mft_AddInputStreams(IMFTransform *iface, DWORD
static HRESULT WINAPI passthrough_mft_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index,
IMFMediaType **type)
{
static const GUID *types[] = { &MFMediaType_Video };
static const GUID *types[] = { &MFMediaType_Video, &MFMediaType_Audio };
HRESULT hr;
if (id)
@ -1772,9 +1772,9 @@ HRESULT passthrough_mft_create(UINT32 index, struct passthrough_mft **out)
return S_OK;
}
static void test_video_effect(void)
static void test_effect(void)
{
struct passthrough_mft *video_effect = NULL, *video_effect2 = NULL;
struct passthrough_mft *video_effect = NULL, *video_effect2 = NULL, *audio_effect = NULL, *audio_effect2 = NULL;
struct test_transfer_notify *notify;
IMFMediaEngineEx *media_engine_ex = NULL;
ID3D11Texture2D *texture = NULL;
@ -1782,6 +1782,7 @@ static void test_video_effect(void)
ID3D11Device *device = NULL;
D3D11_TEXTURE2D_DESC desc;
IMFByteStream *stream;
IMFMediaSink *sink;
RECT dst_rect;
UINT token;
HRESULT hr;
@ -1836,6 +1837,20 @@ static void test_video_effect(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(&video_effect2->IMFTransform_iface, 2);
hr = passthrough_mft_create(0, &audio_effect);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = passthrough_mft_create(1, &audio_effect2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaEngineEx_InsertAudioEffect(media_engine_ex, (IUnknown *)&audio_effect->IMFTransform_iface, FALSE);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine EXPECT_REF(&audio_effect->IMFTransform_iface, 2);
hr = IMFMediaEngineEx_InsertAudioEffect(media_engine_ex, (IUnknown *)&audio_effect2->IMFTransform_iface, FALSE);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine EXPECT_REF(&audio_effect2->IMFTransform_iface, 2);
url = SysAllocString(L"i420-64x64.avi");
hr = IMFMediaEngineEx_SetSourceFromByteStream(media_engine_ex, stream, url);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
@ -1858,6 +1873,21 @@ static void test_video_effect(void)
ok(video_effect->processing_count > 0, "Unexpected processing count %lu.\n", video_effect->processing_count);
ok(video_effect2->processing_count > 0, "Unexpected processing count %lu.\n", video_effect2->processing_count);
if (SUCCEEDED(hr = MFCreateAudioRenderer(NULL, &sink)))
{
todo_wine
ok(audio_effect->processing_count > 0, "Unexpected processing count %lu.\n", audio_effect->processing_count);
todo_wine
ok(audio_effect2->processing_count > 0, "Unexpected processing count %lu.\n", audio_effect2->processing_count);
IMFMediaSink_Release(sink);
}
else if (hr == MF_E_NO_AUDIO_PLAYBACK_DEVICE)
{
ok(!audio_effect->processing_count, "Unexpected processing count %lu.\n", audio_effect->processing_count);
ok(!audio_effect2->processing_count, "Unexpected processing count %lu.\n", audio_effect2->processing_count);
}
done:
if (media_engine_ex)
{
@ -1872,6 +1902,17 @@ done:
if (device)
ID3D11Device_Release(device);
if (audio_effect2)
{
ref = IMFTransform_Release(&audio_effect2->IMFTransform_iface);
ok(!ref, "Unexpected ref %lu.\n", ref);
}
if (audio_effect)
{
ref = IMFTransform_Release(&audio_effect->IMFTransform_iface);
ok(!ref, "Unexpected ref %lu.\n", ref);
}
if (video_effect2)
{
ref = IMFTransform_Release(&video_effect2->IMFTransform_iface);
@ -1917,7 +1958,7 @@ START_TEST(mfmediaengine)
test_SetSourceFromByteStream();
test_audio_configuration();
test_TransferVideoFrame();
test_video_effect();
test_effect();
IMFMediaEngineClassFactory_Release(factory);

View file

@ -21,8 +21,9 @@
/* Generated with:
* gst-launch-1.0 videotestsrc num-buffers=4 pattern=smpte100 ! \
* video/x-raw,format=I420,width=64,height=64,framerate=30000/1001 ! \
* videoflip method=clockwise ! videoconvert ! \
* avimux ! filesink location=dlls/mfmediaengine/tests/i420-64x64.avi
* videoflip method=clockwise ! videoconvert ! queue ! mux. \
* audiotestsrc num-buffers=4 ! audioconvert ! audio/x-raw,rate=44100,channels=2 ! queue ! mux. \
* avimux name=mux ! filesink location=dlls/mfmediaengine/tests/i420-64x64.avi
*/
/* @makedep: i420-64x64.avi */
i420-64x64.avi RCDATA i420-64x64.avi