From 9c781159e4ae7014686eb034c125378e4fb870fa Mon Sep 17 00:00:00 2001 From: Juergen Tretthahn Date: Tue, 10 Apr 2012 17:11:43 +0000 Subject: [PATCH] winepulse.drv: API Compatibility with 1.5.2 onward Commit e87cb774d131963d2642d075977571585ec5da8d changed the driver api leave this commit out to build for builds prior to this Not needed for: 1.5.1, 1.5 and 1.4 builds --- dlls/winepulse.drv/mmdevdrv.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 6e75674e740..5cc460f4f93 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -82,6 +82,11 @@ const WCHAR pulse_keyW[] = {'S','o','f','t','w','a','r','e','\\', 'W','i','n','e','\\','P','u','l','s','e',0}; const WCHAR pulse_streamW[] = { 'S','t','r','e','a','m','V','o','l',0 }; +static GUID pulse_render_guid = +{ 0xfd47d9cc, 0x4218, 0x4135, { 0x9c, 0xe2, 0x0c, 0x19, 0x5c, 0x87, 0x40, 0x5b } }; +static GUID pulse_capture_guid = +{ 0x25da76d0, 0x033c, 0x4235, { 0x90, 0x02, 0x19, 0xf4, 0x88, 0x94, 0xac, 0x6f } }; + static HANDLE warn_once; BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) @@ -729,7 +734,7 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) { return S_OK; } -HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, void ***keys, +HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **keys, UINT *num, UINT *def_index) { HRESULT hr = S_OK; @@ -743,20 +748,21 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, void ***keys, *num = 1; *def_index = 0; - *ids = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR *)); + *ids = HeapAlloc(GetProcessHeap(), 0, sizeof(**ids)); if (!*ids) return E_OUTOFMEMORY; + (*ids)[0] = defaultW; - (*ids)[0] = HeapAlloc(GetProcessHeap(), 0, sizeof(defaultW)); - if (!(*ids)[0]) { + *keys = HeapAlloc(GetProcessHeap(), 0, sizeof(**keys)); + if (!*keys) { HeapFree(GetProcessHeap(), 0, *ids); + *ids = NULL; return E_OUTOFMEMORY; } - - lstrcpyW((*ids)[0], defaultW); - - *keys = HeapAlloc(GetProcessHeap(), 0, sizeof(void *)); - (*keys)[0] = NULL; + if (flow == eRender) + (*keys)[0] = pulse_render_guid; + else + (*keys)[0] = pulse_capture_guid; return S_OK; } @@ -774,12 +780,12 @@ int WINAPI AUDDRV_GetPriority(void) return SUCCEEDED(hr) ? 3 : 0; } -HRESULT WINAPI AUDDRV_GetAudioEndpoint(void *key, IMMDevice *dev, - EDataFlow dataflow, IAudioClient **out) +HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) { HRESULT hr; ACImpl *This; int i; + EDataFlow dataflow; /* Give one visible warning per session * Sadly wine has chosen not to accept the winepulse patch, so support ourselves @@ -793,7 +799,11 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(void *key, IMMDevice *dev, } TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); - if (dataflow != eRender && dataflow != eCapture) + if (IsEqualGUID(guid, &pulse_render_guid)) + dataflow = eRender; + else if (IsEqualGUID(guid, &pulse_capture_guid)) + dataflow = eCapture; + else return E_UNEXPECTED; *out = NULL; -- 2.11.4.GIT