From: Mark Harmstone mark@harmstone.com
And get rid of config->speakers_mask and g_phys_speakers_mask since they are no longer needed.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/winepulse.drv/mmdevdrv.c | 7 ------- dlls/winepulse.drv/pulse.c | 30 +++++++++++++++++++++--------- dlls/winepulse.drv/unixlib.h | 1 - 3 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 88924d1..1ec67a5 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -2648,13 +2648,6 @@ HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARI
TRACE("%s, (%s,%u), %p\n", wine_dbgstr_guid(guid), wine_dbgstr_guid(&prop->fmtid), prop->pid, out);
- if (IsEqualGUID(guid, &pulse_render_guid) && IsEqualPropertyKey(*prop, PKEY_AudioEndpoint_PhysicalSpeakers)) { - out->vt = VT_UI4; - out->ulVal = pulse_config.speakers_mask; - - return out->ulVal ? S_OK : E_FAIL; - } - if (!get_pulse_name_by_guid(guid, device, ¶ms.flow)) return E_FAIL;
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 8729cac..a71541c 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -87,6 +87,7 @@ typedef struct _PhysDevice { enum phys_device_bus_type bus_type; USHORT vendor_id, product_id; EndpointFormFactor form; + DWORD channel_mask; UINT index; char device[0]; } PhysDevice; @@ -98,7 +99,6 @@ static pa_mainloop *pulse_ml; static WAVEFORMATEXTENSIBLE pulse_fmt[2]; static REFERENCE_TIME pulse_min_period[2], pulse_def_period[2];
-static UINT g_phys_speakers_mask = 0; static struct list g_phys_speakers = LIST_INIT(g_phys_speakers); static struct list g_phys_sources = LIST_INIT(g_phys_sources);
@@ -443,7 +443,7 @@ static void fill_device_info(PhysDevice *dev, pa_proplist *p) }
static void pulse_add_device(struct list *list, pa_proplist *proplist, int index, EndpointFormFactor form, - const char *device, const char *name) + DWORD channel_mask, const char *device, const char *name) { DWORD len = strlen(device), name_len = strlen(name); PhysDevice *dev = malloc(FIELD_OFFSET(PhysDevice, device[len + 1])); @@ -466,6 +466,7 @@ static void pulse_add_device(struct list *list, pa_proplist *proplist, int index dev->name[name_len] = 0; dev->form = form; dev->index = index; + dev->channel_mask = channel_mask; fill_device_info(dev, proplist); memcpy(dev->device, device, len + 1);
@@ -474,14 +475,20 @@ static void pulse_add_device(struct list *list, pa_proplist *proplist, int index
static void pulse_phys_speakers_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata) { + struct list *speaker; + DWORD channel_mask; + if (!i || !i->name || !i->name[0]) return; + channel_mask = pulse_channel_map_to_channel_mask(&i->channel_map);
/* For default PulseAudio render device, OR together all of the * PKEY_AudioEndpoint_PhysicalSpeakers values of the sinks. */ - g_phys_speakers_mask |= pulse_channel_map_to_channel_mask(&i->channel_map); + speaker = list_head(&g_phys_speakers); + if (speaker) + LIST_ENTRY(speaker, PhysDevice, entry)->channel_mask |= channel_mask;
- pulse_add_device(&g_phys_speakers, i->proplist, i->index, Speakers, i->name, i->description); + pulse_add_device(&g_phys_speakers, i->proplist, i->index, Speakers, channel_mask, i->name, i->description); }
static void pulse_phys_sources_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata) @@ -489,7 +496,7 @@ static void pulse_phys_sources_cb(pa_context *c, const pa_source_info *i, int eo if (!i || !i->name || !i->name[0]) return; pulse_add_device(&g_phys_sources, i->proplist, i->index, - (i->monitor_of_sink == PA_INVALID_INDEX) ? Microphone : LineLevel, i->name, i->description); + (i->monitor_of_sink == PA_INVALID_INDEX) ? Microphone : LineLevel, 0, i->name, i->description); }
/* For most hardware on Windows, users must choose a configuration with an even @@ -709,10 +716,9 @@ static NTSTATUS pulse_test_connect(void *args) free_phys_device_lists(); list_init(&g_phys_speakers); list_init(&g_phys_sources); - g_phys_speakers_mask = 0;
- pulse_add_device(&g_phys_speakers, NULL, 0, Speakers, "", "PulseAudio"); - pulse_add_device(&g_phys_sources, NULL, 0, Microphone, "", "PulseAudio"); + pulse_add_device(&g_phys_speakers, NULL, 0, Speakers, 0, "", "PulseAudio"); + pulse_add_device(&g_phys_sources, NULL, 0, Microphone, 0, "", "PulseAudio");
o = pa_context_get_sink_info_list(pulse_ctx, &pulse_phys_speakers_cb, NULL); if (o) { @@ -735,7 +741,6 @@ static NTSTATUS pulse_test_connect(void *args) pa_mainloop_free(pulse_ml); pulse_ml = NULL;
- config->speakers_mask = g_phys_speakers_mask; config->modes[0].format = pulse_fmt[0]; config->modes[0].def_period = pulse_def_period[0]; config->modes[0].min_period = pulse_min_period[0]; @@ -2167,6 +2172,12 @@ static NTSTATUS pulse_get_prop_value(void *args) params->vt = VT_UI4; params->ulVal = dev->form; return STATUS_SUCCESS; + case 3: /* PhysicalSpeakers */ + if (!dev->channel_mask) + goto fail; + params->vt = VT_UI4; + params->ulVal = dev->channel_mask; + return STATUS_SUCCESS; default: break; } @@ -2175,6 +2186,7 @@ static NTSTATUS pulse_get_prop_value(void *args) return STATUS_SUCCESS; }
+fail: params->result = E_FAIL; return STATUS_SUCCESS; } diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index bd09566..ba5422b 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -35,7 +35,6 @@ struct pulse_config REFERENCE_TIME def_period; REFERENCE_TIME min_period; } modes[2]; - unsigned int speakers_mask; };
struct main_loop_params