summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-05-11 20:13:56 +0000
committerLennart Poettering <lennart@poettering.net>2006-05-11 20:13:56 +0000
commit43f7c63547d27bb9e8fe327a281a58adcb7ee983 (patch)
tree6a93e4ed9e1eb1e8c50811448cbb5a7637473dba
parent8c759b671706ca55a770350502ea096e1cba083f (diff)
* deal correctly with EOL subscription callbacks
* fix "device-name" of source mixer controls * actually subscribe to source change events git-svn-id: file:///home/lennart/svn/public/gst-pulse/trunk@24 bb39ca4e-bce3-0310-b5d4-eea78a553289
-rw-r--r--src/polypmixerctrl.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/polypmixerctrl.c b/src/polypmixerctrl.c
index ae41faa..5b89acc 100644
--- a/src/polypmixerctrl.c
+++ b/src/polypmixerctrl.c
@@ -57,7 +57,13 @@ static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
/* Called from the background thread! */
- if (eol || !i)
+ if (!i && eol < 0) {
+ c->operation_success = 0;
+ pa_threaded_mainloop_signal(c->mainloop, 0);
+ return;
+ }
+
+ if (eol)
return;
g_free(c->name);
@@ -70,11 +76,11 @@ static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
c->muted = i->mute;
c->type = GST_POLYPMIXER_SINK;
- c->operation_success = 1;
if (c->track)
c->track->flags = (c->track->flags & ~GST_MIXER_TRACK_MUTE) | (c->muted ? GST_MIXER_TRACK_MUTE : 0);
+ c->operation_success = 1;
pa_threaded_mainloop_signal(c->mainloop, 0);
}
@@ -82,13 +88,19 @@ static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_sou
GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata;
/* Called from the background thread! */
-
- if (eol || !i)
+
+ if (!i && eol < 0) {
+ c->operation_success = 0;
+ pa_threaded_mainloop_signal(c->mainloop, 0);
return;
+ }
+ if (eol)
+ return;
+
g_free(c->name);
g_free(c->description);
- c->name = g_strdup(i->description);
+ c->name = g_strdup(i->name);
c->description = g_strdup(i->description);
c->index = i->index;
c->channel_map = i->channel_map;
@@ -96,11 +108,10 @@ static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_sou
c->muted = i->mute;
c->type = GST_POLYPMIXER_SOURCE;
- c->operation_success = 1;
-
if (c->track)
c->track->flags = (c->track->flags & ~GST_MIXER_TRACK_MUTE) | (c->muted ? GST_MIXER_TRACK_MUTE : 0);
+ c->operation_success = 1;
pa_threaded_mainloop_signal(c->mainloop, 0);
}
@@ -181,7 +192,7 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
/* Subscribe to events */
- if (!(o = pa_context_subscribe(c->context, PA_SUBSCRIPTION_MASK_SINK|PA_SUBSCRIPTION_EVENT_SOURCE, gst_polypmixer_ctrl_success_cb, c))) {
+ if (!(o = pa_context_subscribe(c->context, PA_SUBSCRIPTION_MASK_SINK|PA_SUBSCRIPTION_MASK_SOURCE, gst_polypmixer_ctrl_success_cb, c))) {
GST_WARNING("Failed to subscribe to events: %s", pa_strerror(pa_context_errno(c->context)));
goto unlock_and_fail;
}