-- v2: winepulse: Remove GetAudioEndpoint and GetAudioSessionWrapper. wineoss: Remove GetAudioEndpoint and GetAudioSessionWrapper. winecoreaudio: Remove GetAudioEndpoint and GetAudioSessionWrapper. winealsa: Remove GetAudioEndpoint and GetAudioSessionWrapper. mmdevapi: Implement AudioClient_Create.
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/mmdevdrv.c | 2 +- dlls/winealsa.drv/winealsa.drv.spec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index c4de829f152..fc80b102ee1 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -247,7 +247,7 @@ end: return params.result; }
-static BOOL get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) +BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) { HKEY devices_key; UINT i = 0; diff --git a/dlls/winealsa.drv/winealsa.drv.spec b/dlls/winealsa.drv/winealsa.drv.spec index d6d566e3b13..abfb2e052d8 100644 --- a/dlls/winealsa.drv/winealsa.drv.spec +++ b/dlls/winealsa.drv/winealsa.drv.spec @@ -4,6 +4,7 @@ @ stdcall -private modMessage(long long long long long) ALSA_modMessage
# MMDevAPI driver functions +@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/mmdevdrv.c | 2 +- dlls/winecoreaudio.drv/winecoreaudio.drv.spec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index aee06e5a7f7..9a5bd0fdf91 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -243,7 +243,7 @@ end: return params.result; }
-static BOOL get_device_name_from_guid(const GUID *guid, char **name, EDataFlow *flow) +BOOL WINAPI get_device_name_from_guid(const GUID *guid, char **name, EDataFlow *flow) { HKEY devices_key; UINT i = 0; diff --git a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec index 1467fc8b032..1f2ac2a9bf0 100644 --- a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec +++ b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec @@ -4,6 +4,7 @@ @ stdcall -private modMessage(long long long long long) CoreAudio_modMessage
# MMDevAPI driver functions +@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 2 +- dlls/wineoss.drv/wineoss.drv.spec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 549cd66b6bd..9a09970aa3b 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -200,7 +200,7 @@ static void get_device_guid(EDataFlow flow, const char *device, GUID *guid) RegCloseKey(key); }
-static BOOL get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) +BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) { OSSDevice *dev_item; LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry){ diff --git a/dlls/wineoss.drv/wineoss.drv.spec b/dlls/wineoss.drv/wineoss.drv.spec index 4506cc67ab5..496a6eae570 100644 --- a/dlls/wineoss.drv/wineoss.drv.spec +++ b/dlls/wineoss.drv/wineoss.drv.spec @@ -5,6 +5,7 @@ @ stdcall -private modMessage(long long long long long) OSS_modMessage
# MMDevAPI driver functions +@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 2 +- dlls/winepulse.drv/winepulse.drv.spec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 15e1538f330..65fbc414ce4 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -241,7 +241,7 @@ end: return params.result; }
-static BOOL get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) +BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) { struct device_cache *device; WCHAR key_name[MAX_PULSE_NAME_LEN + 2]; diff --git a/dlls/winepulse.drv/winepulse.drv.spec b/dlls/winepulse.drv/winepulse.drv.spec index 96cbd97bd68..9ae26ae35e9 100644 --- a/dlls/winepulse.drv/winepulse.drv.spec +++ b/dlls/winepulse.drv/winepulse.drv.spec @@ -1,4 +1,5 @@ # MMDevAPI driver functions +@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/main.c | 1 + dlls/mmdevapi/mmdevapi_private.h | 1 + 2 files changed, 2 insertions(+)
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index d1006b9999c..d34075ebf58 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -98,6 +98,7 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
#define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ if(!driver->p##n) { goto fail; } } while(0) + LDFC(get_device_name_from_guid); LDFC(GetEndpointIDs); LDFC(GetAudioEndpoint); LDFC(GetAudioSessionWrapper); diff --git a/dlls/mmdevapi/mmdevapi_private.h b/dlls/mmdevapi/mmdevapi_private.h index 1cd8412b6ea..ca7a1f8f629 100644 --- a/dlls/mmdevapi/mmdevapi_private.h +++ b/dlls/mmdevapi/mmdevapi_private.h @@ -40,6 +40,7 @@ typedef struct _DriverFuncs { * valid. See enum _DriverPriority. */ int priority;
+ BOOL (WINAPI *pget_device_name_from_guid)(GUID *guid, char **name, EDataFlow *flow); /* ids gets an array of human-friendly endpoint names * keys gets an array of driver-specific stuff that is used * in GetAudioEndpoint to identify the endpoint
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/audiosessionmanager.c | 7 +- dlls/mmdevapi/client.c | 110 +++++++++++++++++++++------- dlls/mmdevapi/devenum.c | 4 +- dlls/mmdevapi/main.c | 2 - dlls/mmdevapi/mmdevapi_private.h | 6 +- dlls/mmdevapi/session.c | 31 +++++++- dlls/winealsa.drv/Makefile.in | 4 +- dlls/winealsa.drv/mmdevdrv.c | 63 +--------------- dlls/winecoreaudio.drv/Makefile.in | 4 +- dlls/winecoreaudio.drv/mmdevdrv.c | 63 +--------------- dlls/wineoss.drv/Makefile.in | 4 +- dlls/wineoss.drv/mmdevdrv.c | 65 +--------------- dlls/winepulse.drv/Makefile.in | 4 +- dlls/winepulse.drv/mmdevdrv.c | 63 +--------------- 14 files changed, 133 insertions(+), 297 deletions(-)
diff --git a/dlls/mmdevapi/audiosessionmanager.c b/dlls/mmdevapi/audiosessionmanager.c index 74368ea2be3..ba23634e54d 100644 --- a/dlls/mmdevapi/audiosessionmanager.c +++ b/dlls/mmdevapi/audiosessionmanager.c @@ -26,6 +26,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
+extern HRESULT get_audio_session_wrapper(const GUID *guid, IMMDevice *device, + struct audio_session_wrapper **out); + static CRITICAL_SECTION g_sessions_lock; static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = { @@ -102,7 +105,7 @@ static HRESULT WINAPI ASM_GetAudioSessionControl(IAudioSessionManager2 *iface,
TRACE("(%p)->(%s, %lx, %p)\n", This, debugstr_guid(guid), flags, out);
- hr = drvs.pGetAudioSessionWrapper(guid, This->device, &wrapper); + hr = get_audio_session_wrapper(guid, This->device, &wrapper); if (FAILED(hr)) return hr;
@@ -121,7 +124,7 @@ static HRESULT WINAPI ASM_GetSimpleAudioVolume(IAudioSessionManager2 *iface,
TRACE("(%p)->(%s, %lx, %p)\n", This, debugstr_guid(guid), flags, out);
- hr = drvs.pGetAudioSessionWrapper(guid, This->device, &wrapper); + hr = get_audio_session_wrapper(guid, This->device, &wrapper); if (FAILED(hr)) return hr;
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index 11a0a572d98..3fa41bd10a7 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -21,6 +21,7 @@
#define COBJMACROS
+#include <assert.h> #include <wchar.h>
#include <audiopolicy.h> @@ -30,8 +31,7 @@ #include <wine/debug.h> #include <wine/unixlib.h>
-#include "unixlib.h" -#include "mmdevdrv.h" +#include "mmdevapi_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
@@ -50,6 +50,12 @@ extern struct audio_session_wrapper *session_wrapper_create(struct audio_client
static HANDLE main_loop_thread;
+static inline void wine_unix_call(const unsigned int code, void *args) +{ + const NTSTATUS status = __wine_unix_call(drvs.module_unixlib, code, args); + assert(!status); +} + void main_loop_stop(void) { if (main_loop_thread) { @@ -67,7 +73,7 @@ void set_stream_volumes(struct audio_client *This) params.volumes = This->vols; params.session_volumes = This->session->channel_vols;
- WINE_UNIX_CALL(set_volumes, ¶ms); + wine_unix_call(set_volumes, ¶ms); }
static inline struct audio_client *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) @@ -142,7 +148,7 @@ static DWORD CALLBACK main_loop_func(void *event)
params.event = event;
- WINE_UNIX_CALL(main_loop, ¶ms); + wine_unix_call(main_loop, ¶ms);
return 0; } @@ -174,7 +180,7 @@ static DWORD CALLBACK timer_loop_func(void *user)
params.stream = This->stream;
- WINE_UNIX_CALL(timer_loop, ¶ms); + wine_unix_call(timer_loop, ¶ms);
return 0; } @@ -186,7 +192,7 @@ HRESULT stream_release(stream_handle stream, HANDLE timer_thread) params.stream = stream; params.timer_thread = timer_thread;
- WINE_UNIX_CALL(release_stream, ¶ms); + wine_unix_call(release_stream, ¶ms);
return params.result; } @@ -352,7 +358,7 @@ static HRESULT WINAPI capture_GetBuffer(IAudioCaptureClient *iface, BYTE **data, params.devpos = devpos; params.qpcpos = qpcpos;
- WINE_UNIX_CALL(get_capture_buffer, ¶ms); + wine_unix_call(get_capture_buffer, ¶ms);
return params.result; } @@ -370,7 +376,7 @@ static HRESULT WINAPI capture_ReleaseBuffer(IAudioCaptureClient *iface, UINT32 d params.stream = This->stream; params.done = done;
- WINE_UNIX_CALL(release_capture_buffer, ¶ms); + wine_unix_call(release_capture_buffer, ¶ms);
return params.result; } @@ -391,7 +397,7 @@ static HRESULT WINAPI capture_GetNextPacketSize(IAudioCaptureClient *iface, UINT params.stream = This->stream; params.frames = frames;
- WINE_UNIX_CALL(get_next_packet_size, ¶ms); + wine_unix_call(get_next_packet_size, ¶ms);
return params.result; } @@ -526,7 +532,7 @@ static HRESULT WINAPI client_Initialize(IAudioClient3 *iface, AUDCLNT_SHAREMODE params.channel_count = &channel_count; params.stream = &stream;
- WINE_UNIX_CALL(create_stream, ¶ms); + wine_unix_call(create_stream, ¶ms);
free(name);
@@ -578,7 +584,7 @@ static HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, UINT32 *out) params.stream = This->stream; params.frames = out;
- WINE_UNIX_CALL(get_buffer_size, ¶ms); + wine_unix_call(get_buffer_size, ¶ms);
return params.result; } @@ -599,7 +605,7 @@ static HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, REFERENCE_TI params.stream = This->stream; params.latency = latency;
- WINE_UNIX_CALL(get_latency, ¶ms); + wine_unix_call(get_latency, ¶ms);
return params.result; } @@ -620,7 +626,7 @@ static HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, UINT32 *out params.stream = This->stream; params.padding = out;
- WINE_UNIX_CALL(get_current_padding, ¶ms); + wine_unix_call(get_current_padding, ¶ms);
return params.result; } @@ -648,7 +654,7 @@ static HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHA params.fmt_out = CoTaskMemAlloc(sizeof(*params.fmt_out)); }
- WINE_UNIX_CALL(is_format_supported, ¶ms); + wine_unix_call(is_format_supported, ¶ms);
if (params.result == S_FALSE) *out = ¶ms.fmt_out->Format; @@ -676,7 +682,7 @@ static HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, WAVEFORMATEX **p if (!params.fmt) return E_OUTOFMEMORY;
- WINE_UNIX_CALL(get_mix_format, ¶ms); + wine_unix_call(get_mix_format, ¶ms);
if (SUCCEEDED(params.result)) { *pwfx = ¶ms.fmt->Format; @@ -703,7 +709,7 @@ static HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIM params.def_period = defperiod; params.min_period = minperiod;
- WINE_UNIX_CALL(get_device_period, ¶ms); + wine_unix_call(get_device_period, ¶ms);
return params.result; } @@ -723,7 +729,7 @@ static HRESULT WINAPI client_Start(IAudioClient3 *iface) }
params.stream = This->stream; - WINE_UNIX_CALL(start, ¶ms); + wine_unix_call(start, ¶ms);
if (SUCCEEDED(params.result) && !This->timer_thread) { if ((This->timer_thread = CreateThread(NULL, 0, timer_loop_func, This, 0, NULL))) @@ -751,7 +757,7 @@ static HRESULT WINAPI client_Stop(IAudioClient3 *iface)
params.stream = This->stream;
- WINE_UNIX_CALL(stop, ¶ms); + wine_unix_call(stop, ¶ms);
return params.result; } @@ -768,7 +774,7 @@ static HRESULT WINAPI client_Reset(IAudioClient3 *iface)
params.stream = This->stream;
- WINE_UNIX_CALL(reset, ¶ms); + wine_unix_call(reset, ¶ms);
return params.result; } @@ -789,7 +795,7 @@ static HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, HANDLE event) params.stream = This->stream; params.event = event;
- WINE_UNIX_CALL(set_event_handle, ¶ms); + wine_unix_call(set_event_handle, ¶ms);
return params.result; } @@ -1031,7 +1037,7 @@ static HRESULT WINAPI clock_GetFrequency(IAudioClock *iface, UINT64 *freq) params.stream = This->stream; params.freq = freq;
- WINE_UNIX_CALL(get_frequency, ¶ms); + wine_unix_call(get_frequency, ¶ms);
return params.result; } @@ -1054,7 +1060,7 @@ static HRESULT WINAPI clock_GetPosition(IAudioClock *iface, UINT64 *pos, UINT64 params.pos = pos; params.qpctime = qpctime;
- WINE_UNIX_CALL(get_position, ¶ms); + wine_unix_call(get_position, ¶ms);
return params.result; } @@ -1119,7 +1125,7 @@ static HRESULT WINAPI clock2_GetDevicePosition(IAudioClock2 *iface, UINT64 *pos, params.pos = pos; params.qpctime = qpctime;
- WINE_UNIX_CALL(get_position, ¶ms); + wine_unix_call(get_position, ¶ms);
return params.result; } @@ -1187,7 +1193,7 @@ static HRESULT WINAPI render_GetBuffer(IAudioRenderClient *iface, UINT32 frames, params.frames = frames; params.data = data;
- WINE_UNIX_CALL(get_render_buffer, ¶ms); + wine_unix_call(get_render_buffer, ¶ms);
return params.result; } @@ -1207,7 +1213,7 @@ static HRESULT WINAPI render_ReleaseBuffer(IAudioRenderClient *iface, UINT32 wri params.written_frames = written_frames; params.flags = flags;
- WINE_UNIX_CALL(release_render_buffer, ¶ms); + wine_unix_call(release_render_buffer, ¶ms);
return params.result; } @@ -1383,3 +1389,57 @@ const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl = streamvolume_SetAllVolumes, streamvolume_GetAllVolumes }; + +HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out) +{ + struct audio_client *This; + char *name; + EDataFlow dataflow; + size_t size; + HRESULT hr; + + TRACE("%s %p %p\n", debugstr_guid(guid), device, out); + + *out = NULL; + + if (!drvs.pget_device_name_from_guid(guid, &name, &dataflow)) + return AUDCLNT_E_DEVICE_INVALIDATED; + + if (dataflow != eRender && dataflow != eCapture) { + free(name); + return E_UNEXPECTED; + } + + size = strlen(name) + 1; + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(struct audio_client, device_name[size])); + if (!This) { + free(name); + return E_OUTOFMEMORY; + } + + memcpy(This->device_name, name, size); + free(name); + + This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl; + This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; + This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; + This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; + This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; + This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; + + This->dataflow = dataflow; + This->parent = device; + + hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal); + if (FAILED(hr)) { + HeapFree(GetProcessHeap(), 0, This); + return hr; + } + + IMMDevice_AddRef(This->parent); + + *out = (IAudioClient *)&This->IAudioClient3_iface; + IAudioClient3_AddRef(&This->IAudioClient3_iface); + + return S_OK; +} diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c index 206fe810b12..c1625cf177a 100644 --- a/dlls/mmdevapi/devenum.c +++ b/dlls/mmdevapi/devenum.c @@ -474,7 +474,7 @@ static HRESULT set_format(MMDevice *dev) WAVEFORMATEX *fmt; PROPVARIANT pv = { VT_EMPTY };
- hr = drvs.pGetAudioEndpoint(&dev->devguid, &dev->IMMDevice_iface, &client); + hr = AudioClient_Create(&dev->devguid, &dev->IMMDevice_iface, &client); if(FAILED(hr)) return hr;
@@ -595,7 +595,7 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls if (IsEqualIID(riid, &IID_IAudioClient) || IsEqualIID(riid, &IID_IAudioClient2) || IsEqualIID(riid, &IID_IAudioClient3)){ - hr = drvs.pGetAudioEndpoint(&This->devguid, iface, (IAudioClient**)ppv); + hr = AudioClient_Create(&This->devguid, iface, (IAudioClient**)ppv); }else if (IsEqualIID(riid, &IID_IAudioEndpointVolume) || IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) hr = AudioEndpointVolume_Create(This, (IAudioEndpointVolumeEx**)ppv); diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index d34075ebf58..5ed27c9debd 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -100,8 +100,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) if(!driver->p##n) { goto fail; } } while(0) LDFC(get_device_name_from_guid); LDFC(GetEndpointIDs); - LDFC(GetAudioEndpoint); - LDFC(GetAudioSessionWrapper); #undef LDFC
/* optional - do not fail if not found */ diff --git a/dlls/mmdevapi/mmdevapi_private.h b/dlls/mmdevapi/mmdevapi_private.h index ca7a1f8f629..4113270eda3 100644 --- a/dlls/mmdevapi/mmdevapi_private.h +++ b/dlls/mmdevapi/mmdevapi_private.h @@ -48,10 +48,6 @@ typedef struct _DriverFuncs { * all of the elements in both arrays with HeapFree() */ HRESULT (WINAPI *pGetEndpointIDs)(EDataFlow flow, WCHAR ***ids, GUID **guids, UINT *num, UINT *default_index); - HRESULT (WINAPI *pGetAudioEndpoint)(void *key, IMMDevice *dev, - IAudioClient **out); - HRESULT (WINAPI *pGetAudioSessionWrapper)(const GUID *guid, IMMDevice *device, - struct audio_session_wrapper **out); HRESULT (WINAPI *pGetPropValue)(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out); } DriverFuncs; @@ -73,7 +69,7 @@ typedef struct MMDevice { struct list entry; } MMDevice;
-extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC_HIDDEN; +extern HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out) DECLSPEC_HIDDEN; extern HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv) DECLSPEC_HIDDEN; extern HRESULT AudioSessionManager_Create(IMMDevice *device, IAudioSessionManager2 **ppv) DECLSPEC_HIDDEN; extern HRESULT SpatialAudioClient_Create(IMMDevice *device, ISpatialAudioClient **out) DECLSPEC_HIDDEN; diff --git a/dlls/mmdevapi/session.c b/dlls/mmdevapi/session.c index 24188ad7658..75b29687624 100644 --- a/dlls/mmdevapi/session.c +++ b/dlls/mmdevapi/session.c @@ -21,6 +21,8 @@
#define COBJMACROS
+#include <assert.h> + #include <audiopolicy.h> #include <mmdeviceapi.h> #include <winternl.h> @@ -28,8 +30,7 @@ #include <wine/debug.h> #include <wine/unixlib.h>
-#include "unixlib.h" -#include "mmdevdrv.h" +#include "mmdevapi_private.h"
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
@@ -42,6 +43,12 @@ extern void set_stream_volumes(struct audio_client *This) DECLSPEC_HIDDEN;
static struct list sessions = LIST_INIT(sessions);
+static inline void wine_unix_call(const unsigned int code, void *args) +{ + const NTSTATUS status = __wine_unix_call(drvs.module_unixlib, code, args); + assert(!status); +} + static inline struct audio_session_wrapper *impl_from_IAudioSessionControl2(IAudioSessionControl2 *iface) { return CONTAINING_RECORD(iface, struct audio_session_wrapper, IAudioSessionControl2_iface); @@ -127,7 +134,7 @@ static HRESULT WINAPI control_GetState(IAudioSessionControl2 *iface, AudioSessio
LIST_FOR_EACH_ENTRY(client, &This->session->clients, struct audio_client, entry) { params.stream = client->stream; - WINE_UNIX_CALL(is_started, ¶ms); + wine_unix_call(is_started, ¶ms); if (params.result == S_OK) { *state = AudioSessionStateActive; sessions_unlock(); @@ -653,3 +660,21 @@ HRESULT get_audio_session(const GUID *guid, IMMDevice *device, UINT channels,
return S_OK; } + +HRESULT get_audio_session_wrapper(const GUID *guid, IMMDevice *device, + struct audio_session_wrapper **out) +{ + struct audio_session *session; + + const HRESULT hr = get_audio_session(guid, device, 0, &session); + if (FAILED(hr)) + return hr; + + *out = session_wrapper_create(NULL); + if (!*out) + return E_OUTOFMEMORY; + + (*out)->session = session; + + return S_OK; +} diff --git a/dlls/winealsa.drv/Makefile.in b/dlls/winealsa.drv/Makefile.in index d1387520742..18fccaa40d4 100644 --- a/dlls/winealsa.drv/Makefile.in +++ b/dlls/winealsa.drv/Makefile.in @@ -8,7 +8,5 @@ UNIX_LIBS = $(ALSA_LIBS) $(PTHREAD_LIBS) C_SRCS = \ alsa.c \ alsamidi.c \ - client.c \ midi.c \ - mmdevdrv.c \ - session.c + mmdevdrv.c diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index fc80b102ee1..015a45f15cd 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -321,54 +321,7 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow)
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) { - ACImpl *This; - char *alsa_name; - EDataFlow dataflow; - HRESULT hr; - int len; - - TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); - - if(!get_device_name_from_guid(guid, &alsa_name, &dataflow)) - return AUDCLNT_E_DEVICE_INVALIDATED; - - if(dataflow != eRender && dataflow != eCapture){ - free(alsa_name); - return E_UNEXPECTED; - } - - len = strlen(alsa_name); - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1])); - if(!This){ - free(alsa_name); - return E_OUTOFMEMORY; - } - - memcpy(This->device_name, alsa_name, len + 1); - free(alsa_name); - - This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; - This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; - This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl; - This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; - This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; - This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; - - hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal); - if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, This); - return hr; - } - - This->dataflow = dataflow; - - This->parent = dev; - IMMDevice_AddRef(This->parent); - - *out = (IAudioClient *)&This->IAudioClient3_iface; - IAudioClient3_AddRef(&This->IAudioClient3_iface); - - return S_OK; + return E_NOTIMPL; }
/* if channels == 0, then this will return or create a session with @@ -379,19 +332,7 @@ extern HRESULT get_audio_session(const GUID *sessionguid, HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { - AudioSession *session; - - HRESULT hr = get_audio_session(guid, device, 0, &session); - if(FAILED(hr)) - return hr; - - *out = session_wrapper_create(NULL); - if(!*out) - return E_OUTOFMEMORY; - - (*out)->session = session; - - return S_OK; + return E_NOTIMPL; }
HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out) diff --git a/dlls/winecoreaudio.drv/Makefile.in b/dlls/winecoreaudio.drv/Makefile.in index ecf85cffda4..82b87e79dd3 100644 --- a/dlls/winecoreaudio.drv/Makefile.in +++ b/dlls/winecoreaudio.drv/Makefile.in @@ -6,9 +6,7 @@ DELAYIMPORTS = winmm UNIX_LIBS = $(COREAUDIO_LIBS)
C_SRCS = \ - client.c \ coreaudio.c \ coremidi.c \ midi.c \ - mmdevdrv.c \ - session.c + mmdevdrv.c diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 9a5bd0fdf91..bde63318f5b 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -315,54 +315,7 @@ BOOL WINAPI get_device_name_from_guid(const GUID *guid, char **name, EDataFlow *
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) { - ACImpl *This; - char *name; - SIZE_T name_len; - EDataFlow dataflow; - HRESULT hr; - - TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); - - if(!get_device_name_from_guid(guid, &name, &dataflow)) - return AUDCLNT_E_DEVICE_INVALIDATED; - - if(dataflow != eRender && dataflow != eCapture){ - free(name); - return E_UNEXPECTED; - } - - name_len = strlen(name); - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[name_len + 1])); - if(!This){ - free(name); - return E_OUTOFMEMORY; - } - - memcpy(This->device_name, name, name_len + 1); - free(name); - - This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; - This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; - This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl; - This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; - This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; - This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; - - This->dataflow = dataflow; - - hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal); - if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, This); - return hr; - } - - This->parent = dev; - IMMDevice_AddRef(This->parent); - - *out = (IAudioClient *)&This->IAudioClient3_iface; - IAudioClient3_AddRef(&This->IAudioClient3_iface); - - return S_OK; + return E_NOTIMPL; }
/* if channels == 0, then this will return or create a session with @@ -373,17 +326,5 @@ extern HRESULT get_audio_session(const GUID *sessionguid, HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { - AudioSession *session; - - HRESULT hr = get_audio_session(guid, device, 0, &session); - if(FAILED(hr)) - return hr; - - *out = session_wrapper_create(NULL); - if(!*out) - return E_OUTOFMEMORY; - - (*out)->session = session; - - return S_OK; + return E_NOTIMPL; } diff --git a/dlls/wineoss.drv/Makefile.in b/dlls/wineoss.drv/Makefile.in index f571397257b..0e472d5d71c 100644 --- a/dlls/wineoss.drv/Makefile.in +++ b/dlls/wineoss.drv/Makefile.in @@ -7,11 +7,9 @@ UNIX_LIBS = $(OSS4_LIBS) $(PTHREAD_LIBS) UNIX_CFLAGS = $(OSS4_CFLAGS)
C_SRCS = \ - client.c \ midi.c \ midipatch.c \ mmaux.c \ mmdevdrv.c \ oss.c \ - ossmidi.c \ - session.c + ossmidi.c diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 9a09970aa3b..de13744be61 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -303,56 +303,7 @@ end: HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) { - ACImpl *This; - char *name; - int len; - EDataFlow dataflow; - HRESULT hr; - - TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); - - if(!get_device_name_from_guid(guid, &name, &dataflow)){ - WARN("Unknown GUID: %s\n", debugstr_guid(guid)); - return AUDCLNT_E_DEVICE_INVALIDATED; - } - - if(dataflow != eRender && dataflow != eCapture){ - free(name); - return E_UNEXPECTED; - } - - len = strlen(name); - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1])); - if(!This){ - free(name); - return E_OUTOFMEMORY; - } - - memcpy(This->device_name, name, len + 1); - free(name); - - hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal); - if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, This); - return hr; - } - - This->dataflow = dataflow; - - This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; - This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; - This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl; - This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; - This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; - This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; - - This->parent = dev; - IMMDevice_AddRef(This->parent); - - *out = (IAudioClient *)&This->IAudioClient3_iface; - IAudioClient3_AddRef(&This->IAudioClient3_iface); - - return S_OK; + return E_NOTIMPL; }
/* if channels == 0, then this will return or create a session with @@ -363,17 +314,5 @@ extern HRESULT get_audio_session(const GUID *sessionguid, HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { - AudioSession *session; - - HRESULT hr = get_audio_session(guid, device, 0, &session); - if(FAILED(hr)) - return hr; - - *out = session_wrapper_create(NULL); - if(!*out) - return E_OUTOFMEMORY; - - (*out)->session = session; - - return S_OK; + return E_NOTIMPL; } diff --git a/dlls/winepulse.drv/Makefile.in b/dlls/winepulse.drv/Makefile.in index f5593dbcc70..400c221c85e 100644 --- a/dlls/winepulse.drv/Makefile.in +++ b/dlls/winepulse.drv/Makefile.in @@ -6,7 +6,5 @@ UNIX_LIBS = $(PULSE_LIBS) $(PTHREAD_LIBS) -lm UNIX_CFLAGS = $(PULSE_CFLAGS)
C_SRCS = \ - client.c \ mmdevdrv.c \ - pulse.c \ - session.c + pulse.c diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 65fbc414ce4..d80d52ec3ee 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -345,54 +345,7 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow)
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) { - ACImpl *This; - char *pulse_name; - EDataFlow dataflow; - unsigned len; - HRESULT hr; - - TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); - - if (!get_device_name_from_guid(guid, &pulse_name, &dataflow)) - return AUDCLNT_E_DEVICE_INVALIDATED; - - if (dataflow != eRender && dataflow != eCapture) { - free(pulse_name); - return E_UNEXPECTED; - } - - *out = NULL; - - len = strlen(pulse_name) + 1; - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(ACImpl, device_name[len])); - if (!This) { - free(pulse_name); - return E_OUTOFMEMORY; - } - - memcpy(This->device_name, pulse_name, len); - free(pulse_name); - - This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; - This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; - This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl; - This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; - This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; - This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; - This->dataflow = dataflow; - This->parent = dev; - - hr = CoCreateFreeThreadedMarshaler((IUnknown*)&This->IAudioClient3_iface, &This->marshal); - if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, This); - return hr; - } - IMMDevice_AddRef(This->parent); - - *out = (IAudioClient *)&This->IAudioClient3_iface; - IAudioClient3_AddRef(&This->IAudioClient3_iface); - - return S_OK; + return E_NOTIMPL; }
/* if channels == 0, then this will return or create a session with @@ -403,19 +356,7 @@ extern HRESULT get_audio_session(const GUID *sessionguid, HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { - AudioSession *session; - - HRESULT hr = get_audio_session(guid, device, 0, &session); - if(FAILED(hr)) - return hr; - - *out = session_wrapper_create(NULL); - if(!*out) - return E_OUTOFMEMORY; - - (*out)->session = session; - - return S_OK; + return E_NOTIMPL; }
HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/mmdevdrv.c | 48 ----------------------------- dlls/winealsa.drv/winealsa.drv.spec | 2 -- 2 files changed, 50 deletions(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 015a45f15cd..50e53dcda41 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -51,40 +51,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(alsa);
-#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) - -static CRITICAL_SECTION g_sessions_lock; -static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = -{ - 0, 0, &g_sessions_lock, - { &g_sessions_lock_debug.ProcessLocksList, &g_sessions_lock_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") } -}; -static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 }; - static WCHAR drv_key_devicesW[256]; static const WCHAR guidW[] = {'g','u','i','d',0};
-extern const IAudioClient3Vtbl AudioClient3_Vtbl; -extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; -extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -extern const IAudioClockVtbl AudioClock_Vtbl; -extern const IAudioClock2Vtbl AudioClock2_Vtbl; -extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; - -extern struct audio_session_wrapper *session_wrapper_create( - struct audio_client *client) DECLSPEC_HIDDEN; - -void DECLSPEC_HIDDEN sessions_lock(void) -{ - EnterCriticalSection(&g_sessions_lock); -} - -void DECLSPEC_HIDDEN sessions_unlock(void) -{ - LeaveCriticalSection(&g_sessions_lock); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { switch (reason) @@ -108,7 +77,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) } case DLL_PROCESS_DETACH: if (reserved) break; - DeleteCriticalSection(&g_sessions_lock); break; } return TRUE; @@ -319,22 +287,6 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) return FALSE; }
-HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) -{ - return E_NOTIMPL; -} - -/* if channels == 0, then this will return or create a session with - * matching dataflow and GUID. otherwise, channels must also match */ -extern HRESULT get_audio_session(const GUID *sessionguid, - IMMDevice *device, UINT channels, AudioSession **out); - -HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, - AudioSessionWrapper **out) -{ - return E_NOTIMPL; -} - HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out) { struct get_prop_value_params params; diff --git a/dlls/winealsa.drv/winealsa.drv.spec b/dlls/winealsa.drv/winealsa.drv.spec index abfb2e052d8..ae6cfdd84ca 100644 --- a/dlls/winealsa.drv/winealsa.drv.spec +++ b/dlls/winealsa.drv/winealsa.drv.spec @@ -6,6 +6,4 @@ # MMDevAPI driver functions @ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs -@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint -@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper @ stdcall -private GetPropValue(ptr ptr ptr) AUDDRV_GetPropValue
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/mmdevdrv.c | 48 ------------------- dlls/winecoreaudio.drv/winecoreaudio.drv.spec | 2 - 2 files changed, 50 deletions(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index bde63318f5b..09668ee9699 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -46,39 +46,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(coreaudio);
-#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) - -extern const IAudioClient3Vtbl AudioClient3_Vtbl; -extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; -extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -extern const IAudioClockVtbl AudioClock_Vtbl; -extern const IAudioClock2Vtbl AudioClock2_Vtbl; -extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; - static WCHAR drv_key_devicesW[256];
-static CRITICAL_SECTION g_sessions_lock; -static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = -{ - 0, 0, &g_sessions_lock, - { &g_sessions_lock_debug.ProcessLocksList, &g_sessions_lock_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") } -}; -static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 }; - -extern struct audio_session_wrapper *session_wrapper_create( - struct audio_client *client) DECLSPEC_HIDDEN; - -void DECLSPEC_HIDDEN sessions_lock(void) -{ - EnterCriticalSection(&g_sessions_lock); -} - -void DECLSPEC_HIDDEN sessions_unlock(void) -{ - LeaveCriticalSection(&g_sessions_lock); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { switch (reason) @@ -104,7 +73,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) } case DLL_PROCESS_DETACH: if (reserved) break; - DeleteCriticalSection(&g_sessions_lock); break; } return TRUE; @@ -312,19 +280,3 @@ BOOL WINAPI get_device_name_from_guid(const GUID *guid, char **name, EDataFlow *
return FALSE; } - -HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) -{ - return E_NOTIMPL; -} - -/* if channels == 0, then this will return or create a session with - * matching dataflow and GUID. otherwise, channels must also match */ -extern HRESULT get_audio_session(const GUID *sessionguid, - IMMDevice *device, UINT channels, AudioSession **out); - -HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, - AudioSessionWrapper **out) -{ - return E_NOTIMPL; -} diff --git a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec index 1f2ac2a9bf0..16cd7f08b2b 100644 --- a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec +++ b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec @@ -6,5 +6,3 @@ # MMDevAPI driver functions @ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs -@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint -@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 50 ------------------------------- dlls/wineoss.drv/wineoss.drv.spec | 2 -- 2 files changed, 52 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index de13744be61..4a45c532dd0 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -48,8 +48,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(oss);
-#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) - typedef struct _OSSDevice { struct list entry; EDataFlow flow; @@ -62,35 +60,6 @@ static struct list g_devices = LIST_INIT(g_devices); static WCHAR drv_key_devicesW[256]; static const WCHAR guidW[] = {'g','u','i','d',0};
-static CRITICAL_SECTION g_sessions_lock; -static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = -{ - 0, 0, &g_sessions_lock, - { &g_sessions_lock_debug.ProcessLocksList, &g_sessions_lock_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") } -}; -static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 }; - -extern const IAudioClient3Vtbl AudioClient3_Vtbl; -extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; -extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -extern const IAudioClockVtbl AudioClock_Vtbl; -extern const IAudioClock2Vtbl AudioClock2_Vtbl; -extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; - -extern struct audio_session_wrapper *session_wrapper_create( - struct audio_client *client) DECLSPEC_HIDDEN; - -void DECLSPEC_HIDDEN sessions_lock(void) -{ - EnterCriticalSection(&g_sessions_lock); -} - -void DECLSPEC_HIDDEN sessions_unlock(void) -{ - LeaveCriticalSection(&g_sessions_lock); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { switch (reason) @@ -117,8 +86,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { OSSDevice *iter, *iter2;
- DeleteCriticalSection(&g_sessions_lock); - LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &g_devices, OSSDevice, entry){ HeapFree(GetProcessHeap(), 0, iter); } @@ -299,20 +266,3 @@ end:
return params.result; } - -HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, - IAudioClient **out) -{ - return E_NOTIMPL; -} - -/* if channels == 0, then this will return or create a session with - * matching dataflow and GUID. otherwise, channels must also match */ -extern HRESULT get_audio_session(const GUID *sessionguid, - IMMDevice *device, UINT channels, AudioSession **out); - -HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, - AudioSessionWrapper **out) -{ - return E_NOTIMPL; -} diff --git a/dlls/wineoss.drv/wineoss.drv.spec b/dlls/wineoss.drv/wineoss.drv.spec index 496a6eae570..e12fb20fd17 100644 --- a/dlls/wineoss.drv/wineoss.drv.spec +++ b/dlls/wineoss.drv/wineoss.drv.spec @@ -7,5 +7,3 @@ # MMDevAPI driver functions @ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs -@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint -@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 47 --------------------------- dlls/winepulse.drv/winepulse.drv.spec | 2 -- 2 files changed, 49 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index d80d52ec3ee..3dbb88d880e 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -54,8 +54,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(pulse);
#define MAX_PULSE_NAME_LEN 256
-#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) - static struct list g_devices_cache = LIST_INIT(g_devices_cache);
struct device_cache { @@ -72,25 +70,6 @@ static GUID pulse_capture_guid =
static WCHAR drv_key_devicesW[256];
-static CRITICAL_SECTION session_cs; -static CRITICAL_SECTION_DEBUG session_cs_debug = { - 0, 0, &session_cs, - { &session_cs_debug.ProcessLocksList, - &session_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": session_cs") } -}; -static CRITICAL_SECTION session_cs = { &session_cs_debug, -1, 0, 0, 0, 0 }; - -void DECLSPEC_HIDDEN sessions_lock(void) -{ - EnterCriticalSection(&session_cs); -} - -void DECLSPEC_HIDDEN sessions_unlock(void) -{ - LeaveCriticalSection(&session_cs); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { if (reason == DLL_PROCESS_ATTACH) { @@ -117,16 +96,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; }
-extern const IAudioClient3Vtbl AudioClient3_Vtbl; -extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; -extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -extern const IAudioClockVtbl AudioClock_Vtbl; -extern const IAudioClock2Vtbl AudioClock2_Vtbl; -extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; - -extern struct audio_session_wrapper *session_wrapper_create( - struct audio_client *client) DECLSPEC_HIDDEN; - static void pulse_call(enum unix_funcs code, void *params) { NTSTATUS status; @@ -343,22 +312,6 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow) return FALSE; }
-HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) -{ - return E_NOTIMPL; -} - -/* if channels == 0, then this will return or create a session with - * matching dataflow and GUID. otherwise, channels must also match */ -extern HRESULT get_audio_session(const GUID *sessionguid, - IMMDevice *device, UINT channels, AudioSession **out); - -HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, - AudioSessionWrapper **out) -{ - return E_NOTIMPL; -} - HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out) { struct get_prop_value_params params; diff --git a/dlls/winepulse.drv/winepulse.drv.spec b/dlls/winepulse.drv/winepulse.drv.spec index 9ae26ae35e9..fe5b62e053b 100644 --- a/dlls/winepulse.drv/winepulse.drv.spec +++ b/dlls/winepulse.drv/winepulse.drv.spec @@ -1,8 +1,6 @@ # MMDevAPI driver functions @ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs -@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint -@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper @ stdcall -private GetPropValue(ptr ptr ptr) AUDDRV_GetPropValue
# WinMM driver functions
Huw Davies (@huw) commented about dlls/mmdevapi/client.c:
static HANDLE main_loop_thread;
+static inline void wine_unix_call(const unsigned int code, void *args) +{
- const NTSTATUS status = __wine_unix_call(drvs.module_unixlib, code, args);
- assert(!status);
+}
Could you add a commit before this one that introduces this helper (initially it would just call `WINE_UNIX_CALL()`? This would reduce the size of this commit. Also, could you add it to a header, so it doesn't need to be duplicated?
Huw Davies (@huw) commented about dlls/winealsa.drv/Makefile.in:
C_SRCS = \ alsa.c \ alsamidi.c \
- client.c \ midi.c \
- mmdevdrv.c \
- session.c
- mmdevdrv.c
So we can remove `PARENTSRC` too?
Huw Davies (@huw) commented about dlls/winealsa.drv/mmdevdrv.c:
- hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
- if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, This);
return hr;
- }
- This->dataflow = dataflow;
- This->parent = dev;
- IMMDevice_AddRef(This->parent);
- *out = (IAudioClient *)&This->IAudioClient3_iface;
- IAudioClient3_AddRef(&This->IAudioClient3_iface);
- return S_OK;
- return E_NOTIMPL;
I think just removing this completely (and the spec file entry) in this commit is fine.