winepulse-PulseAudio_Support: Merge last patch into corresponding commits.

This commit is contained in:
Sebastian Lackner 2014-12-21 05:34:21 +01:00
parent f85f8cf234
commit 9e0670934a
5 changed files with 80 additions and 303 deletions

View File

@ -2380,7 +2380,6 @@ winepulse-PulseAudio_Support.ok:
$(call APPLY_FILE,winepulse-PulseAudio_Support/0029-winepulse-implement-exclusive-mode.patch)
$(call APPLY_FILE,winepulse-PulseAudio_Support/0030-winepulse-fix-segfault-in-pulse_rd_loop.patch)
$(call APPLY_FILE,winepulse-PulseAudio_Support/0031-winepulse-implement-GetPropValue.patch)
$(call APPLY_FILE,winepulse-PulseAudio_Support/0032-winepulse-Replace-busyloop-with-condition-variable-a.patch)
@( \
echo '+ { "Maarten Lankhorst", "winmm: Load winealsa if winepulse is found.", 1 },'; \
echo '+ { "Maarten Lankhorst", "winepulse: Add initial stub for pulseaudio support.", 1 },'; \
@ -2413,7 +2412,6 @@ winepulse-PulseAudio_Support.ok:
echo '+ { "Mark Harmstone", "winepulse: implement exclusive mode.", 1 },'; \
echo '+ { "Mark Harmstone", "winepulse: fix segfault in pulse_rd_loop.", 1 },'; \
echo '+ { "Mark Harmstone", "winepulse: implement GetPropValue.", 1 },'; \
echo '+ { "Sebastian Lackner", "winepulse: Replace busyloop with condition variable and minor style fixes.", 1 },'; \
) > winepulse-PulseAudio_Support.ok
# Patchset winex11-CandidateWindowPos

View File

