summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-11-21 18:50:05 +0000
committerLennart Poettering <lennart@poettering.net>2007-11-21 18:50:05 +0000
commitaac3f2e8a121df5590ee9d067f790bc7aed5ae17 (patch)
treea6732e2bd31022e7502a368ce1552dea4f8de4af
parentd3057134691b1676d22687eb07b3da85299fdf11 (diff)
untabify, drop trailing whitespace
git-svn-id: file:///home/lennart/svn/public/gst-pulse/trunk@74 bb39ca4e-bce3-0310-b5d4-eea78a553289
-rw-r--r--src/Makefile.am2
-rw-r--r--src/plugin.c10
-rw-r--r--src/pulsemixer.c40
-rw-r--r--src/pulsemixer.h6
-rw-r--r--src/pulsemixerctrl.c62
-rw-r--r--src/pulsemixerctrl.h8
-rw-r--r--src/pulsemixertrack.c10
-rw-r--r--src/pulsemixertrack.h6
-rw-r--r--src/pulseprobe.c38
-rw-r--r--src/pulseprobe.h6
-rw-r--r--src/pulsesink.c89
-rw-r--r--src/pulsesink.h10
-rw-r--r--src/pulsesrc.c88
-rw-r--r--src/pulsesrc.h10
-rw-r--r--src/pulseutil.h6
15 files changed, 196 insertions, 195 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8231159..6a3f6f9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,7 @@ libgstpulse_la_SOURCES = \
pulsemixer.c pulsemixer.h \
pulsemixerctrl.c pulsemixerctrl.h \
pulsemixertrack.c pulsemixertrack.h \
- pulseprobe.c pulseprobe.h
+ pulseprobe.c pulseprobe.h
libgstpulse_la_CFLAGS = $(GST_CFLAGS) $(PULSE_CFLAGS)
libgstpulse_la_LIBADD = $(PULSE_LIBS) $(GST_LIBS) -lgstaudio-0.10
diff --git a/src/plugin.c b/src/plugin.c
index 3207fbc..80fdbab 100644
--- a/src/plugin.c
+++ b/src/plugin.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
@@ -30,7 +30,7 @@
GST_DEBUG_CATEGORY(pulse_debug);
static gboolean plugin_init(GstPlugin* plugin) {
-
+
if (!gst_element_register(plugin, "pulsesink", GST_RANK_PRIMARY+10, GST_TYPE_PULSESINK))
return FALSE;
@@ -39,7 +39,7 @@ static gboolean plugin_init(GstPlugin* plugin) {
if (!gst_element_register(plugin, "pulsemixer", GST_RANK_NONE, GST_TYPE_PULSEMIXER))
return FALSE;
-
+
GST_DEBUG_CATEGORY_INIT(pulse_debug, "pulse", 0, "PulseAudio elements");
return TRUE;
}
diff --git a/src/pulsemixer.c b/src/pulsemixer.c
index 3352c1d..5c36e66 100644
--- a/src/pulsemixer.c
+++ b/src/pulsemixer.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
@@ -50,13 +50,13 @@ GST_BOILERPLATE_FULL(GstPulseMixer, gst_pulsemixer, GstElement, GST_TYPE_ELEMENT
static gboolean gst_pulsemixer_interface_supported(GstImplementsInterface* iface, GType interface_type) {
GstPulseMixer *this = GST_PULSEMIXER(iface);
-
+
if (interface_type == GST_TYPE_MIXER && this->mixer)
return TRUE;
if (interface_type == GST_TYPE_PROPERTY_PROBE && this->probe)
return TRUE;
-
+
return FALSE;
}
@@ -80,7 +80,7 @@ static void gst_pulsemixer_init_interfaces(GType type) {
NULL,
NULL,
};
-
+
g_type_add_interface_static(type, GST_TYPE_IMPLEMENTS_INTERFACE, &implements_iface_info);
g_type_add_interface_static(type, GST_TYPE_MIXER, &mixer_iface_info);
g_type_add_interface_static(type, GST_TYPE_PROPERTY_PROBE, &probe_iface_info);
@@ -101,9 +101,9 @@ static void gst_pulsemixer_base_init(gpointer g_class) {
static void gst_pulsemixer_class_init(GstPulseMixerClass *g_class) {
GstElementClass *gstelement_class = GST_ELEMENT_CLASS(g_class);
GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
-
+
gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_pulsemixer_change_state);
-
+
gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_pulsemixer_finalize);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_pulsemixer_get_property);
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_pulsemixer_set_property);
@@ -147,7 +147,7 @@ static void gst_pulsemixer_finalize(GObject *object) {
gst_pulseprobe_free(this->probe);
this->probe = NULL;
}
-
+
G_OBJECT_CLASS(parent_class)->finalize(object);
}
@@ -156,7 +156,7 @@ static void gst_pulsemixer_set_property(
guint prop_id,
const GValue * value,
GParamSpec * pspec) {
-
+
GstPulseMixer *this = GST_PULSEMIXER(object);
switch (prop_id) {
@@ -171,7 +171,7 @@ static void gst_pulsemixer_set_property(
if (this->probe)
gst_pulseprobe_set_server(this->probe, this->device);
-
+
break;
default:
@@ -185,7 +185,7 @@ static void gst_pulsemixer_get_property(
guint prop_id,
GValue * value,
GParamSpec * pspec) {
-
+
GstPulseMixer *this = GST_PULSEMIXER(object);
switch(prop_id) {
@@ -206,9 +206,9 @@ static void gst_pulsemixer_get_property(
g_free(t);
} else
g_value_set_string(value, NULL);
-
+
break;
-
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -217,30 +217,30 @@ static void gst_pulsemixer_get_property(
static GstStateChangeReturn gst_pulsemixer_change_state(GstElement *element, GstStateChange transition) {
GstPulseMixer *this = GST_PULSEMIXER(element);
-
+
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!this->mixer)
this->mixer = gst_pulsemixer_ctrl_new(this->server, this->device, GST_PULSEMIXER_UNKNOWN);
-
+
break;
-
+
case GST_STATE_CHANGE_READY_TO_NULL:
if (this->mixer) {
gst_pulsemixer_ctrl_free(this->mixer);
this->mixer = NULL;
}
-
+
break;
-
+
default:
;
}
if (GST_ELEMENT_CLASS(parent_class)->change_state)
return GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
-
+
return GST_STATE_CHANGE_SUCCESS;
}
diff --git a/src/pulsemixer.h b/src/pulsemixer.h
index 13684d6..e11dfbc 100644
--- a/src/pulsemixer.h
+++ b/src/pulsemixer.h
@@ -5,17 +5,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
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);
diff --git a/src/pulsemixerctrl.h b/src/pulsemixerctrl.h
index 40b4213..1888c36 100644
--- a/src/pulsemixerctrl.h
+++ b/src/pulsemixerctrl.h
@@ -5,17 +5,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
@@ -43,7 +43,7 @@ typedef enum {
struct _GstPulseMixerCtrl {
GList *tracklist;
-
+
gchar *server, *device;
pa_threaded_mainloop *mainloop;
diff --git a/src/pulsemixertrack.c b/src/pulsemixertrack.c
index 79ab47c..ab5f7c4 100644
--- a/src/pulsemixertrack.c
+++ b/src/pulsemixertrack.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
@@ -42,7 +42,7 @@ static void gst_pulsemixer_track_init(GstPulseMixerTrack *track) {
GstMixerTrack *gst_pulsemixer_track_new(GstPulseMixerCtrl *control) {
GstPulseMixerTrack *pulsetrack;
GstMixerTrack *track;
-
+
pulsetrack = g_object_new(GST_TYPE_PULSEMIXER_TRACK, NULL);
pulsetrack->control = control;
@@ -54,6 +54,6 @@ GstMixerTrack *gst_pulsemixer_track_new(GstPulseMixerCtrl *control) {
(control->muted ? GST_MIXER_TRACK_MUTE : 0);
track->min_volume = PA_VOLUME_MUTED;
track->max_volume = PA_VOLUME_NORM;
-
+
return track;
}
diff --git a/src/pulsemixertrack.h b/src/pulsemixertrack.h
index 69817bf..80a3028 100644
--- a/src/pulsemixertrack.h
+++ b/src/pulsemixertrack.h
@@ -5,17 +5,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
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;
diff --git a/src/pulseprobe.h b/src/pulseprobe.h
index ad97c9f..5826cc9 100644
--- a/src/pulseprobe.h
+++ b/src/pulseprobe.h
@@ -5,17 +5,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
diff --git a/src/pulsesink.c b/src/pulsesink.c
index 04b10be..295811e 100644
--- a/src/pulsesink.c
+++ b/src/pulsesink.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
@@ -82,7 +82,7 @@ static void gst_pulsesink_base_init(gpointer g_class) {
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
-
+
"audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
@@ -105,7 +105,7 @@ static void gst_pulsesink_base_init(gpointer g_class) {
"channels = (int) [ 1, 16 ]"
)
);
-
+
static const GstElementDetails details =
GST_ELEMENT_DETAILS(
"PulseAudio Audio Sink",
@@ -114,7 +114,7 @@ static void gst_pulsesink_base_init(gpointer g_class) {
"Lennart Poettering");
GstElementClass *element_class = GST_ELEMENT_CLASS(g_class);
-
+
gst_element_class_set_details(element_class, &details);
gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&pad_template));
}
@@ -122,19 +122,19 @@ static void gst_pulsesink_base_init(gpointer g_class) {
static void gst_pulsesink_class_init(
gpointer g_class,
gpointer class_data) {
-
+
GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS(g_class);
GstAudioSinkClass *gstaudiosink_class = GST_AUDIO_SINK_CLASS(g_class);
parent_class = g_type_class_peek_parent(g_class);
-
+
gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_pulsesink_dispose);
gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_pulsesink_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_pulsesink_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_pulsesink_get_property);
gstbasesink_class->event = GST_DEBUG_FUNCPTR(gst_pulsesink_event);
-
+
gstaudiosink_class->open = GST_DEBUG_FUNCPTR(gst_pulsesink_open);
gstaudiosink_class->close = GST_DEBUG_FUNCPTR(gst_pulsesink_close);
gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR(gst_pulsesink_prepare);
@@ -142,7 +142,7 @@ static void gst_pulsesink_class_init(
gstaudiosink_class->write = GST_DEBUG_FUNCPTR(gst_pulsesink_write);
gstaudiosink_class->delay = GST_DEBUG_FUNCPTR(gst_pulsesink_delay);
gstaudiosink_class->reset = GST_DEBUG_FUNCPTR(gst_pulsesink_reset);
-
+
/* Overwrite GObject fields */
g_object_class_install_property(
gobject_class,
@@ -157,12 +157,12 @@ static void gst_pulsesink_class_init(
static void gst_pulsesink_init(
GTypeInstance * instance,
gpointer g_class) {
-
+
GstPulseSink *pulsesink = GST_PULSESINK(instance);
int e;
pulsesink->server = pulsesink->device = pulsesink->stream_name = NULL;
-
+
pulsesink->context = NULL;
pulsesink->stream = NULL;
@@ -219,7 +219,7 @@ static void gst_pulsesink_set_property(
GObject * object,
guint prop_id,
const GValue * value,
- GParamSpec * pspec) {
+ GParamSpec * pspec) {
GstPulseSink *pulsesink = GST_PULSESINK(object);
switch (prop_id) {
@@ -244,7 +244,7 @@ static void gst_pulsesink_get_property(
guint prop_id,
GValue * value,
GParamSpec * pspec) {
-
+
GstPulseSink *pulsesink = GST_PULSESINK(object);
switch(prop_id) {
@@ -321,7 +321,7 @@ static gboolean gst_pulsesink_open(GstAudioSink *asink) {
}
pa_context_set_state_callback(pulsesink->context, gst_pulsesink_context_state_cb, pulsesink);
-
+
if (pa_context_connect(pulsesink->context, pulsesink->server, 0, NULL) < 0) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
@@ -340,7 +340,7 @@ static gboolean gst_pulsesink_open(GstAudioSink *asink) {
return TRUE;
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesink->mainloop);
g_free(name);
return FALSE;
@@ -359,7 +359,7 @@ static gboolean gst_pulsesink_close(GstAudioSink *asink) {
static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *spec) {
pa_buffer_attr buf_attr;
pa_channel_map channel_map;
-
+
GstPulseSink *pulsesink = GST_PULSESINK(asink);
if (!gst_pulse_fill_sample_spec(spec, &pulsesink->sample_spec)) {
@@ -373,7 +373,7 @@ static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *sp
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Bad context state: %s", pulsesink->context ? pa_strerror(pa_context_errno(pulsesink->context)) : NULL), (NULL));
goto unlock_and_fail;
}
-
+
if (!(pulsesink->stream = pa_stream_new(pulsesink->context, pulsesink->stream_name ? pulsesink->stream_name : "Playback Stream", &pulsesink->sample_spec, gst_pulse_gst_to_channel_map(&channel_map,spec)))) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
@@ -386,8 +386,9 @@ static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *sp
memset(&buf_attr, 0, sizeof(buf_attr));
buf_attr.tlength = spec->segtotal*spec->segsize;
buf_attr.maxlength = buf_attr.tlength*2;
- buf_attr.prebuf = buf_attr.minreq = spec->segsize;
-
+ buf_attr.prebuf = buf_attr.tlength*2;
+ buf_attr.minreq = spec->segsize;
+
if (pa_stream_connect_playback(pulsesink->stream, pulsesink->device, &buf_attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_NOT_MONOTONOUS, NULL, NULL) < 0) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
@@ -405,11 +406,11 @@ static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *sp
spec->bytes_per_sample = pa_frame_size(&pulsesink->sample_spec);
memset(spec->silence_sample, 0, spec->bytes_per_sample);
-
+
return TRUE;
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesink->mainloop);
return FALSE;
}
@@ -434,15 +435,15 @@ if (!(pulsesink)->context || pa_context_get_state((pulsesink)->context) != PA_CO
static guint gst_pulsesink_write(GstAudioSink *asink, gpointer data, guint length) {
GstPulseSink *pulsesink = GST_PULSESINK(asink);
size_t sum = 0;
-
+
pa_threaded_mainloop_lock(pulsesink->mainloop);
while (length > 0) {
size_t l;
-
+
for (;;) {
CHECK_DEAD_GOTO(pulsesink, unlock_and_fail);
-
+
if ((l = pa_stream_writable_size(pulsesink->stream)) == (size_t) -1) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("pa_stream_writable_size() failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
@@ -450,13 +451,13 @@ static guint gst_pulsesink_write(GstAudioSink *asink, gpointer data, guint lengt
if (l > 0)
break;
-
+
pa_threaded_mainloop_wait(pulsesink->mainloop);
}
if (l > length)
l = length;
-
+
if (pa_stream_write(pulsesink->stream, data, l, NULL, 0, PA_SEEK_RELATIVE) < 0) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("pa_stream_write() failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
@@ -471,9 +472,9 @@ static guint gst_pulsesink_write(GstAudioSink *asink, gpointer data, guint lengt
pa_threaded_mainloop_unlock(pulsesink->mainloop);
return sum;
-
+
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesink->mainloop);
return 0;
}
@@ -486,7 +487,7 @@ static guint gst_pulsesink_delay(GstAudioSink *asink) {
for (;;) {
CHECK_DEAD_GOTO(pulsesink, unlock_and_fail);
-
+
if (pa_stream_get_latency(pulsesink->stream, &t, NULL) >= 0)
break;
@@ -503,7 +504,7 @@ static guint gst_pulsesink_delay(GstAudioSink *asink) {
return gst_util_uint64_scale_int (t, pulsesink->sample_spec.rate, 1000000LL);
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesink->mainloop);
return 0;
}
@@ -518,7 +519,7 @@ static void gst_pulsesink_success_cb(pa_stream *s, int success, void *userdata)
static void gst_pulsesink_reset(GstAudioSink *asink) {
GstPulseSink *pulsesink = GST_PULSESINK(asink);
pa_operation *o = NULL;
-
+
pa_threaded_mainloop_lock(pulsesink->mainloop);
CHECK_DEAD_GOTO(pulsesink, unlock_and_fail);
@@ -531,7 +532,7 @@ static void gst_pulsesink_reset(GstAudioSink *asink) {
pulsesink->operation_success = 0;
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(pulsesink, unlock_and_fail);
-
+
pa_threaded_mainloop_wait(pulsesink->mainloop);
}
@@ -539,27 +540,27 @@ static void gst_pulsesink_reset(GstAudioSink *asink) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Flush failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
}
-
+
unlock_and_fail:
if (o) {
pa_operation_cancel(o);
pa_operation_unref(o);
}
-
+
pa_threaded_mainloop_unlock(pulsesink->mainloop);
}
static void gst_pulsesink_change_title(GstPulseSink *pulsesink, const gchar *t) {
pa_operation *o = NULL;
-
+
pa_threaded_mainloop_lock(pulsesink->mainloop);
g_free(pulsesink->stream_name);
pulsesink->stream_name = g_strdup(t);
-
- if (!(pulsesink)->context || pa_context_get_state((pulsesink)->context) != PA_CONTEXT_READY ||
- !(pulsesink)->stream || pa_stream_get_state((pulsesink)->stream) != PA_STREAM_READY) {
+
+ if (!(pulsesink)->context || pa_context_get_state((pulsesink)->context) != PA_CONTEXT_READY ||
+ !(pulsesink)->stream || pa_stream_get_state((pulsesink)->stream) != PA_STREAM_READY) {
goto unlock_and_fail;
}
@@ -585,7 +586,7 @@ static gboolean gst_pulsesink_event(GstBaseSink *sink, GstEvent *event) {
case GST_EVENT_TAG: {
gchar *title = NULL, *artist = NULL, *location = NULL, *description = NULL, *t = NULL, *buf = NULL;
GstTagList *l;
-
+
gst_event_parse_tag(event, &l);
gst_tag_list_get_string(l, GST_TAG_TITLE, &title);
@@ -604,25 +605,25 @@ static gboolean gst_pulsesink_event(GstBaseSink *sink, GstEvent *event) {
if (t)
gst_pulsesink_change_title(pulsesink, t);
-
+
g_free(title);
g_free(artist);
g_free(location);
g_free(description);
g_free(buf);
-
+
break;
}
default:
;
}
-
+
return GST_BASE_SINK_CLASS(parent_class)->event(sink, event);
}
GType gst_pulsesink_get_type(void) {
static GType pulsesink_type = 0;
-
+
if (!pulsesink_type) {
static const GTypeInfo pulsesink_info = {
diff --git a/src/pulsesink.h b/src/pulsesink.h
index d8b20da..a6df415 100644
--- a/src/pulsesink.h
+++ b/src/pulsesink.h
@@ -5,17 +5,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
@@ -50,10 +50,10 @@ struct _GstPulseSink {
gchar *server, *device, *stream_name;
pa_threaded_mainloop *mainloop;
-
+
pa_context *context;
pa_stream *stream;
-
+
pa_sample_spec sample_spec;
int operation_success;
diff --git a/src/pulsesrc.c b/src/pulsesrc.c
index a66acdc..faf6def 100644
--- a/src/pulsesrc.c
+++ b/src/pulsesrc.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
@@ -72,7 +72,7 @@ static GstStateChangeReturn gst_pulsesrc_change_state(GstElement *element, GstSt
static gboolean gst_pulsesrc_interface_supported(GstImplementsInterface* iface, GType interface_type) {
GstPulseSrc *this = GST_PULSESRC(iface);
-
+
if (interface_type == GST_TYPE_MIXER && this->mixer)
return TRUE;
@@ -94,7 +94,7 @@ static void gst_pulsesrc_init_interfaces(GType type) {
NULL,
NULL,
};
-
+
g_type_add_interface_static(type, GST_TYPE_IMPLEMENTS_INTERFACE, &implements_iface_info);
g_type_add_interface_static(type, GST_TYPE_MIXER, &mixer_iface_info);
}
@@ -113,7 +113,7 @@ static void gst_pulsesrc_base_init(gpointer g_class) {
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
-
+
"audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
@@ -136,7 +136,7 @@ static void gst_pulsesrc_base_init(gpointer g_class) {
"channels = (int) [ 1, 16 ]"
)
);
-
+
static const GstElementDetails details =
GST_ELEMENT_DETAILS(
"PulseAudio Audio Source",
@@ -145,7 +145,7 @@ static void gst_pulsesrc_base_init(gpointer g_class) {
"Lennart Poettering");
GstElementClass *element_class = GST_ELEMENT_CLASS(g_class);
-
+
gst_element_class_set_details(element_class, &details);
gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&pad_template));
}
@@ -153,7 +153,7 @@ static void gst_pulsesrc_base_init(gpointer g_class) {
static void gst_pulsesrc_class_init(
gpointer g_class,
gpointer class_data) {
-
+
GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
GstAudioSrcClass *gstaudiosrc_class = GST_AUDIO_SRC_CLASS(g_class);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS(g_class);
@@ -187,12 +187,12 @@ static void gst_pulsesrc_class_init(
static void gst_pulsesrc_init(
GTypeInstance * instance,
gpointer g_class) {
-
+
GstPulseSrc *pulsesrc = GST_PULSESRC(instance);
int e;
pulsesrc->server = pulsesrc->device = NULL;
-
+
pulsesrc->context = NULL;
pulsesrc->stream = NULL;
@@ -254,7 +254,7 @@ static void gst_pulsesrc_set_property(
guint prop_id,
const GValue * value,
GParamSpec * pspec) {
-
+
GstPulseSrc *pulsesrc = GST_PULSESRC(object);
switch (prop_id) {
@@ -279,7 +279,7 @@ static void gst_pulsesrc_get_property(
guint prop_id,
GValue * value,
GParamSpec * pspec) {
-
+
GstPulseSrc *pulsesrc = GST_PULSESRC(object);
switch(prop_id) {
@@ -350,7 +350,7 @@ static gboolean gst_pulsesrc_open(GstAudioSrc *asrc) {
}
pa_context_set_state_callback(pulsesrc->context, gst_pulsesrc_context_state_cb, pulsesrc);
-
+
if (pa_context_connect(pulsesrc->context, pulsesrc->server, 0, NULL) < 0) {
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL));
goto unlock_and_fail;
@@ -370,7 +370,7 @@ static gboolean gst_pulsesrc_open(GstAudioSrc *asrc) {
return TRUE;
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesrc->mainloop);
g_free(name);
@@ -388,7 +388,7 @@ static gboolean gst_pulsesrc_close(GstAudioSrc *asrc) {
}
static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec) {
pa_buffer_attr buf_attr;
-
+
GstPulseSrc *pulsesrc = GST_PULSESRC(asrc);
if (!gst_pulse_fill_sample_spec(spec, &pulsesrc->sample_spec)) {
@@ -402,7 +402,7 @@ static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec)
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Bad context state: %s", pulsesrc->context ? pa_strerror(pa_context_errno(pulsesrc->context)) : NULL), (NULL));
goto unlock_and_fail;
}
-
+
if (!(pulsesrc->stream = pa_stream_new(pulsesrc->context, "Record Stream", &pulsesrc->sample_spec, NULL))) {
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL));
goto unlock_and_fail;
@@ -414,7 +414,7 @@ static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec)
memset(&buf_attr, 0, sizeof(buf_attr));
buf_attr.maxlength = spec->segtotal*spec->segsize*2;
buf_attr.fragsize = spec->segsize;
-
+
if (pa_stream_connect_record(pulsesrc->stream, pulsesrc->device, &buf_attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_NOT_MONOTONOUS) < 0) {
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL));
goto unlock_and_fail;
@@ -432,11 +432,11 @@ static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec)
spec->bytes_per_sample = pa_frame_size(&pulsesrc->sample_spec);
memset(spec->silence_sample, 0, spec->bytes_per_sample);
-
+
return TRUE;
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesrc->mainloop);
return FALSE;
}
@@ -451,7 +451,7 @@ static gboolean gst_pulsesrc_unprepare(GstAudioSrc * asrc) {
pulsesrc->read_buffer = NULL;
pulsesrc->read_buffer_length = 0;
-
+
return TRUE;
}
@@ -472,54 +472,54 @@ static guint gst_pulsesrc_read(GstAudioSrc *asrc, gpointer data, guint length) {
while (length > 0) {
size_t l;
-
+
if (!pulsesrc->read_buffer) {
-
+
for (;;) {
if (pa_stream_peek(pulsesrc->stream, &pulsesrc->read_buffer, &pulsesrc->read_buffer_length) < 0) {
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("pa_stream_peek() failed: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL));
goto unlock_and_fail;
}
-
+
if (pulsesrc->read_buffer)
break;
-
+
pa_threaded_mainloop_wait(pulsesrc->mainloop);
-
+
CHECK_DEAD_GOTO(pulsesrc, unlock_and_fail);
}
}
g_assert(pulsesrc->read_buffer && pulsesrc->read_buffer_length);
-
+
l = pulsesrc->read_buffer_length > length ? length : pulsesrc->read_buffer_length;
-
+
memcpy(data, pulsesrc->read_buffer, l);
-
+
pulsesrc->read_buffer = (const guint8*) pulsesrc->read_buffer + l;
pulsesrc->read_buffer_length -= l;
data = (guint8*) data + l;
length -= l;
-
+
sum += l;
if (pulsesrc->read_buffer_length <= 0) {
-
+
if (pa_stream_drop(pulsesrc->stream) < 0) {
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("pa_stream_drop() failed: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL));
goto unlock_and_fail;
}
-
+
pulsesrc->read_buffer = NULL;
pulsesrc->read_buffer_length = 0;
}
}
-
+
pa_threaded_mainloop_unlock(pulsesrc->mainloop);
-
+
return sum;
-
+
unlock_and_fail:
pa_threaded_mainloop_unlock(pulsesrc->mainloop);
return 0;
@@ -547,48 +547,48 @@ static guint gst_pulsesrc_delay(GstAudioSrc *asrc) {
t = 0;
pa_threaded_mainloop_unlock(pulsesrc->mainloop);
-
+
return (guint) ((t * pulsesrc->sample_spec.rate) / 1000000LL);
unlock_and_fail:
-
+
pa_threaded_mainloop_unlock(pulsesrc->mainloop);
return 0;
}
static GstStateChangeReturn gst_pulsesrc_change_state(GstElement *element, GstStateChange transition) {
GstPulseSrc *this = GST_PULSESRC(element);
-
+
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!this->mixer)
this->mixer = gst_pulsemixer_ctrl_new(this->server, this->device, GST_PULSEMIXER_SOURCE);
-
+
break;
-
+
case GST_STATE_CHANGE_READY_TO_NULL:
if (this->mixer) {
gst_pulsemixer_ctrl_free(this->mixer);
this->mixer = NULL;
}
-
+
break;
-
+
default:
;
}
if (GST_ELEMENT_CLASS(parent_class)->change_state)
return GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
-
+
return GST_STATE_CHANGE_SUCCESS;
}
GType gst_pulsesrc_get_type(void) {
static GType pulsesrc_type = 0;
-
+
if (!pulsesrc_type) {
static const GTypeInfo pulsesrc_info = {
diff --git a/src/pulsesrc.h b/src/pulsesrc.h
index 85206f8..f552ce8 100644
--- a/src/pulsesrc.h
+++ b/src/pulsesrc.h
@@ -5,17 +5,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
@@ -52,10 +52,10 @@ struct _GstPulseSrc {
gchar *server, *device;
pa_threaded_mainloop *mainloop;
-
+
pa_context *context;
pa_stream *stream;
-
+
pa_sample_spec sample_spec;
const void *read_buffer;
diff --git a/src/pulseutil.h b/src/pulseutil.h
index 2df29bb..1cbcb60 100644
--- a/src/pulseutil.h
+++ b/src/pulseutil.h
@@ -5,17 +5,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