diff options
Diffstat (limited to 'src/pulseprobe.c')
-rw-r--r-- | src/pulseprobe.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/pulseprobe.c b/src/pulseprobe.c index 0e487e4..0bc4ef2 100644 --- a/src/pulseprobe.c +++ b/src/pulseprobe.c @@ -2,17 +2,17 @@ /*** This file is part of gst-pulse. - + gst-pulse is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + gst-pulse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -33,7 +33,7 @@ static void gst_pulseprobe_context_state_cb(pa_context *context, void *userdata) GstPulseProbe *c = (GstPulseProbe*) userdata; /* Called from the background thread! */ - + switch (pa_context_get_state(context)) { case PA_CONTEXT_READY: case PA_CONTEXT_TERMINATED: @@ -61,7 +61,7 @@ static void gst_pulseprobe_sink_info_cb(pa_context *context, const pa_sink_info if (i) c->devices = g_list_append(c->devices, g_strdup(i->name)); - + } static void gst_pulseprobe_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) { @@ -105,7 +105,7 @@ static gboolean gst_pulseprobe_open(GstPulseProbe *c) { } pa_context_set_state_callback(c->context, gst_pulseprobe_context_state_cb, c); - + if (pa_context_connect(c->context, c->server, 0, NULL) < 0) { GST_WARNING("Failed to connect context: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; @@ -132,7 +132,7 @@ unlock_and_fail: pa_threaded_mainloop_unlock(c->mainloop); g_free(name); - + return FALSE; } @@ -147,15 +147,15 @@ static gboolean gst_pulseprobe_enumerate(GstPulseProbe *c) { pa_operation *o = NULL; pa_threaded_mainloop_lock(c->mainloop); - + if (c->enumerate_sinks) { /* Get sink info */ - + if (!(o = pa_context_get_sink_info_list(c->context, gst_pulseprobe_sink_info_cb, c))) { GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; } - + c->operation_success = 0; while (pa_operation_get_state(o) != PA_OPERATION_DONE) { pa_threaded_mainloop_wait(c->mainloop); @@ -170,7 +170,7 @@ static gboolean gst_pulseprobe_enumerate(GstPulseProbe *c) { pa_operation_unref(o); o = NULL; } - + if (c->enumerate_sources) { /* Get source info */ @@ -178,13 +178,13 @@ static gboolean gst_pulseprobe_enumerate(GstPulseProbe *c) { GST_WARNING("Failed to get source info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; } - + c->operation_success = 0; while (pa_operation_get_state(o) != PA_OPERATION_DONE) { pa_threaded_mainloop_wait(c->mainloop); CHECK_DEAD_GOTO(c, unlock_and_fail); } - + if (!c->operation_success) { GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; @@ -204,7 +204,7 @@ unlock_and_fail: if (o) pa_operation_unref(o); - + pa_threaded_mainloop_unlock(c->mainloop); return FALSE; @@ -215,7 +215,7 @@ static void gst_pulseprobe_close(GstPulseProbe *c) { if (c->mainloop) pa_threaded_mainloop_stop(c->mainloop); - + if (c->context) { pa_context_disconnect(c->context); pa_context_unref(c->context); @@ -235,7 +235,7 @@ GstPulseProbe* gst_pulseprobe_new(GObjectClass *klass, guint prop_id, const gcha c->server = g_strdup(server); c->enumerate_sinks = sinks; c->enumerate_sources = sources; - + c->mainloop = NULL; c->context = NULL; @@ -243,7 +243,7 @@ GstPulseProbe* gst_pulseprobe_new(GObjectClass *klass, guint prop_id, const gcha c->properties = g_list_append(NULL, g_object_class_find_property(klass, "device")); c->devices = NULL; c->devices_valid = 0; - + return c; } @@ -257,7 +257,7 @@ void gst_pulseprobe_free(GstPulseProbe* c) { g_list_foreach(c->devices, (GFunc) g_free, NULL); g_list_free(c->devices); - + g_free(c); } @@ -296,7 +296,7 @@ GValueArray *gst_pulseprobe_get_values(GstPulseProbe *c, guint prop_id, const GP G_OBJECT_WARN_INVALID_PROPERTY_ID(c, prop_id, pspec); return NULL; } - + if (!c->devices_valid) return NULL; |