@ -1,4 +1,4 @@
From daf353964820e0c9c3b49a5dab3eb952f27d27c3 Mon Sep 17 00:00:00 2001
From 195910962f9d93ee1cad8278ed0ba31d4efc5d34 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Mon, 3 Nov 2014 02:06:40 +0000
Subject: winepulse: expose audio devices directly to programs
@ -15,11 +15,11 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Fixed compiler warnings with -Werror
* Some style fixes and better error handling
---
dlls/winepulse.drv/mmdevdrv.c | 227 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 220 insertions(+), 7 deletions(-)
dlls/winepulse.drv/mmdevdrv.c | 233 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 226 insertions(+), 7 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index e755e8a..f6688d8 100644
index e755e8a..d29fa06 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -85,6 +85,11 @@ const WCHAR pulse_keyW[] = {'S','o','f','t','w','a','r','e','\\',
@ -78,7 +78,7 @@ index e755e8a..f6688d8 100644
if (ret < 0) {
WARN("Returns %i\n", ret);
return AUDCLNT_E_ENDPOINT_CREATE_FAILED;
@@ -740,11 +758,127 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -740,11 +758,131 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
return S_OK;
}
@ -140,61 +140,65 @@ index e755e8a..f6688d8 100644
+};
+
+static void pulse_all_sink_info_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
+ struct pulse_all_info_cb_data *st = (struct pulse_all_info_cb_data*)userdata;
+ struct pulse_all_info_cb_data *st = userdata;
+ void *tmp;
+ DWORD len;
+
+ if (!i)
+ return;
+ if (!i) goto out;
+
+ tmp = HeapReAlloc(GetProcessHeap(), 0, st->ids, sizeof(WCHAR*) * (st->num + 1));
+ if (!tmp) return;
+ if (!tmp) goto out;
+ st->ids = tmp;
+
+ tmp = HeapReAlloc(GetProcessHeap(), 0, st->keys, sizeof(GUID) * (st->num + 1));
+ if (!tmp) return;
+ if (!tmp) goto out;
+ st->keys = tmp;
+
+ len = MultiByteToWideChar(CP_UTF8, 0, i->description, -1, NULL, 0);
+ if (!len) return;
+ if (!len) goto out;
+
+ st->ids[st->num] = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ if (!st->ids[st->num]) return;
+ if (!st->ids[st->num]) goto out;
+
+ MultiByteToWideChar(CP_UTF8, 0, i->description, -1, st->ids[st->num], len);
+ if (!get_device_guid(st->flow, i->name, &(st->keys[st->num])))
+ CoCreateGuid(&(st->keys[st->num]));
+
+ st->num++;
+
+out:
+ pthread_cond_signal(&pulse_cond);
+}
+
+static void pulse_all_source_info_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata) {
+ struct pulse_all_info_cb_data *st = (struct pulse_all_info_cb_data*)userdata;
+ struct pulse_all_info_cb_data *st = userdata;
+ void *tmp;
+ DWORD len;
+
+ if (!i)
+ return;
+ if (!i) goto out;
+
+ tmp = HeapReAlloc(GetProcessHeap(), 0, st->ids, sizeof(WCHAR*) * (st->num + 1));
+ if (!tmp) return;
+ if (!tmp) goto out;
+ st->ids = tmp;
+
+ tmp = HeapReAlloc(GetProcessHeap(), 0, st->keys, sizeof(GUID) * (st->num + 1));
+ if (!tmp) return;
+ if (!tmp) goto out;
+ st->keys = tmp;
+
+ len = MultiByteToWideChar(CP_UTF8, 0, i->description, -1, NULL, 0);
+ if (!len) return;
+ if (!len) goto out;
+
+ st->ids[st->num] = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ if (!st->ids[st->num]) return;
+ if (!st->ids[st->num]) goto out;
+
+ MultiByteToWideChar(CP_UTF8, 0, i->description, -1, st->ids[st->num], len);
+ if (!get_device_guid(st->flow, i->name, &(st->keys[st->num])))
+ CoCreateGuid(&(st->keys[st->num]));
+
+ st->num++;
+
+out:
+ pthread_cond_signal(&pulse_cond);
+}
+
+HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **keys,
@ -207,7 +211,7 @@ index e755e8a..f6688d8 100644
TRACE("%d %p %p %p\n", flow, ids, num, def_index);
@@ -778,6 +912,25 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **
@@ -778,6 +916,27 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **
else
(*keys)[0] = pulse_capture_guid;
@ -216,15 +220,17 @@ index e755e8a..f6688d8 100644
+ st.keys = *keys;
+ st.num = *num;
+
+ pthread_mutex_lock(&pulse_lock);
+ if (flow == eRender)
+ o = pa_context_get_sink_info_list(pulse_ctx, &pulse_all_sink_info_cb, &st);
+ else
+ o = pa_context_get_source_info_list(pulse_ctx, &pulse_all_source_info_cb, &st);
+
+ if (o){
+ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING){ }
+ if (o) {
+ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ pthread_cond_wait(&pulse_cond, &pulse_lock);
+ pa_operation_unref(o);
+ }
+ pthread_mutex_unlock(&pulse_lock);
+
+ *ids = st.ids;
+ *keys = st.keys;
@ -233,7 +239,7 @@ index e755e8a..f6688d8 100644
return S_OK;
}
@@ -794,8 +947,66 @@ int WINAPI AUDDRV_GetPriority(void)
@@ -794,8 +953,66 @@ int WINAPI AUDDRV_GetPriority(void)
return SUCCEEDED(hr) ? 3 : 0;
}
@ -300,7 +306,7 @@ index e755e8a..f6688d8 100644
HRESULT hr;
ACImpl *This;
int i;
@@ -813,12 +1024,13 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
@@ -813,12 +1030,13 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
}
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
@ -316,7 +322,7 @@ index e755e8a..f6688d8 100644
*out = NULL;
pthread_mutex_lock(&pulse_lock);
@@ -841,6 +1053,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
@@ -841,6 +1059,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
This->parent = dev;
for (i = 0; i < PA_CHANNELS_MAX; ++i)
This->vol[i] = 1.f;

