Andrew Eikum : mmdevapi: Implement SetClientProperties.

Alexandre Julliard julliard at winehq.org
Fri Oct 2 14:54:09 CDT 2020


Module: wine
Branch: master
Commit: d8ae98d4216b85b3da342ef71b28674996e5c9d5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d8ae98d4216b85b3da342ef71b28674996e5c9d5

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Oct  1 14:31:32 2020 -0500

mmdevapi: Implement SetClientProperties.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 e58cc449d8..a4f271e557 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 233b0dfda1..04f90d0d16 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 8ee1bb12d3..aa32c49185 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 f32c1d5e41..f065d5bc1e 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 9b1cdf3fa7..3a3cb57b64 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 e384955b01..91b8230bd8 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,




More information about the wine-cvs mailing list