[PATCH 4/6] mmdevapi: Implement SetClientProperties
Andrew Eikum
aeikum at codeweavers.com
Thu Oct 1 14:31:32 CDT 2020
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
dlls/mmdevapi/tests/render.c | 25 +++++++++++++++++++++++++
dlls/winealsa.drv/mmdevdrv.c | 18 ++++++++++++++++--
dlls/wineandroid.drv/mmdevdrv.c | 18 ++++++++++++++++--
dlls/winecoreaudio.drv/mmdevdrv.c | 18 ++++++++++++++++--
dlls/wineoss.drv/mmdevdrv.c | 18 ++++++++++++++++--
dlls/winepulse.drv/mmdevdrv.c | 18 ++++++++++++++++--
6 files changed, 105 insertions(+), 10 deletions(-)
diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
index e58cc449d86..a4f271e557e 100644
--- a/dlls/mmdevapi/tests/render.c
+++ b/dlls/mmdevapi/tests/render.c
@@ -141,6 +141,7 @@ static void test_audioclient(void)
REFERENCE_TIME t1, t2;
HANDLE handle;
BOOL offload_capable;
+ AudioClientProperties client_props;
hr = IMMDevice_Activate(dev, &IID_IAudioClient2, CLSCTX_INPROC_SERVER,
NULL, (void**)&ac2);
@@ -260,6 +261,30 @@ static void test_audioclient(void)
hr = IAudioClient2_IsOffloadCapable(ac2, AudioCategory_BackgroundCapableMedia, &offload_capable);
ok(hr == S_OK, "IsOffloadCapable failed: %08x\n", hr);
+ hr = IAudioClient2_SetClientProperties(ac2, NULL);
+ ok(hr == E_POINTER, "SetClientProperties with NULL props gave wrong error: %08x\n", hr);
+
+ client_props.cbSize = 0;
+ client_props.bIsOffload = FALSE;
+ client_props.eCategory = AudioCategory_BackgroundCapableMedia;
+ client_props.Options = 0;
+
+ hr = IAudioClient2_SetClientProperties(ac2, &client_props);
+ ok(hr == E_INVALIDARG, "SetClientProperties with invalid cbSize gave wrong error: %08x\n", hr);
+
+ client_props.cbSize = sizeof(client_props);
+ client_props.bIsOffload = TRUE;
+
+ hr = IAudioClient2_SetClientProperties(ac2, &client_props);
+ if(!offload_capable)
+ ok(hr == AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE, "SetClientProperties(offload) gave wrong error: %08x\n", hr);
+ else
+ ok(hr == S_OK, "SetClientProperties(offload) failed: %08x\n", hr);
+
+ client_props.bIsOffload = FALSE;
+ hr = IAudioClient2_SetClientProperties(ac2, &client_props);
+ ok(hr == S_OK, "SetClientProperties failed: %08x\n", hr);
+
IAudioClient2_Release(ac2);
test_uninitialized(ac);
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 233b0dfda11..04f90d0d168 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -2676,9 +2676,23 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient2 *iface,
{
ACImpl *This = impl_from_IAudioClient2(iface);
- FIXME("(%p)->(%p)\n", This, prop);
+ TRACE("(%p)->(%p)\n", This, prop);
- return E_NOTIMPL;
+ if(!prop)
+ return E_POINTER;
+
+ if(prop->cbSize != sizeof(*prop))
+ return E_INVALIDARG;
+
+ TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
+ prop->bIsOffload,
+ prop->eCategory,
+ prop->Options);
+
+ if(prop->bIsOffload)
+ return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
+
+ return S_OK;
}
static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient2 *iface,
diff --git a/dlls/wineandroid.drv/mmdevdrv.c b/dlls/wineandroid.drv/mmdevdrv.c
index 8ee1bb12d35..aa32c491855 100644
--- a/dlls/wineandroid.drv/mmdevdrv.c
+++ b/dlls/wineandroid.drv/mmdevdrv.c
@@ -1635,9 +1635,23 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient2 *iface,
{
ACImpl *This = impl_from_IAudioClient2(iface);
- FIXME("(%p)->(%p)\n", This, prop);
+ TRACE("(%p)->(%p)\n", This, prop);
- return E_NOTIMPL;
+ if(!prop)
+ return E_POINTER;
+
+ if(prop->cbSize != sizeof(*prop))
+ return E_INVALIDARG;
+
+ TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
+ prop->bIsOffload,
+ prop->eCategory,
+ prop->Options);
+
+ if(prop->bIsOffload)
+ return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
+
+ return S_OK;
}
static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient2 *iface,
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index f32c1d5e417..f065d5bc1ef 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -2243,9 +2243,23 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient2 *iface,
{
ACImpl *This = impl_from_IAudioClient2(iface);
- FIXME("(%p)->(%p)\n", This, prop);
+ TRACE("(%p)->(%p)\n", This, prop);
- return E_NOTIMPL;
+ if(!prop)
+ return E_POINTER;
+
+ if(prop->cbSize != sizeof(*prop))
+ return E_INVALIDARG;
+
+ TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
+ prop->bIsOffload,
+ prop->eCategory,
+ prop->Options);
+
+ if(prop->bIsOffload)
+ return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
+
+ return S_OK;
}
static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient2 *iface,
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index 9b1cdf3fa7c..3a3cb57b642 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -1800,9 +1800,23 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient2 *iface,
{
ACImpl *This = impl_from_IAudioClient2(iface);
- FIXME("(%p)->(%p)\n", This, prop);
+ TRACE("(%p)->(%p)\n", This, prop);
- return E_NOTIMPL;
+ if(!prop)
+ return E_POINTER;
+
+ if(prop->cbSize != sizeof(*prop))
+ return E_INVALIDARG;
+
+ TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
+ prop->bIsOffload,
+ prop->eCategory,
+ prop->Options);
+
+ if(prop->bIsOffload)
+ return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
+
+ return S_OK;
}
static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient2 *iface,
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index e384955b019..91b8230bd85 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -2248,9 +2248,23 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient2 *iface,
{
ACImpl *This = impl_from_IAudioClient2(iface);
- FIXME("(%p)->(%p)\n", This, prop);
+ TRACE("(%p)->(%p)\n", This, prop);
- return E_NOTIMPL;
+ if(!prop)
+ return E_POINTER;
+
+ if(prop->cbSize != sizeof(*prop))
+ return E_INVALIDARG;
+
+ TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
+ prop->bIsOffload,
+ prop->eCategory,
+ prop->Options);
+
+ if(prop->bIsOffload)
+ return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
+
+ return S_OK;
}
static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient2 *iface,
--
2.28.0
More information about the wine-devel
mailing list