View File

@ -1,4 +1,4 @@
From 1e94fe02352f3dd4d0122775a8d6a46266a3171a Mon Sep 17 00:00:00 2001
From 81fda4861fddbb9683afe0761ae54b454765901f Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Tue, 18 Nov 2014 18:35:31 +0000
Subject: winepulse: implement exclusive mode
@ -8,10 +8,10 @@ Subject: winepulse: implement exclusive mode
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 368c275..f35a108 100644
index d29fa06..40eaaf2 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -1410,6 +1410,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
@@ -1416,6 +1416,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
const GUID *sessionguid)
{
ACImpl *This = impl_from_IAudioClient(iface);
@ -19,7 +19,7 @@ index 368c275..f35a108 100644
HRESULT hr = S_OK;
UINT period_bytes;
@@ -1421,8 +1422,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
@@ -1427,8 +1428,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
if (mode != AUDCLNT_SHAREMODE_SHARED && mode != AUDCLNT_SHAREMODE_EXCLUSIVE)
return AUDCLNT_E_NOT_INITIALIZED;
@ -28,7 +28,7 @@ index 368c275..f35a108 100644
if (flags & ~(AUDCLNT_STREAMFLAGS_CROSSPROCESS |
AUDCLNT_STREAMFLAGS_LOOPBACK |
@@ -1446,27 +1445,26 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
@@ -1452,27 +1451,26 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
if (FAILED(hr))
goto exit;
@ -74,7 +74,7 @@ index 368c275..f35a108 100644
period_bytes = pa_frame_size(&This->ss) * MulDiv(period, This->ss.rate, 10000000);
if (duration < 20000000)
@@ -1771,12 +1769,6 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
@@ -1777,12 +1775,6 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
else
*out = closest;

View File

@ -1,15 +1,15 @@
From b6c4b15d71542a567f6ca67fe4d0463b04c5fedc Mon Sep 17 00:00:00 2001
From 0329e30fe4fe51ec5c7923d11987aa6c28cbd773 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Thu, 4 Dec 2014 21:36:42 +0000
Subject: [PATCH] winepulse: implement GetPropValue
Subject: winepulse: implement GetPropValue
---
dlls/winepulse.drv/mmdevdrv.c | 153 ++++++++++++++++++++++++++++++++++
dlls/winepulse.drv/mmdevdrv.c | 155 ++++++++++++++++++++++++++++++++++
dlls/winepulse.drv/winepulse.drv.spec | 1 +
2 files changed, 154 insertions(+)
2 files changed, 156 insertions(+)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 37ff7ee..3acbca5 100644
index ea20c2b..986584c 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -52,6 +52,7 @@
@ -20,7 +20,7 @@ index 37ff7ee..3acbca5 100644
#include "mmdeviceapi.h"
#include "audioclient.h"
#include "endpointvolume.h"
@@ -3430,3 +3431,155 @@ HRESULT WINAPI AUDDRV_GetAudioSessionManager(IMMDevice *device,
@@ -3437,3 +3438,157 @@ HRESULT WINAPI AUDDRV_GetAudioSessionManager(IMMDevice *device,
*out = &This->IAudioSessionManager2_iface;
return S_OK;
}
@ -89,12 +89,12 @@ index 37ff7ee..3acbca5 100644
+ return S_OK;
+}
+
+typedef struct {
+struct pulse_prop_values_info_cb_data {
+ const PROPERTYKEY *prop;
+ PROPVARIANT *pv;
+ GUID *guid;
+ HRESULT hr;
+} pulse_prop_values_info_cb_data;
+};
+
+static const PROPERTYKEY devicepath_key = { /* undocumented? - {b3f8fa53-0004-438e-9003-51a46e139bfc},2 */
+ {0xb3f8fa53, 0x0004, 0x438e, {0x90, 0x03, 0x51, 0xa4, 0x6e, 0x13, 0x9b, 0xfc}}, 2
@ -102,45 +102,46 @@ index 37ff7ee..3acbca5 100644
+
+static void pulse_prop_values_sink_info_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata)
+{
+ pulse_prop_values_info_cb_data *st = (pulse_prop_values_info_cb_data*)userdata;
+ struct pulse_prop_values_info_cb_data *st = userdata;
+
+ if (!i)
+ return;
+ if (i) {
+ if (IsEqualPropertyKey(*st->prop, devicepath_key))
+ st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
+ else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
+ st->pv->vt = VT_UI4;
+ st->pv->u.ulVal = Speakers;
+ st->hr = S_OK;
+ } else
+ st->hr = E_NOTIMPL;
+ }
+
+ if (IsEqualPropertyKey(*st->prop, devicepath_key))
+ st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
+ else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
+ st->pv->vt = VT_UI4;
+ st->pv->u.ulVal = Speakers;
+
+ st->hr = S_OK;
+ } else
+ st->hr = E_NOTIMPL;
+ pthread_cond_signal(&pulse_cond);
+}
+
+static void pulse_prop_values_source_info_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata)
+{
+ pulse_prop_values_info_cb_data *st = (pulse_prop_values_info_cb_data*)userdata;
+ struct pulse_prop_values_info_cb_data *st = userdata;
+
+ if (!i)
+ return;
+ if (i)
+ {
+ if (IsEqualPropertyKey(*st->prop, devicepath_key))
+ st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
+ else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
+ st->pv->vt = VT_UI4;
+ st->pv->u.ulVal = (i->monitor_of_sink == PA_INVALID_INDEX) ? Microphone : LineLevel;
+ st->hr = S_OK;
+ } else
+ st->hr = E_NOTIMPL;
+ }
+
+ if (IsEqualPropertyKey(*st->prop, devicepath_key)) {
+ st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
+ } else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
+ st->pv->vt = VT_UI4;
+ st->pv->u.ulVal = (i->monitor_of_sink == PA_INVALID_INDEX) ? Microphone : LineLevel;
+
+ st->hr = S_OK;
+ } else
+ st->hr = E_NOTIMPL;
+ pthread_cond_signal(&pulse_cond);
+}
+
+HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out)
+{
+ struct pulse_prop_values_info_cb_data userdata;
+ char name[256];
+ EDataFlow flow;
+ pulse_prop_values_info_cb_data userdata;
+ pa_operation *o;
+
+ TRACE("%s, (%s,%u), %p\n", wine_dbgstr_guid(guid), wine_dbgstr_guid(&prop->fmtid), prop->pid, out);
@ -163,16 +164,17 @@ index 37ff7ee..3acbca5 100644
+ userdata.guid = guid;
+ userdata.hr = E_FAIL;
+
+ pthread_mutex_lock(&pulse_lock);
+ if (flow == eRender)
+ o = pa_context_get_sink_info_by_name(pulse_ctx, name, &pulse_prop_values_sink_info_cb, &userdata);
+ else
+ o = pa_context_get_source_info_by_name(pulse_ctx, name, &pulse_prop_values_source_info_cb, &userdata);
+
+ if (!o)
+ return E_FAIL;
+
+ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) { }
+ pa_operation_unref(o);
+ if (o) {
+ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ pthread_cond_wait(&pulse_cond, &pulse_lock);
+ pa_operation_unref(o);
+ }
+ pthread_mutex_unlock(&pulse_lock);
+
+ return userdata.hr;
+}
@ -186,5 +188,5 @@ index 612bf46..adda949 100644
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
+@ stdcall -private GetPropValue(ptr ptr ptr) AUDDRV_GetPropValue
--
2.0.4
2.1.3

