From 5cd04574084c3e39d41d50fd61a70b53eb04a0a6 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Thu, 19 Feb 2015 00:00:35 -0700 Subject: [PATCH] dpvoice: Turn GetCompressionTypes into a semi-stub. --- dlls/dpvoice/client.c | 5 ++-- dlls/dpvoice/dvoice_private.h | 1 + dlls/dpvoice/server.c | 43 +++++++++++++++++++++++++++++++++-- dlls/dpvoice/tests/voice.c | 10 -------- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/dlls/dpvoice/client.c b/dlls/dpvoice/client.c index 29b53363d1a..bdae160b20c 100644 --- a/dlls/dpvoice/client.c +++ b/dlls/dpvoice/client.c @@ -32,6 +32,7 @@ #include "wine/debug.h" #include "dvoice.h" +#include "dvoice_private.h" WINE_DEFAULT_DEBUG_CHANNEL(dpvoice); @@ -149,8 +150,8 @@ static HRESULT WINAPI dpvclient_GetCompressionTypes(IDirectPlayVoiceClient *ifac DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags) { IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface); - FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags); - return E_NOTIMPL; + FIXME("%p %p %p %p %d semi-stub\n", This, pData, pdwDataSize, pdwNumElements, dwFlags); + return DPVOICE_GetCompressionTypes(pData, pdwDataSize, pdwNumElements, dwFlags); } static HRESULT WINAPI dpvclient_SetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets, diff --git a/dlls/dpvoice/dvoice_private.h b/dlls/dpvoice/dvoice_private.h index 5b0e57d2f36..ededeab3563 100644 --- a/dlls/dpvoice/dvoice_private.h +++ b/dlls/dpvoice/dvoice_private.h @@ -23,5 +23,6 @@ extern HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN; extern HRESULT DPVOICE_CreateDirectPlayVoiceServer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN; extern HRESULT DPVOICE_CreateDirectPlayVoiceTest(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN; +extern HRESULT DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO *pData, DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags) DECLSPEC_HIDDEN; #endif diff --git a/dlls/dpvoice/server.c b/dlls/dpvoice/server.c index e9291e2d2b5..80ef1999907 100644 --- a/dlls/dpvoice/server.c +++ b/dlls/dpvoice/server.c @@ -41,6 +41,45 @@ typedef struct IDirectPlayVoiceServerImpl LONG ref; } IDirectPlayVoiceServerImpl; +HRESULT DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO *pData, DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags) +{ + static const DVCOMPRESSIONINFO pcm_type = + {80, {0x8de12fd4,0x7cb3,0x48ce,{0xa7,0xe8,0x9c,0x47,0xa2,0x2e,0x8a,0xc5}}, NULL, NULL, 0, 64000}; + static const WCHAR pcm_name[] = + {'M','S','-','P','C','M',' ','6','4',' ','k','b','i','t','/','s',0}; + + HRESULT ret; + LPWSTR string_loc; + + if (!pdwDataSize || !pdwNumElements) + return DVERR_INVALIDPOINTER; + + if (dwFlags) + return DVERR_INVALIDFLAGS; + + *pdwNumElements = 1; + + if (*pdwDataSize < sizeof(pcm_type) + sizeof(pcm_name)) + { + ret = DVERR_BUFFERTOOSMALL; + } + else if (!pData) + { + ret = DVERR_INVALIDPOINTER; + } + else + { + string_loc = (LPWSTR)((char*)pData + sizeof(pcm_type)); + memcpy(pData, &pcm_type, sizeof(pcm_type)); + memcpy(string_loc, pcm_name, sizeof(pcm_name)); + pData->lpszName = string_loc; + ret = DV_OK; + } + + *pdwDataSize = sizeof(pcm_type) + sizeof(pcm_name); + return ret; +} + static inline IDirectPlayVoiceServerImpl *impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer *iface) { return CONTAINING_RECORD(iface, IDirectPlayVoiceServerImpl, IDirectPlayVoiceServer_iface); @@ -130,8 +169,8 @@ static HRESULT WINAPI dpvserver_GetCompressionTypes(IDirectPlayVoiceServer *ifac DWORD *pdwNumElements, DWORD dwFlags) { IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); - FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags); - return E_NOTIMPL; + FIXME("%p %p %p %p %d semi-stub\n", This, pData, pdwDataSize, pdwNumElements, dwFlags); + return DPVOICE_GetCompressionTypes(pData, pdwDataSize, pdwNumElements, dwFlags); } static HRESULT WINAPI dpvserver_SetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets, diff --git a/dlls/dpvoice/tests/voice.c b/dlls/dpvoice/tests/voice.c index fe2db94a79d..7f0faa3454c 100644 --- a/dlls/dpvoice/tests/voice.c +++ b/dlls/dpvoice/tests/voice.c @@ -420,16 +420,6 @@ static void test_GetCompressionTypes(IDirectPlayVoiceClient *client_iface, IDire /* either client_iface or server_iface must be given, but not both */ assert(!client_iface ^ !server_iface); - if(client_iface) - ret = IDirectPlayVoiceClient_GetCompressionTypes(client_iface, NULL, NULL, NULL, 0); - else - ret = IDirectPlayVoiceServer_GetCompressionTypes(server_iface, NULL, NULL, NULL, 0); - if(ret == E_NOTIMPL) - { - skip("%s: GetCompressionTypes not implemented\n", name); - return; - } - if (client_iface) ret = IDirectPlayVoiceClient_GetCompressionTypes(client_iface, NULL, &data_size, &num_elements, 0); else