From 43f7c63547d27bb9e8fe327a281a58adcb7ee983 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 11 May 2006 20:13:56 +0000 Subject: * 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 --- src/polypmixerctrl.c | 27 +++++++++++++++++++-------- 1 file 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; } -- cgit