View File

@ -1,229 +0,0 @@
From 50bcaa20cf33bd5518bdc90be72dd5dbc80fb2aa Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 6 Dec 2014 01:26:04 +0100
Subject: winepulse: Replace busyloop with condition variable and minor style
fixes.
---
dlls/winepulse.drv/mmdevdrv.c | 108 +++++++++++++++++++++++-------------------
1 file changed, 58 insertions(+), 50 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 146daad..986584c 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -817,61 +817,65 @@ struct pulse_all_info_cb_data {
};
static void pulse_all_sink_info_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
- struct pulse_all_info_cb_data *st = (struct pulse_all_info_cb_data*)userdata;
+ struct pulse_all_info_cb_data *st = userdata;
void *tmp;
DWORD len;
- if (!i)
- return;
+ if (!i) goto out;
tmp = HeapReAlloc(GetProcessHeap(), 0, st->ids, sizeof(WCHAR*) * (st->num + 1));
- if (!tmp) return;
+ if (!tmp) goto out;
st->ids = tmp;
tmp = HeapReAlloc(GetProcessHeap(), 0, st->keys, sizeof(GUID) * (st->num + 1));
- if (!tmp) return;
+ if (!tmp) goto out;
st->keys = tmp;
len = MultiByteToWideChar(CP_UTF8, 0, i->description, -1, NULL, 0);
- if (!len) return;
+ if (!len) goto out;
st->ids[st->num] = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
- if (!st->ids[st->num]) return;
+ if (!st->ids[st->num]) goto out;
MultiByteToWideChar(CP_UTF8, 0, i->description, -1, st->ids[st->num], len);
if (!get_device_guid(st->flow, i->name, &(st->keys[st->num])))
CoCreateGuid(&(st->keys[st->num]));
st->num++;
+
+out:
+ pthread_cond_signal(&pulse_cond);
}
static void pulse_all_source_info_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata) {
- struct pulse_all_info_cb_data *st = (struct pulse_all_info_cb_data*)userdata;
+ struct pulse_all_info_cb_data *st = userdata;
void *tmp;
DWORD len;
- if (!i)
- return;
+ if (!i) goto out;
tmp = HeapReAlloc(GetProcessHeap(), 0, st->ids, sizeof(WCHAR*) * (st->num + 1));
- if (!tmp) return;
+ if (!tmp) goto out;
st->ids = tmp;
tmp = HeapReAlloc(GetProcessHeap(), 0, st->keys, sizeof(GUID) * (st->num + 1));
- if (!tmp) return;
+ if (!tmp) goto out;
st->keys = tmp;
len = MultiByteToWideChar(CP_UTF8, 0, i->description, -1, NULL, 0);
- if (!len) return;
+ if (!len) goto out;
st->ids[st->num] = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
- if (!st->ids[st->num]) return;
+ if (!st->ids[st->num]) goto out;
MultiByteToWideChar(CP_UTF8, 0, i->description, -1, st->ids[st->num], len);
if (!get_device_guid(st->flow, i->name, &(st->keys[st->num])))
CoCreateGuid(&(st->keys[st->num]));
st->num++;
+
+out:
+ pthread_cond_signal(&pulse_cond);
}
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **keys,
@@ -919,15 +923,17 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **keys,
st.keys = *keys;
st.num = *num;
+ pthread_mutex_lock(&pulse_lock);
if (flow == eRender)
o = pa_context_get_sink_info_list(pulse_ctx, &pulse_all_sink_info_cb, &st);
else
o = pa_context_get_source_info_list(pulse_ctx, &pulse_all_source_info_cb, &st);
-
- if (o){
- while (pa_operation_get_state(o) == PA_OPERATION_RUNNING){ }
+ if (o) {
+ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ pthread_cond_wait(&pulse_cond, &pulse_lock);
pa_operation_unref(o);
}
+ pthread_mutex_unlock(&pulse_lock);
*ids = st.ids;
*keys = st.keys;
@@ -3497,12 +3503,12 @@ static HRESULT pulse_set_device_path(pa_proplist *p, int index, GUID *guid, PROP
return S_OK;
}
-typedef struct {
+struct pulse_prop_values_info_cb_data {
const PROPERTYKEY *prop;
PROPVARIANT *pv;
GUID *guid;
HRESULT hr;
-} pulse_prop_values_info_cb_data;
+};
static const PROPERTYKEY devicepath_key = { /* undocumented? - {b3f8fa53-0004-438e-9003-51a46e139bfc},2 */
{0xb3f8fa53, 0x0004, 0x438e, {0x90, 0x03, 0x51, 0xa4, 0x6e, 0x13, 0x9b, 0xfc}}, 2
@@ -3510,45 +3516,46 @@ static const PROPERTYKEY devicepath_key = { /* undocumented? - {b3f8fa53-0004-43
static void pulse_prop_values_sink_info_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata)
{
- pulse_prop_values_info_cb_data *st = (pulse_prop_values_info_cb_data*)userdata;
+ struct pulse_prop_values_info_cb_data *st = userdata;
- if (!i)
- return;
-
- if (IsEqualPropertyKey(*st->prop, devicepath_key))
- st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
- else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
- st->pv->vt = VT_UI4;
- st->pv->u.ulVal = Speakers;
+ if (i) {
+ if (IsEqualPropertyKey(*st->prop, devicepath_key))
+ st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
+ else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
+ st->pv->vt = VT_UI4;
+ st->pv->u.ulVal = Speakers;
+ st->hr = S_OK;
+ } else
+ st->hr = E_NOTIMPL;
+ }
- st->hr = S_OK;
- } else
- st->hr = E_NOTIMPL;
+ pthread_cond_signal(&pulse_cond);
}
static void pulse_prop_values_source_info_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata)
{
- pulse_prop_values_info_cb_data *st = (pulse_prop_values_info_cb_data*)userdata;
+ struct pulse_prop_values_info_cb_data *st = userdata;
- if (!i)
- return;
-
- if (IsEqualPropertyKey(*st->prop, devicepath_key)) {
- st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
- } else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
- st->pv->vt = VT_UI4;
- st->pv->u.ulVal = (i->monitor_of_sink == PA_INVALID_INDEX) ? Microphone : LineLevel;
+ if (i)
+ {
+ if (IsEqualPropertyKey(*st->prop, devicepath_key))
+ st->hr = pulse_set_device_path(i->proplist, i->index, st->guid, st->pv);
+ else if (IsEqualPropertyKey(*st->prop, PKEY_AudioEndpoint_FormFactor)) {
+ st->pv->vt = VT_UI4;
+ st->pv->u.ulVal = (i->monitor_of_sink == PA_INVALID_INDEX) ? Microphone : LineLevel;
+ st->hr = S_OK;
+ } else
+ st->hr = E_NOTIMPL;
+ }
- st->hr = S_OK;
- } else
- st->hr = E_NOTIMPL;
+ pthread_cond_signal(&pulse_cond);
}
HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out)
{
+ struct pulse_prop_values_info_cb_data userdata;
char name[256];
EDataFlow flow;
- pulse_prop_values_info_cb_data userdata;
pa_operation *o;
TRACE("%s, (%s,%u), %p\n", wine_dbgstr_guid(guid), wine_dbgstr_guid(&prop->fmtid), prop->pid, out);
@@ -3571,16 +3578,17 @@ HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARI
userdata.guid = guid;
userdata.hr = E_FAIL;
+ pthread_mutex_lock(&pulse_lock);
if (flow == eRender)
o = pa_context_get_sink_info_by_name(pulse_ctx, name, &pulse_prop_values_sink_info_cb, &userdata);
else
o = pa_context_get_source_info_by_name(pulse_ctx, name, &pulse_prop_values_source_info_cb, &userdata);
-
- if (!o)
- return E_FAIL;
-
- while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) { }
- pa_operation_unref(o);
+ if (o) {
+ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ pthread_cond_wait(&pulse_cond, &pulse_lock);
+ pa_operation_unref(o);
+ }
+ pthread_mutex_unlock(&pulse_lock);
return userdata.hr;
}
--
2.1.3