summaryrefslogtreecommitdiffstats
path: root/src/pulsemixerctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsemixerctrl.c')
-rw-r--r--src/pulsemixerctrl.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/pulsemixerctrl.c b/src/pulsemixerctrl.c
index c3941dd..09f7011 100644
--- a/src/pulsemixerctrl.c
+++ b/src/pulsemixerctrl.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
@@ -36,7 +36,7 @@ static void gst_pulsemixer_ctrl_context_state_cb(pa_context *context, void *user
GstPulseMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata);
/* Called from the background thread! */
-
+
switch (pa_context_get_state(context)) {
case PA_CONTEXT_READY:
case PA_CONTEXT_TERMINATED:
@@ -56,7 +56,7 @@ static void gst_pulsemixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
GstPulseMixerCtrl *c = userdata;
/* Called from the background thread! */
-
+
if (c->outstandig_queries > 0)
c->outstandig_queries--;
@@ -64,10 +64,10 @@ static void gst_pulsemixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
if (c->ignore_queries > 0)
c->ignore_queries--;
-
+
return;
}
-
+
if (!i && eol < 0) {
c->operation_success = 0;
pa_threaded_mainloop_signal(c->mainloop, 0);
@@ -92,7 +92,7 @@ static void gst_pulsemixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
i = (i & ~GST_MIXER_TRACK_MUTE) | (c->muted ? GST_MIXER_TRACK_MUTE : 0);
g_atomic_int_set(&c->track->flags, i);
}
-
+
c->operation_success = 1;
pa_threaded_mainloop_signal(c->mainloop, 0);
}
@@ -109,7 +109,7 @@ static void gst_pulsemixer_ctrl_source_info_cb(pa_context *context, const pa_sou
if (c->ignore_queries > 0)
c->ignore_queries--;
-
+
return;
}
@@ -121,7 +121,7 @@ static void gst_pulsemixer_ctrl_source_info_cb(pa_context *context, const pa_sou
if (eol)
return;
-
+
g_free(c->name);
g_free(c->description);
c->name = g_strdup(i->name);
@@ -147,7 +147,7 @@ static void gst_pulsemixer_ctrl_subscribe_cb(pa_context *context, pa_subscriptio
pa_operation *o = NULL;
/* Called from the background thread! */
-
+
if (c->index != idx)
return;
@@ -158,7 +158,7 @@ static void gst_pulsemixer_ctrl_subscribe_cb(pa_context *context, pa_subscriptio
o = pa_context_get_sink_info_by_index(c->context, c->index, gst_pulsemixer_ctrl_sink_info_cb, c);
else
o = pa_context_get_source_info_by_index(c->context, c->index, gst_pulsemixer_ctrl_source_info_cb, c);
-
+
if (!o) {
GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context)));
return;
@@ -205,7 +205,7 @@ static gboolean gst_pulsemixer_ctrl_open(GstPulseMixerCtrl *c) {
pa_context_set_state_callback(c->context, gst_pulsemixer_ctrl_context_state_cb, c);
pa_context_set_subscribe_callback(c->context, gst_pulsemixer_ctrl_subscribe_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;
@@ -220,7 +220,7 @@ static gboolean gst_pulsemixer_ctrl_open(GstPulseMixerCtrl *c) {
}
/* Subscribe to events */
-
+
if (!(o = pa_context_subscribe(c->context, PA_SUBSCRIPTION_MASK_SINK|PA_SUBSCRIPTION_MASK_SOURCE, gst_pulsemixer_ctrl_success_cb, c))) {
GST_WARNING("Failed to subscribe to events: %s", pa_strerror(pa_context_errno(c->context)));
goto unlock_and_fail;
@@ -244,13 +244,13 @@ static gboolean gst_pulsemixer_ctrl_open(GstPulseMixerCtrl *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);
CHECK_DEAD_GOTO(c, unlock_and_fail);
}
-
+
pa_operation_unref(o);
o = NULL;
@@ -265,13 +265,13 @@ static gboolean gst_pulsemixer_ctrl_open(GstPulseMixerCtrl *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);
}
-
+
pa_operation_unref(o);
o = NULL;
@@ -295,12 +295,12 @@ unlock_and_fail:
if (o)
pa_operation_unref(o);
-
+
if (c->mainloop)
pa_threaded_mainloop_unlock(c->mainloop);
g_free(name);
-
+
return FALSE;
}
@@ -309,7 +309,7 @@ static void gst_pulsemixer_ctrl_close(GstPulseMixerCtrl *c) {
if (c->mainloop)
pa_threaded_mainloop_stop(c->mainloop);
-
+
if (c->context) {
pa_context_disconnect(c->context);
pa_context_unref(c->context);
@@ -361,7 +361,7 @@ GstPulseMixerCtrl* gst_pulsemixer_ctrl_new(const gchar *server, const gchar *dev
gst_pulsemixer_ctrl_free(c);
return NULL;
}
-
+
return c;
}
@@ -369,7 +369,7 @@ void gst_pulsemixer_ctrl_free(GstPulseMixerCtrl *c) {
g_assert(c);
gst_pulsemixer_ctrl_close(c);
-
+
g_free(c->server);
g_free(c->device);
g_free(c->name);
@@ -392,7 +392,7 @@ static void gst_pulsemixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event
o = pa_context_set_sink_volume_by_index(c->context, c->index, &c->volume, NULL, NULL);
else
o = pa_context_set_source_volume_by_index(c->context, c->index, &c->volume, NULL, NULL);
-
+
if (!o)
GST_WARNING("Failed to set device volume: %s", pa_strerror(pa_context_errno(c->context)));
else
@@ -417,7 +417,7 @@ static void gst_pulsemixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event
/* Make sure that all outstanding queries are being ignored */
c->ignore_queries = c->outstandig_queries;
-
+
g_assert(e == c->time_event);
a->time_free(e);
c->time_event = NULL;
@@ -430,7 +430,7 @@ static void restart_time_event(GstPulseMixerCtrl *c) {
if (c->time_event)
return;
-
+
/* Updating the volume too often will cause a lot of traffic
* when accessing a networked server. Therefore we make sure
* to update the volume only once every 50ms */
@@ -442,7 +442,7 @@ static void restart_time_event(GstPulseMixerCtrl *c) {
void gst_pulsemixer_ctrl_set_volume(GstPulseMixerCtrl *c, GstMixerTrack *track, gint *volumes) {
pa_cvolume v;
int i;
-
+
g_assert(c);
g_assert(track == c->track);
@@ -463,12 +463,12 @@ void gst_pulsemixer_ctrl_set_volume(GstPulseMixerCtrl *c, GstMixerTrack *track,
void gst_pulsemixer_ctrl_get_volume(GstPulseMixerCtrl *c, GstMixerTrack *track, gint *volumes) {
int i;
-
+
g_assert(c);
g_assert(track == c->track);
pa_threaded_mainloop_lock(c->mainloop);
-
+
for (i = 0; i < c->channel_map.channels; i++)
volumes[i] = c->volume.values[i];
@@ -488,13 +488,13 @@ void gst_pulsemixer_ctrl_set_mute(GstPulseMixerCtrl *c, GstMixerTrack *track, gb
c->muted = !!mute;
c->update_mute = TRUE;
-
+
if (c->track) {
int i = g_atomic_int_get(&c->track->flags);
i = (i & ~GST_MIXER_TRACK_MUTE) | (c->muted ? GST_MIXER_TRACK_MUTE : 0);
g_atomic_int_set(&c->track->flags, i);
}
-
+
restart_time_event(c);
pa_threaded_mainloop_unlock(c->mainloop);