mmdevapi/tests: Make capture.c more easily extendible.
This commit is contained in:
parent
e8f3d4736a
commit
631d834022
|
@ -34,6 +34,8 @@
|
||||||
#include "mmdeviceapi.h"
|
#include "mmdeviceapi.h"
|
||||||
#include "audioclient.h"
|
#include "audioclient.h"
|
||||||
|
|
||||||
|
static IMMDevice *dev = NULL;
|
||||||
|
|
||||||
static void test_uninitialized(IAudioClient *ac)
|
static void test_uninitialized(IAudioClient *ac)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -137,15 +139,23 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx)
|
||||||
IUnknown_Release(acc);
|
IUnknown_Release(acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_audioclient(IAudioClient *ac)
|
static void test_audioclient(void)
|
||||||
{
|
{
|
||||||
|
IAudioClient *ac;
|
||||||
IUnknown *unk;
|
IUnknown *unk;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
WAVEFORMATEX *pwfx, *pwfx2;
|
WAVEFORMATEX *pwfx, *pwfx2;
|
||||||
REFERENCE_TIME t1, t2;
|
REFERENCE_TIME t1, t2;
|
||||||
|
HANDLE handle;
|
||||||
|
|
||||||
HANDLE handle = CreateEventW(NULL, FALSE, FALSE, NULL);
|
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
|
||||||
|
NULL, (void**)&ac);
|
||||||
|
ok(hr == S_OK, "Activation failed with %08x\n", hr);
|
||||||
|
if(hr != S_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
handle = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
|
|
||||||
hr = IAudioClient_QueryInterface(ac, &IID_IUnknown, NULL);
|
hr = IAudioClient_QueryInterface(ac, &IID_IUnknown, NULL);
|
||||||
ok(hr == E_POINTER, "QueryInterface(NULL) returned %08x\n", hr);
|
ok(hr == E_POINTER, "QueryInterface(NULL) returned %08x\n", hr);
|
||||||
|
@ -290,6 +300,7 @@ static void test_audioclient(IAudioClient *ac)
|
||||||
|
|
||||||
test_capture(ac, handle, pwfx);
|
test_capture(ac, handle, pwfx);
|
||||||
|
|
||||||
|
IAudioClient_Release(ac);
|
||||||
CloseHandle(handle);
|
CloseHandle(handle);
|
||||||
CoTaskMemFree(pwfx);
|
CoTaskMemFree(pwfx);
|
||||||
}
|
}
|
||||||
|
@ -298,8 +309,6 @@ START_TEST(capture)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IMMDeviceEnumerator *mme = NULL;
|
IMMDeviceEnumerator *mme = NULL;
|
||||||
IMMDevice *dev = NULL;
|
|
||||||
IAudioClient *ac = NULL;
|
|
||||||
|
|
||||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme);
|
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme);
|
||||||
|
@ -320,13 +329,8 @@ START_TEST(capture)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac);
|
test_audioclient();
|
||||||
ok(hr == S_OK, "Activation failed with %08x\n", hr);
|
|
||||||
if (ac)
|
|
||||||
{
|
|
||||||
test_audioclient(ac);
|
|
||||||
IAudioClient_Release(ac);
|
|
||||||
}
|
|
||||||
IMMDevice_Release(dev);
|
IMMDevice_Release(dev);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
Loading…
Reference in New Issue