From 4290b897a297e311484f46b1cac2f6b5296a38fe Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 20 Jun 2006 19:22:36 +0000 Subject: s/polyp/pulse/ first part git-svn-id: file:///home/lennart/svn/public/gst-pulse/trunk@40 bb39ca4e-bce3-0310-b5d4-eea78a553289 --- Makefile.am | 16 +- bootstrap.sh | 8 +- configure.ac | 26 ++-- doc/Makefile.am | 8 +- doc/style.css | 8 +- src/Makefile.am | 36 ++--- src/plugin.c | 32 ++-- src/polypmixer.c | 98 ++++++------- src/polypmixer.h | 44 +++--- src/polypmixerctrl.c | 100 ++++++------- src/polypmixerctrl.h | 50 +++---- src/polypmixertrack.c | 32 ++-- src/polypmixertrack.h | 38 ++--- src/polypprobe.c | 64 ++++---- src/polypprobe.h | 40 ++--- src/polypsink.c | 400 +++++++++++++++++++++++++------------------------- src/polypsink.h | 40 ++--- src/polypsrc.c | 388 ++++++++++++++++++++++++------------------------ src/polypsrc.h | 42 +++--- src/polyputil.c | 14 +- src/polyputil.h | 18 +-- 21 files changed, 751 insertions(+), 751 deletions(-) diff --git a/Makefile.am b/Makefile.am index 29961d5..7278104 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,19 +1,19 @@ # $Id$ # -# This file is part of gst-polyp. +# This file is part of gst-pulse. # -# gst-polyp is free software; you can redistribute it and/or modify +# gst-pulse is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# gst-polyp is distributed in the hope that it will be useful, but +# 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with gst-polyp; if not, write to the Free Software +# along with gst-pulse; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. @@ -30,9 +30,9 @@ README: homepage: all dist test -d $$HOME/homepage/private - mkdir -p $$HOME/homepage/private/projects/gst-polyp - cp gst-polyp-@PACKAGE_VERSION@.tar.gz $$HOME/homepage/private/projects/gst-polyp - cp doc/README.html doc/style.css $$HOME/homepage/private/projects/gst-polyp - ln -sf README.html $$HOME/homepage/private/projects/gst-polyp/index.html + mkdir -p $$HOME/homepage/private/projects/gst-pulse + cp gst-pulse-@PACKAGE_VERSION@.tar.gz $$HOME/homepage/private/projects/gst-pulse + cp doc/README.html doc/style.css $$HOME/homepage/private/projects/gst-pulse + ln -sf README.html $$HOME/homepage/private/projects/gst-pulse/index.html .PHONY: homepage diff --git a/bootstrap.sh b/bootstrap.sh index 52ba247..eac9c0e 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,20 +1,20 @@ #!/bin/bash # $Id$ -# This file is part of gst-polyp. +# This file is part of gst-pulse. # -# gst-polyp is free software; you can redistribute it and/or modify it +# gst-pulse is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# gst-polyp is distributed in the hope that it will be useful, but +# 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with gst-polyp; if not, write to the Free Software Foundation, +# along with gst-pulse; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. VERSION=1.9 diff --git a/configure.ac b/configure.ac index e1728bc..473d290 100644 --- a/configure.ac +++ b/configure.ac @@ -3,29 +3,29 @@ # $Id$ -# This file is part of gst-polyp. +# This file is part of gst-pulse. # -# gst-polyp is free software; you can redistribute it and/or modify it +# gst-pulse is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# gst-polyp is distributed in the hope that it will be useful, but +# 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with gst-polyp; if not, write to the Free Software Foundation, +# along with gst-pulse; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. AC_PREREQ(2.57) -AC_INIT([gst-polyp],[0.9.0],[mzkzzfcbylc (at) 0pointer (dot) de]) +AC_INIT([gst-pulse],[0.9.2],[mztfgchyfr (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/plugin.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) -AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/gst-polyp/]) +AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/gst-pulse/]) if type -p stow > /dev/null && test -d /usr/local/stow ; then AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) @@ -45,16 +45,16 @@ AC_TYPE_SIZE_T PKG_PROG_PKG_CONFIG -if test -d ../polypaudio ; then - POLYP_CFLAGS='-I$(top_srcdir)/../polypaudio/src' - POLYP_LIBS='-L$(top_srcdir)/../polypaudio/src/.libs -lpolyp' - echo "*** Found polypaudio in ../polypaudio, using that version ***" +if test -d ../pulseaudio ; then + PULSE_CFLAGS='-I$(top_srcdir)/../pulseaudio/src' + PULSE_LIBS='-L$(top_srcdir)/../pulseaudio/src/.libs -lpulse' + echo "*** Found pulseaudio in ../pulseaudio, using that version ***" else - PKG_CHECK_MODULES(POLYP, [ polyplib >= 0.9.0 ]) + PKG_CHECK_MODULES(PULSE, [ libpulse >= 0.9.0 ]) fi -AC_SUBST(POLYP_LIBS) -AC_SUBST(POLYP_CFLAGS) +AC_SUBST(PULSE_LIBS) +AC_SUBST(PULSE_CFLAGS) PKG_CHECK_MODULES(GST, [ gstreamer-0.10 >= 0.10 gstreamer-plugins-base-0.10 >= 0.10 ]) diff --git a/doc/Makefile.am b/doc/Makefile.am index 86a684f..a4a9bc0 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,19 +1,19 @@ # $Id$ -# This file is part of gst-polyp. +# This file is part of gst-pulse. # -# gst-polyp is free software; you can redistribute it and/or modify it +# gst-pulse is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# gst-polyp is distributed in the hope that it will be useful, but +# 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with gst-polyp; if not, write to the Free Software Foundation, +# along with gst-pulse; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. noinst_DATA = README.html README diff --git a/doc/style.css b/doc/style.css index 9cac7b6..33598de 100644 --- a/doc/style.css +++ b/doc/style.css @@ -1,20 +1,20 @@ /* $Id$ */ /*** - * This file is part of gst-polyp. + * This file is part of gst-pulse. * - * gst-polyp is free software; you can redistribute it and/or modify it + * gst-pulse is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * gst-polyp is distributed in the hope that it will be useful, but + * 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 * General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with gst-polyp; if not, write to the Free Software Foundation, + * along with gst-pulse; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ diff --git a/src/Makefile.am b/src/Makefile.am index 24f0f20..659e20e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,42 +1,42 @@ # $Id$ # -# This file is part of gst-polyp. +# This file is part of gst-pulse. # -# gst-polyp is free software; you can redistribute it and/or modify +# gst-pulse is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# gst-polyp is distributed in the hope that it will be useful, but +# 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with gst-polyp; if not, write to the Free Software +# along with gst-pulse; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. modlibexecdir=$(GST_MODDIR) -modlibexec_LTLIBRARIES = libgstpolyp.la +modlibexec_LTLIBRARIES = libgstpulse.la -libgstpolyp_la_SOURCES = \ +libgstpulse_la_SOURCES = \ plugin.c \ - polypsink.c polypsink.h \ - polypsrc.c polypsrc.h \ - polyputil.c polyputil.h \ - polypmixer.c polypmixer.h \ - polypmixerctrl.c polypmixerctrl.h \ - polypmixertrack.c polypmixertrack.h \ - polypprobe.c polypprobe.h + pulsesink.c pulsesink.h \ + pulsesrc.c pulsesrc.h \ + pulseutil.c pulseutil.h \ + pulsemixer.c pulsemixer.h \ + pulsemixerctrl.c pulsemixerctrl.h \ + pulsemixertrack.c pulsemixertrack.h \ + pulseprobe.c pulseprobe.h -libgstpolyp_la_CFLAGS = $(GST_CFLAGS) $(POLYP_CFLAGS) -libgstpolyp_la_LIBADD = $(POLYP_LIBS) $(GST_LIBS) -lgstaudio-0.10 +libgstpulse_la_CFLAGS = $(GST_CFLAGS) $(PULSE_CFLAGS) +libgstpulse_la_LIBADD = $(PULSE_LIBS) $(GST_LIBS) -lgstaudio-0.10 inspect: - gst-inspect-0.10 polypsink - gst-inspect-0.10 polypsrc - gst-inspect-0.10 polypmixer + gst-inspect-0.10 pulsesink + gst-inspect-0.10 pulsesrc + gst-inspect-0.10 pulsemixer .PHONY: inspect diff --git a/src/plugin.c b/src/plugin.c index 980bab4..be52b32 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -23,35 +23,35 @@ #include "config.h" #endif -#include "polypsink.h" -#include "polypsrc.h" -#include "polypmixer.h" +#include "pulsesink.h" +#include "pulsesrc.h" +#include "pulsemixer.h" -GST_DEBUG_CATEGORY(polyp_debug); +GST_DEBUG_CATEGORY(pulse_debug); static gboolean plugin_init(GstPlugin* plugin) { - if (!gst_element_register(plugin, "polypsink", GST_RANK_SECONDARY-1, GST_TYPE_POLYPSINK)) + if (!gst_element_register(plugin, "pulsesink", GST_RANK_SECONDARY-1, GST_TYPE_PULSESINK)) return FALSE; - if (!gst_element_register(plugin, "polypsrc", GST_RANK_SECONDARY-1, GST_TYPE_POLYPSRC)) + if (!gst_element_register(plugin, "pulsesrc", GST_RANK_SECONDARY-1, GST_TYPE_PULSESRC)) return FALSE; - if (!gst_element_register(plugin, "polypmixer", GST_RANK_NONE, GST_TYPE_POLYPMIXER)) + if (!gst_element_register(plugin, "pulsemixer", GST_RANK_NONE, GST_TYPE_PULSEMIXER)) return FALSE; - GST_DEBUG_CATEGORY_INIT(polyp_debug, "polyp", 0, "Polypaudio elements"); + GST_DEBUG_CATEGORY_INIT(pulse_debug, "pulse", 0, "PulseAudio elements"); return TRUE; } GST_PLUGIN_DEFINE( GST_VERSION_MAJOR, GST_VERSION_MINOR, - "polypaudio", - "Polypaudio Elements Plugin", + "pulseaudio", + "PulseAudio Elements Plugin", plugin_init, "0.10."VERSION, "LGPL", - "polypaudio", - "http://0pointer.de/lennart/projects/gst-polyp/" + "pulseaudio", + "http://0pointer.de/lennart/projects/gst-pulse/" ) diff --git a/src/polypmixer.c b/src/polypmixer.c index 57fa162..3abba78 100644 --- a/src/polypmixer.c +++ b/src/polypmixer.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -26,7 +26,7 @@ #include #include -#include "polypmixer.h" +#include "pulsemixer.h" enum { PROP_SERVER = 1, @@ -34,22 +34,22 @@ enum { PROP_DEVICE_NAME }; -GST_DEBUG_CATEGORY_EXTERN(polyp_debug); -#define GST_CAT_DEFAULT polyp_debug +GST_DEBUG_CATEGORY_EXTERN(pulse_debug); +#define GST_CAT_DEFAULT pulse_debug -static void gst_polypmixer_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_polypmixer_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gst_polypmixer_finalize(GObject *object); -static GstStateChangeReturn gst_polypmixer_change_state(GstElement *element, GstStateChange transition); +static void gst_pulsemixer_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); +static void gst_pulsemixer_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_pulsemixer_finalize(GObject *object); +static GstStateChangeReturn gst_pulsemixer_change_state(GstElement *element, GstStateChange transition); -static void gst_polypmixer_init_interfaces(GType type); +static void gst_pulsemixer_init_interfaces(GType type); -GST_IMPLEMENT_POLYPMIXER_CTRL_METHODS(GstPolypMixer, gst_polypmixer) -GST_IMPLEMENT_POLYPPROBE_METHODS(GstPolypMixer, gst_polypmixer) -GST_BOILERPLATE_FULL(GstPolypMixer, gst_polypmixer, GstElement, GST_TYPE_ELEMENT, gst_polypmixer_init_interfaces) +GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS(GstPolypMixer, gst_pulsemixer) +GST_IMPLEMENT_PULSEPROBE_METHODS(GstPolypMixer, gst_pulsemixer) +GST_BOILERPLATE_FULL(GstPolypMixer, gst_pulsemixer, GstElement, GST_TYPE_ELEMENT, gst_pulsemixer_init_interfaces) -static gboolean gst_polypmixer_interface_supported(GstImplementsInterface* iface, GType interface_type) { - GstPolypMixer *this = GST_POLYPMIXER(iface); +static gboolean gst_pulsemixer_interface_supported(GstImplementsInterface* iface, GType interface_type) { + GstPolypMixer *this = GST_PULSEMIXER(iface); if (interface_type == GST_TYPE_MIXER && this->mixer) return TRUE; @@ -60,23 +60,23 @@ static gboolean gst_polypmixer_interface_supported(GstImplementsInterface* iface return FALSE; } -static void gst_polypmixer_implements_interface_init(GstImplementsInterfaceClass* klass) { - klass->supported = gst_polypmixer_interface_supported; +static void gst_pulsemixer_implements_interface_init(GstImplementsInterfaceClass* klass) { + klass->supported = gst_pulsemixer_interface_supported; } -static void gst_polypmixer_init_interfaces(GType type) { +static void gst_pulsemixer_init_interfaces(GType type) { static const GInterfaceInfo implements_iface_info = { - (GInterfaceInitFunc) gst_polypmixer_implements_interface_init, + (GInterfaceInitFunc) gst_pulsemixer_implements_interface_init, NULL, NULL, }; static const GInterfaceInfo mixer_iface_info = { - (GInterfaceInitFunc) gst_polypmixer_mixer_interface_init, + (GInterfaceInitFunc) gst_pulsemixer_mixer_interface_init, NULL, NULL, }; static const GInterfaceInfo probe_iface_info = { - (GInterfaceInitFunc) gst_polypmixer_property_probe_interface_init, + (GInterfaceInitFunc) gst_pulsemixer_property_probe_interface_init, NULL, NULL, }; @@ -86,37 +86,37 @@ static void gst_polypmixer_init_interfaces(GType type) { g_type_add_interface_static(type, GST_TYPE_PROPERTY_PROBE, &probe_iface_info); } -static void gst_polypmixer_base_init(gpointer g_class) { +static void gst_pulsemixer_base_init(gpointer g_class) { static const GstElementDetails details = GST_ELEMENT_DETAILS( - "Polypaudio Mixer", + "PulseAudio Mixer", "Generic/Audio", - "Control sound input and output levels for Polypaudio", + "Control sound input and output levels for PulseAudio", "Lennart Poettering"); gst_element_class_set_details(GST_ELEMENT_CLASS(g_class), &details); } -static void gst_polypmixer_class_init(GstPolypMixerClass *g_class) { +static void gst_pulsemixer_class_init(GstPolypMixerClass *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_polypmixer_change_state); + gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_pulsemixer_change_state); - gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_polypmixer_finalize); - gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_polypmixer_get_property); - gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_polypmixer_set_property); + 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); g_object_class_install_property( gobject_class, PROP_SERVER, - g_param_spec_string("server", "Server", "The Polypaudio server to connect to", NULL, G_PARAM_READWRITE)); + g_param_spec_string("server", "Server", "The PulseAudio server to connect to", NULL, G_PARAM_READWRITE)); g_object_class_install_property( gobject_class, PROP_DEVICE, - g_param_spec_string("device", "Sink/Source", "The Polypaudio sink or source to control", NULL, G_PARAM_READWRITE)); + g_param_spec_string("device", "Sink/Source", "The PulseAudio sink or source to control", NULL, G_PARAM_READWRITE)); g_object_class_install_property( gobject_class, @@ -124,40 +124,40 @@ static void gst_polypmixer_class_init(GstPolypMixerClass *g_class) { g_param_spec_string("device-name", "Device name", "Human-readable name of the sound device", NULL, G_PARAM_READABLE)); } -static void gst_polypmixer_init(GstPolypMixer *this, GstPolypMixerClass *g_class) { +static void gst_pulsemixer_init(GstPolypMixer *this, GstPolypMixerClass *g_class) { this->mixer = NULL; this->server = NULL; this->device = NULL; - this->probe = gst_polypprobe_new(G_OBJECT_GET_CLASS(this), PROP_DEVICE, this->device, TRUE, TRUE); + this->probe = gst_pulseprobe_new(G_OBJECT_GET_CLASS(this), PROP_DEVICE, this->device, TRUE, TRUE); } -static void gst_polypmixer_finalize(GObject *object) { - GstPolypMixer *this = GST_POLYPMIXER(object); +static void gst_pulsemixer_finalize(GObject *object) { + GstPolypMixer *this = GST_PULSEMIXER(object); g_free(this->server); g_free(this->device); if (this->mixer) { - gst_polypmixer_ctrl_free(this->mixer); + gst_pulsemixer_ctrl_free(this->mixer); this->mixer = NULL; } if (this->probe) { - gst_polypprobe_free(this->probe); + gst_pulseprobe_free(this->probe); this->probe = NULL; } G_OBJECT_CLASS(parent_class)->finalize(object); } -static void gst_polypmixer_set_property( +static void gst_pulsemixer_set_property( GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstPolypMixer *this = GST_POLYPMIXER(object); + GstPolypMixer *this = GST_PULSEMIXER(object); switch (prop_id) { case PROP_SERVER: @@ -170,7 +170,7 @@ static void gst_polypmixer_set_property( this->device = g_value_dup_string(value); if (this->probe) - gst_polypprobe_set_server(this->probe, this->device); + gst_pulseprobe_set_server(this->probe, this->device); break; @@ -180,13 +180,13 @@ static void gst_polypmixer_set_property( } } -static void gst_polypmixer_get_property( +static void gst_pulsemixer_get_property( GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstPolypMixer *this = GST_POLYPMIXER(object); + GstPolypMixer *this = GST_PULSEMIXER(object); switch(prop_id) { @@ -201,7 +201,7 @@ static void gst_polypmixer_get_property( case PROP_DEVICE_NAME: if (this->mixer) { - char *t = g_strdup_printf("%s - %s [%s]", this->mixer->type == GST_POLYPMIXER_SINK ? "Playback" : "Capture", this->mixer->description, this->mixer->name); + char *t = g_strdup_printf("%s - %s [%s]", this->mixer->type == GST_PULSEMIXER_SINK ? "Playback" : "Capture", this->mixer->description, this->mixer->name); g_value_set_string(value, t); g_free(t); } else @@ -215,21 +215,21 @@ static void gst_polypmixer_get_property( } } -static GstStateChangeReturn gst_polypmixer_change_state(GstElement *element, GstStateChange transition) { - GstPolypMixer *this = GST_POLYPMIXER(element); +static GstStateChangeReturn gst_pulsemixer_change_state(GstElement *element, GstStateChange transition) { + GstPolypMixer *this = GST_PULSEMIXER(element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: if (!this->mixer) - this->mixer = gst_polypmixer_ctrl_new(this->server, this->device, GST_POLYPMIXER_UNKNOWN); + 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_polypmixer_ctrl_free(this->mixer); + gst_pulsemixer_ctrl_free(this->mixer); this->mixer = NULL; } diff --git a/src/polypmixer.h b/src/polypmixer.h index 8fb951e..fd71d9e 100644 --- a/src/polypmixer.h +++ b/src/polypmixer.h @@ -1,47 +1,47 @@ -#ifndef __GST_POLYPMIXER_H__ -#define __GST_POLYPMIXER_H__ +#ifndef __GST_PULSEMIXER_H__ +#define __GST_PULSEMIXER_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ #include -#include -#include +#include +#include -#include "polypmixerctrl.h" -#include "polypprobe.h" +#include "pulsemixerctrl.h" +#include "pulseprobe.h" G_BEGIN_DECLS -#define GST_TYPE_POLYPMIXER \ - (gst_polypmixer_get_type()) -#define GST_POLYPMIXER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_POLYPMIXER,GstPolypMixer)) -#define GST_POLYPMIXER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_POLYPMIXER,GstPolypMixerClass)) -#define GST_IS_POLYPMIXER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_POLYPMIXER)) -#define GST_IS_POLYPMIXER_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_POLYPMIXER)) +#define GST_TYPE_PULSEMIXER \ + (gst_pulsemixer_get_type()) +#define GST_PULSEMIXER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSEMIXER,GstPolypMixer)) +#define GST_PULSEMIXER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSEMIXER,GstPolypMixerClass)) +#define GST_IS_PULSEMIXER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSEMIXER)) +#define GST_IS_PULSEMIXER_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSEMIXER)) typedef struct _GstPolypMixer GstPolypMixer; typedef struct _GstPolypMixerClass GstPolypMixerClass; @@ -59,8 +59,8 @@ struct _GstPolypMixerClass { GstElementClass parent_class; }; -GType gst_polypmixer_get_type(void); +GType gst_pulsemixer_get_type(void); G_END_DECLS -#endif /* __GST_POLYPMIXER_H__ */ +#endif /* __GST_PULSEMIXER_H__ */ diff --git a/src/polypmixerctrl.c b/src/polypmixerctrl.c index a219bd9..4786004 100644 --- a/src/polypmixerctrl.c +++ b/src/polypmixerctrl.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -25,15 +25,15 @@ #include -#include "polypmixerctrl.h" -#include "polypmixertrack.h" -#include "polyputil.h" +#include "pulsemixerctrl.h" +#include "pulsemixertrack.h" +#include "pulseutil.h" -GST_DEBUG_CATEGORY_EXTERN(polyp_debug); -#define GST_CAT_DEFAULT polyp_debug +GST_DEBUG_CATEGORY_EXTERN(pulse_debug); +#define GST_CAT_DEFAULT pulse_debug -static void gst_polypmixer_ctrl_context_state_cb(pa_context *context, void *userdata) { - GstPolypMixerCtrl *c = GST_POLYPMIXER_CTRL(userdata); +static void gst_pulsemixer_ctrl_context_state_cb(pa_context *context, void *userdata) { + GstPolypMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata); /* Called from the background thread! */ @@ -52,7 +52,7 @@ static void gst_polypmixer_ctrl_context_state_cb(pa_context *context, void *user } } -static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_info *i, int eol, void *userdata) { +static void gst_pulsemixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_info *i, int eol, void *userdata) { GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata; /* Called from the background thread! */ @@ -74,7 +74,7 @@ static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_ c->channel_map = i->channel_map; c->volume = i->volume; c->muted = i->mute; - c->type = GST_POLYPMIXER_SINK; + c->type = GST_PULSEMIXER_SINK; if (c->track) @@ -84,7 +84,7 @@ static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_ pa_threaded_mainloop_signal(c->mainloop, 0); } -static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) { +static void gst_pulsemixer_ctrl_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) { GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata; /* Called from the background thread! */ @@ -106,7 +106,7 @@ static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_sou c->channel_map = i->channel_map; c->volume = i->volume; c->muted = i->mute; - c->type = GST_POLYPMIXER_SOURCE; + c->type = GST_PULSEMIXER_SOURCE; if (c->track) c->track->flags = (c->track->flags & ~GST_MIXER_TRACK_MUTE) | (c->muted ? GST_MIXER_TRACK_MUTE : 0); @@ -115,8 +115,8 @@ static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_sou pa_threaded_mainloop_signal(c->mainloop, 0); } -static void gst_polypmixer_ctrl_subscribe_cb(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) { - GstPolypMixerCtrl *c = GST_POLYPMIXER_CTRL(userdata); +static void gst_pulsemixer_ctrl_subscribe_cb(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) { + GstPolypMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata); pa_operation *o = NULL; /* Called from the background thread! */ @@ -127,10 +127,10 @@ static void gst_polypmixer_ctrl_subscribe_cb(pa_context *context, pa_subscriptio if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_CHANGE) return; - if (c->type == GST_POLYPMIXER_SINK) - o = pa_context_get_sink_info_by_index(c->context, c->index, gst_polypmixer_ctrl_sink_info_cb, c); + if (c->type == GST_PULSEMIXER_SINK) + 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_polypmixer_ctrl_source_info_cb, c); + 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))); @@ -140,7 +140,7 @@ static void gst_polypmixer_ctrl_subscribe_cb(pa_context *context, pa_subscriptio pa_operation_unref(o); } -static void gst_polypmixer_ctrl_success_cb(pa_context *context, int success, void *userdata) { +static void gst_pulsemixer_ctrl_success_cb(pa_context *context, int success, void *userdata) { GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata; c->operation_success = success; @@ -154,9 +154,9 @@ if (!(c)->context || pa_context_get_state((c)->context) != PA_CONTEXT_READY) { \ } \ } while(0); -static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) { +static gboolean gst_pulsemixer_ctrl_open(GstPolypMixerCtrl *c) { int e; - gchar *name = gst_polyp_client_name(); + gchar *name = gst_pulse_client_name(); pa_operation *o = NULL; g_assert(c); @@ -174,8 +174,8 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) { goto unlock_and_fail; } - pa_context_set_state_callback(c->context, gst_polypmixer_ctrl_context_state_cb, c); - pa_context_set_subscribe_callback(c->context, gst_polypmixer_ctrl_subscribe_cb, 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))); @@ -192,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_MASK_SOURCE, gst_polypmixer_ctrl_success_cb, c))) { + 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; } @@ -210,8 +210,8 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) { /* Get sink info */ - if (c->type == GST_POLYPMIXER_UNKNOWN || c->type == GST_POLYPMIXER_SINK) { - if (!(o = pa_context_get_sink_info_by_name(c->context, c->device, gst_polypmixer_ctrl_sink_info_cb, c))) { + if (c->type == GST_PULSEMIXER_UNKNOWN || c->type == GST_PULSEMIXER_SINK) { + if (!(o = pa_context_get_sink_info_by_name(c->context, c->device, gst_pulsemixer_ctrl_sink_info_cb, c))) { GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; } @@ -225,14 +225,14 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) { pa_operation_unref(o); o = NULL; - if (!c->operation_success && (c->type == GST_POLYPMIXER_SINK || pa_context_errno(c->context) != PA_ERR_NOENTITY)) { + if (!c->operation_success && (c->type == GST_PULSEMIXER_SINK || pa_context_errno(c->context) != PA_ERR_NOENTITY)) { GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; } } - if (c->type == GST_POLYPMIXER_UNKNOWN || c->type == GST_POLYPMIXER_SOURCE) { - if (!(o = pa_context_get_source_info_by_name(c->context, c->device, gst_polypmixer_ctrl_source_info_cb, c))) { + if (c->type == GST_PULSEMIXER_UNKNOWN || c->type == GST_PULSEMIXER_SOURCE) { + if (!(o = pa_context_get_source_info_by_name(c->context, c->device, gst_pulsemixer_ctrl_source_info_cb, c))) { GST_WARNING("Failed to get source info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; } @@ -252,9 +252,9 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) { } } - g_assert(c->type != GST_POLYPMIXER_UNKNOWN); + g_assert(c->type != GST_PULSEMIXER_UNKNOWN); - c->track = gst_polypmixer_track_new(c); + c->track = gst_pulsemixer_track_new(c); c->tracklist = g_list_append(c->tracklist, c->track); pa_threaded_mainloop_unlock(c->mainloop); @@ -275,7 +275,7 @@ unlock_and_fail: return FALSE; } -static void gst_polypmixer_ctrl_close(GstPolypMixerCtrl *c) { +static void gst_pulsemixer_ctrl_close(GstPolypMixerCtrl *c) { g_assert(c); if (c->mainloop) @@ -299,13 +299,13 @@ static void gst_polypmixer_ctrl_close(GstPolypMixerCtrl *c) { } if (c->track) { - GST_POLYPMIXER_TRACK(c->track)->control = NULL; + GST_PULSEMIXER_TRACK(c->track)->control = NULL; g_object_unref(c->track); c->track = NULL; } } -GstPolypMixerCtrl* gst_polypmixer_ctrl_new(const gchar *server, const gchar *device, GstPolypMixerType type) { +GstPolypMixerCtrl* gst_pulsemixer_ctrl_new(const gchar *server, const gchar *device, GstPolypMixerType type) { GstPolypMixerCtrl *c = NULL; c = g_new(GstPolypMixerCtrl, 1); @@ -326,18 +326,18 @@ GstPolypMixerCtrl* gst_polypmixer_ctrl_new(const gchar *server, const gchar *dev c->time_event = NULL; - if (!(gst_polypmixer_ctrl_open(c))) { - gst_polypmixer_ctrl_free(c); + if (!(gst_pulsemixer_ctrl_open(c))) { + gst_pulsemixer_ctrl_free(c); return NULL; } return c; } -void gst_polypmixer_ctrl_free(GstPolypMixerCtrl *c) { +void gst_pulsemixer_ctrl_free(GstPolypMixerCtrl *c) { g_assert(c); - gst_polypmixer_ctrl_close(c); + gst_pulsemixer_ctrl_close(c); g_free(c->server); g_free(c->device); @@ -346,17 +346,17 @@ void gst_polypmixer_ctrl_free(GstPolypMixerCtrl *c) { g_free(c); } -const GList* gst_polypmixer_ctrl_list_tracks(GstPolypMixerCtrl *c) { +const GList* gst_pulsemixer_ctrl_list_tracks(GstPolypMixerCtrl *c) { g_assert(c); return c->tracklist; } -static void gst_polypmixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event *e, const struct timeval *tv, void *userdata) { +static void gst_pulsemixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event *e, const struct timeval *tv, void *userdata) { pa_operation *o; - GstPolypMixerCtrl *c = GST_POLYPMIXER_CTRL(userdata); + GstPolypMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata); - if (c->type == GST_POLYPMIXER_SINK) + if (c->type == GST_PULSEMIXER_SINK) 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); @@ -371,7 +371,7 @@ static void gst_polypmixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event c->time_event = NULL; } -void gst_polypmixer_ctrl_set_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) { +void gst_pulsemixer_ctrl_set_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) { pa_cvolume v; int i; @@ -393,13 +393,13 @@ void gst_polypmixer_ctrl_set_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, * to update the volume only once every 100ms */ struct timeval tv; pa_mainloop_api *api = pa_threaded_mainloop_get_api(c->mainloop); - c->time_event = api->time_new(api, pa_timeval_add(pa_gettimeofday(&tv), 100000), gst_polypmixer_ctrl_timeout_event, c); + c->time_event = api->time_new(api, pa_timeval_add(pa_gettimeofday(&tv), 100000), gst_pulsemixer_ctrl_timeout_event, c); } pa_threaded_mainloop_unlock(c->mainloop); } -void gst_polypmixer_ctrl_get_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) { +void gst_pulsemixer_ctrl_get_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) { int i; g_assert(c); @@ -413,12 +413,12 @@ void gst_polypmixer_ctrl_get_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, pa_threaded_mainloop_unlock(c->mainloop); } -void gst_polypmixer_ctrl_set_record(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean record) { +void gst_pulsemixer_ctrl_set_record(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean record) { g_assert(c); g_assert(track == c->track); } -void gst_polypmixer_ctrl_set_mute(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean mute) { +void gst_pulsemixer_ctrl_set_mute(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean mute) { pa_operation *o = NULL; g_assert(c); @@ -426,7 +426,7 @@ void gst_polypmixer_ctrl_set_mute(GstPolypMixerCtrl *c, GstMixerTrack *track, gb pa_threaded_mainloop_lock(c->mainloop); - if (c->type == GST_POLYPMIXER_SINK) + if (c->type == GST_PULSEMIXER_SINK) o = pa_context_set_sink_mute_by_index(c->context, c->index, !!mute, NULL, NULL); else o = pa_context_set_source_mute_by_index(c->context, c->index, !!mute, NULL, NULL); diff --git a/src/polypmixerctrl.h b/src/polypmixerctrl.h index 2f22c54..f901f56 100644 --- a/src/polypmixerctrl.h +++ b/src/polypmixerctrl.h @@ -1,23 +1,23 @@ -#ifndef __GST_POLYPMIXERCTRL_H__ -#define __GST_POLYPMIXERCTRL_H__ +#ifndef __GST_PULSEMIXERCTRL_H__ +#define __GST_PULSEMIXERCTRL_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -25,20 +25,20 @@ #include #include -#include -#include +#include +#include G_BEGIN_DECLS -#define GST_POLYPMIXER_CTRL(obj) ((GstPolypMixerCtrl*)(obj)) +#define GST_PULSEMIXER_CTRL(obj) ((GstPolypMixerCtrl*)(obj)) typedef struct _GstPolypMixerCtrl GstPolypMixerCtrl; typedef enum { - GST_POLYPMIXER_UNKNOWN, - GST_POLYPMIXER_SINK, - GST_POLYPMIXER_SOURCE } + GST_PULSEMIXER_UNKNOWN, + GST_PULSEMIXER_SINK, + GST_PULSEMIXER_SOURCE } GstPolypMixerType; struct _GstPolypMixerCtrl { @@ -62,16 +62,16 @@ struct _GstPolypMixerCtrl { pa_time_event *time_event; }; -GstPolypMixerCtrl* gst_polypmixer_ctrl_new(const gchar *server, const gchar *device, GstPolypMixerType type); -void gst_polypmixer_ctrl_free(GstPolypMixerCtrl*mixer); +GstPolypMixerCtrl* gst_pulsemixer_ctrl_new(const gchar *server, const gchar *device, GstPolypMixerType type); +void gst_pulsemixer_ctrl_free(GstPolypMixerCtrl*mixer); -const GList* gst_polypmixer_ctrl_list_tracks(GstPolypMixerCtrl *mixer); -void gst_polypmixer_ctrl_set_volume(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gint *volumes); -void gst_polypmixer_ctrl_get_volume(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gint *volumes); -void gst_polypmixer_ctrl_set_mute(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gboolean mute); -void gst_polypmixer_ctrl_set_record(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gboolean record); +const GList* gst_pulsemixer_ctrl_list_tracks(GstPolypMixerCtrl *mixer); +void gst_pulsemixer_ctrl_set_volume(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gint *volumes); +void gst_pulsemixer_ctrl_get_volume(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gint *volumes); +void gst_pulsemixer_ctrl_set_mute(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gboolean mute); +void gst_pulsemixer_ctrl_set_record(GstPolypMixerCtrl *mixer, GstMixerTrack *track, gboolean record); -#define GST_IMPLEMENT_POLYPMIXER_CTRL_METHODS(Type, interface_as_function) \ +#define GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS(Type, interface_as_function) \ static const GList* \ interface_as_function ## _list_tracks (GstMixer * mixer) \ { \ @@ -80,7 +80,7 @@ interface_as_function ## _list_tracks (GstMixer * mixer) g_return_val_if_fail (this != NULL, NULL); \ g_return_val_if_fail (this->mixer != NULL, NULL); \ \ - return gst_polypmixer_ctrl_list_tracks (this->mixer); \ + return gst_pulsemixer_ctrl_list_tracks (this->mixer); \ } \ static void \ interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, \ @@ -91,7 +91,7 @@ interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, g_return_if_fail (this != NULL); \ g_return_if_fail (this->mixer != NULL); \ \ - gst_polypmixer_ctrl_set_volume (this->mixer, track, volumes); \ + gst_pulsemixer_ctrl_set_volume (this->mixer, track, volumes); \ } \ static void \ interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \ @@ -102,7 +102,7 @@ interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, g_return_if_fail (this != NULL); \ g_return_if_fail (this->mixer != NULL); \ \ - gst_polypmixer_ctrl_get_volume (this->mixer, track, volumes); \ + gst_pulsemixer_ctrl_get_volume (this->mixer, track, volumes); \ } \ static void \ interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \ @@ -113,7 +113,7 @@ interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, g_return_if_fail (this != NULL); \ g_return_if_fail (this->mixer != NULL); \ \ - gst_polypmixer_ctrl_set_record (this->mixer, track, record); \ + gst_pulsemixer_ctrl_set_record (this->mixer, track, record); \ } \ static void \ interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \ @@ -124,7 +124,7 @@ interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, g_return_if_fail (this != NULL); \ g_return_if_fail (this->mixer != NULL); \ \ - gst_polypmixer_ctrl_set_mute (this->mixer, track, mute); \ + gst_pulsemixer_ctrl_set_mute (this->mixer, track, mute); \ } \ static void \ interface_as_function ## _mixer_interface_init (GstMixerClass * klass) \ diff --git a/src/polypmixertrack.c b/src/polypmixertrack.c index 75101bd..3e9b746 100644 --- a/src/polypmixertrack.c +++ b/src/polypmixertrack.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -25,32 +25,32 @@ #include -#include "polypmixertrack.h" +#include "pulsemixertrack.h" -GST_DEBUG_CATEGORY_EXTERN(polyp_debug); -#define GST_CAT_DEFAULT polyp_debug +GST_DEBUG_CATEGORY_EXTERN(pulse_debug); +#define GST_CAT_DEFAULT pulse_debug -G_DEFINE_TYPE(GstPolypMixerTrack, gst_polypmixer_track, GST_TYPE_MIXER_TRACK); +G_DEFINE_TYPE(GstPolypMixerTrack, gst_pulsemixer_track, GST_TYPE_MIXER_TRACK); -static void gst_polypmixer_track_class_init(GstPolypMixerTrackClass *klass) { +static void gst_pulsemixer_track_class_init(GstPolypMixerTrackClass *klass) { } -static void gst_polypmixer_track_init(GstPolypMixerTrack *track) { +static void gst_pulsemixer_track_init(GstPolypMixerTrack *track) { track->control = NULL; } -GstMixerTrack *gst_polypmixer_track_new(GstPolypMixerCtrl *control) { - GstPolypMixerTrack *polyptrack; +GstMixerTrack *gst_pulsemixer_track_new(GstPolypMixerCtrl *control) { + GstPolypMixerTrack *pulsetrack; GstMixerTrack *track; - polyptrack = g_object_new(GST_TYPE_POLYPMIXER_TRACK, NULL); - polyptrack->control = control; + pulsetrack = g_object_new(GST_TYPE_PULSEMIXER_TRACK, NULL); + pulsetrack->control = control; - track = GST_MIXER_TRACK(polyptrack); + track = GST_MIXER_TRACK(pulsetrack); track->label = g_strdup("Master"); track->num_channels = control->channel_map.channels; track->flags = - (control->type == GST_POLYPMIXER_SINK ? GST_MIXER_TRACK_OUTPUT|GST_MIXER_TRACK_MASTER : GST_MIXER_TRACK_INPUT|GST_MIXER_TRACK_RECORD) | + (control->type == GST_PULSEMIXER_SINK ? GST_MIXER_TRACK_OUTPUT|GST_MIXER_TRACK_MASTER : GST_MIXER_TRACK_INPUT|GST_MIXER_TRACK_RECORD) | (control->muted ? GST_MIXER_TRACK_MUTE : 0); track->min_volume = PA_VOLUME_MUTED; track->max_volume = PA_VOLUME_NORM; diff --git a/src/polypmixertrack.h b/src/polypmixertrack.h index b7cc901..68b1a50 100644 --- a/src/polypmixertrack.h +++ b/src/polypmixertrack.h @@ -1,43 +1,43 @@ -#ifndef __GST_POLYPMIXERTRACK_H__ -#define __GST_POLYPMIXERTRACK_H__ +#ifndef __GST_PULSEMIXERTRACK_H__ +#define __GST_PULSEMIXERTRACK_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ #include -#include "polypmixerctrl.h" +#include "pulsemixerctrl.h" G_BEGIN_DECLS -#define GST_TYPE_POLYPMIXER_TRACK \ - (gst_polypmixer_track_get_type()) -#define GST_POLYPMIXER_TRACK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_POLYPMIXER_TRACK, GstPolypMixerTrack)) -#define GST_POLYPMIXER_TRACK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_POLYPMIXER_TRACK, GstPolypMixerTrackClass)) -#define GST_IS_POLYPMIXER_TRACK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_POLYPMIXER_TRACK)) -#define GST_IS_POLYPMIXER_TRACK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_POLYPMIXER_TRACK)) +#define GST_TYPE_PULSEMIXER_TRACK \ + (gst_pulsemixer_track_get_type()) +#define GST_PULSEMIXER_TRACK(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PULSEMIXER_TRACK, GstPolypMixerTrack)) +#define GST_PULSEMIXER_TRACK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_PULSEMIXER_TRACK, GstPolypMixerTrackClass)) +#define GST_IS_PULSEMIXER_TRACK(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_PULSEMIXER_TRACK)) +#define GST_IS_PULSEMIXER_TRACK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_PULSEMIXER_TRACK)) typedef struct _GstPolypMixerTrack { GstMixerTrack parent; @@ -48,8 +48,8 @@ typedef struct _GstPolypMixerTrackClass { GstMixerTrackClass parent; } GstPolypMixerTrackClass; -GType gst_polypmixer_track_get_type(void); -GstMixerTrack* gst_polypmixer_track_new(GstPolypMixerCtrl *control); +GType gst_pulsemixer_track_get_type(void); +GstMixerTrack* gst_pulsemixer_track_new(GstPolypMixerCtrl *control); G_END_DECLS diff --git a/src/polypprobe.c b/src/polypprobe.c index cd057e0..adb5212 100644 --- a/src/polypprobe.c +++ b/src/polypprobe.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -23,13 +23,13 @@ #include "config.h" #endif -#include "polypprobe.h" -#include "polyputil.h" +#include "pulseprobe.h" +#include "pulseutil.h" -GST_DEBUG_CATEGORY_EXTERN(polyp_debug); -#define GST_CAT_DEFAULT polyp_debug +GST_DEBUG_CATEGORY_EXTERN(pulse_debug); +#define GST_CAT_DEFAULT pulse_debug -static void gst_polypprobe_context_state_cb(pa_context *context, void *userdata) { +static void gst_pulseprobe_context_state_cb(pa_context *context, void *userdata) { GstPolypProbe *c = (GstPolypProbe*) userdata; /* Called from the background thread! */ @@ -49,7 +49,7 @@ static void gst_polypprobe_context_state_cb(pa_context *context, void *userdata) } } -static void gst_polypprobe_sink_info_cb(pa_context *context, const pa_sink_info *i, int eol, void *userdata) { +static void gst_pulseprobe_sink_info_cb(pa_context *context, const pa_sink_info *i, int eol, void *userdata) { GstPolypProbe *c = (GstPolypProbe*) userdata; /* Called from the background thread! */ @@ -64,7 +64,7 @@ static void gst_polypprobe_sink_info_cb(pa_context *context, const pa_sink_info } -static void gst_polypprobe_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) { +static void gst_pulseprobe_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) { GstPolypProbe *c = (GstPolypProbe*) userdata; /* Called from the background thread! */ @@ -78,16 +78,16 @@ static void gst_polypprobe_source_info_cb(pa_context *context, const pa_source_i c->devices = g_list_append(c->devices, g_strdup(i->name)); } -static void gst_polypprobe_invalidate(GstPolypProbe *c) { +static void gst_pulseprobe_invalidate(GstPolypProbe *c) { g_list_foreach(c->devices, (GFunc) g_free, NULL); g_list_free(c->devices); c->devices = NULL; c->devices_valid = 0; } -static gboolean gst_polypprobe_open(GstPolypProbe *c) { +static gboolean gst_pulseprobe_open(GstPolypProbe *c) { int e; - gchar *name = gst_polyp_client_name(); + gchar *name = gst_pulse_client_name(); g_assert(c); @@ -104,7 +104,7 @@ static gboolean gst_polypprobe_open(GstPolypProbe *c) { goto unlock_and_fail; } - pa_context_set_state_callback(c->context, gst_polypprobe_context_state_cb, 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))); @@ -122,7 +122,7 @@ static gboolean gst_polypprobe_open(GstPolypProbe *c) { pa_threaded_mainloop_unlock(c->mainloop); g_free(name); - gst_polypprobe_invalidate(c); + gst_pulseprobe_invalidate(c); return TRUE; @@ -143,7 +143,7 @@ if (!(c)->context || pa_context_get_state((c)->context) != PA_CONTEXT_READY) { \ } \ } while(0); -static gboolean gst_polypprobe_enumerate(GstPolypProbe *c) { +static gboolean gst_pulseprobe_enumerate(GstPolypProbe *c) { pa_operation *o = NULL; pa_threaded_mainloop_lock(c->mainloop); @@ -151,7 +151,7 @@ static gboolean gst_polypprobe_enumerate(GstPolypProbe *c) { if (c->enumerate_sinks) { /* Get sink info */ - if (!(o = pa_context_get_sink_info_list(c->context, gst_polypprobe_sink_info_cb, c))) { + 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; } @@ -174,7 +174,7 @@ static gboolean gst_polypprobe_enumerate(GstPolypProbe *c) { if (c->enumerate_sources) { /* Get source info */ - if (!(o = pa_context_get_source_info_list(c->context, gst_polypprobe_source_info_cb, c))) { + if (!(o = pa_context_get_source_info_list(c->context, gst_pulseprobe_source_info_cb, c))) { GST_WARNING("Failed to get source info: %s", pa_strerror(pa_context_errno(c->context))); goto unlock_and_fail; } @@ -210,7 +210,7 @@ unlock_and_fail: return FALSE; } -static void gst_polypprobe_close(GstPolypProbe *c) { +static void gst_pulseprobe_close(GstPolypProbe *c) { g_assert(c); if (c->mainloop) @@ -228,7 +228,7 @@ static void gst_polypprobe_close(GstPolypProbe *c) { } } -GstPolypProbe* gst_polypprobe_new(GObjectClass *klass, guint prop_id, const gchar *server, gboolean sinks, gboolean sources) { +GstPolypProbe* gst_pulseprobe_new(GObjectClass *klass, guint prop_id, const gchar *server, gboolean sinks, gboolean sources) { GstPolypProbe *c = NULL; c = g_new(GstPolypProbe, 1); @@ -247,10 +247,10 @@ GstPolypProbe* gst_polypprobe_new(GObjectClass *klass, guint prop_id, const gcha return c; } -void gst_polypprobe_free(GstPolypProbe* c) { +void gst_pulseprobe_free(GstPolypProbe* c) { g_assert(c); - gst_polypprobe_close(c); + gst_pulseprobe_close(c); g_list_free(c->properties); g_free(c->server); @@ -261,11 +261,11 @@ void gst_polypprobe_free(GstPolypProbe* c) { g_free(c); } -const GList* gst_polypprobe_get_properties(GstPolypProbe *c) { +const GList* gst_pulseprobe_get_properties(GstPolypProbe *c) { return c->properties; } -gboolean gst_polypprobe_needs_probe(GstPolypProbe *c, guint prop_id, const GParamSpec *pspec) { +gboolean gst_pulseprobe_needs_probe(GstPolypProbe *c, guint prop_id, const GParamSpec *pspec) { if (prop_id == c->prop_id) return !c->devices_valid; @@ -274,20 +274,20 @@ gboolean gst_polypprobe_needs_probe(GstPolypProbe *c, guint prop_id, const GPara return FALSE; } -void gst_polypprobe_probe_property(GstPolypProbe *c, guint prop_id, const GParamSpec *pspec) { +void gst_pulseprobe_probe_property(GstPolypProbe *c, guint prop_id, const GParamSpec *pspec) { if (prop_id != c->prop_id) { G_OBJECT_WARN_INVALID_PROPERTY_ID(c, prop_id, pspec); return; } - if (gst_polypprobe_open(c)) { - gst_polypprobe_enumerate(c); - gst_polypprobe_close(c); + if (gst_pulseprobe_open(c)) { + gst_pulseprobe_enumerate(c); + gst_pulseprobe_close(c); } } -GValueArray *gst_polypprobe_get_values(GstPolypProbe *c, guint prop_id, const GParamSpec *pspec) { +GValueArray *gst_pulseprobe_get_values(GstPolypProbe *c, guint prop_id, const GParamSpec *pspec) { GValueArray *array; GValue value = { 0 }; GList *item; @@ -312,10 +312,10 @@ GValueArray *gst_polypprobe_get_values(GstPolypProbe *c, guint prop_id, const GP return array; } -void gst_polypprobe_set_server(GstPolypProbe *c, const gchar *server) { +void gst_pulseprobe_set_server(GstPolypProbe *c, const gchar *server) { g_assert(c); - gst_polypprobe_invalidate(c); + gst_pulseprobe_invalidate(c); g_free(c->server); c->server = g_strdup(server); diff --git a/src/polypprobe.h b/src/polypprobe.h index face7cb..ae936e9 100644 --- a/src/polypprobe.h +++ b/src/polypprobe.h @@ -1,23 +1,23 @@ -#ifndef __GST_POLYPPROBE_H__ -#define __GST_POLYPPROBE_H__ +#ifndef __GST_PULSEPROBE_H__ +#define __GST_PULSEPROBE_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -27,8 +27,8 @@ G_BEGIN_DECLS #include -#include -#include +#include +#include typedef struct _GstPolypProbe GstPolypProbe; @@ -47,17 +47,17 @@ struct _GstPolypProbe { int operation_success; }; -GstPolypProbe* gst_polypprobe_new(GObjectClass *klass, guint prop_id, const gchar *server, gboolean sinks, gboolean sources); -void gst_polypprobe_free(GstPolypProbe* probe); +GstPolypProbe* gst_pulseprobe_new(GObjectClass *klass, guint prop_id, const gchar *server, gboolean sinks, gboolean sources); +void gst_pulseprobe_free(GstPolypProbe* probe); -const GList* gst_polypprobe_get_properties(GstPolypProbe *probe); -gboolean gst_polypprobe_needs_probe(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); -void gst_polypprobe_probe_property(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); -GValueArray *gst_polypprobe_get_values(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); +const GList* gst_pulseprobe_get_properties(GstPolypProbe *probe); +gboolean gst_pulseprobe_needs_probe(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); +void gst_pulseprobe_probe_property(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); +GValueArray *gst_pulseprobe_get_values(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); -void gst_polypprobe_set_server(GstPolypProbe *c, const gchar *server); +void gst_pulseprobe_set_server(GstPolypProbe *c, const gchar *server); -#define GST_IMPLEMENT_POLYPPROBE_METHODS(Type, interface_as_function) \ +#define GST_IMPLEMENT_PULSEPROBE_METHODS(Type, interface_as_function) \ static const GList* \ interface_as_function ## _get_properties(GstPropertyProbe * probe) \ { \ @@ -66,7 +66,7 @@ interface_as_function ## _get_properties(GstPropertyProbe * probe) g_return_val_if_fail(this != NULL, NULL); \ g_return_val_if_fail(this->probe != NULL, NULL); \ \ - return gst_polypprobe_get_properties(this->probe); \ + return gst_pulseprobe_get_properties(this->probe); \ } \ static gboolean \ interface_as_function ## _needs_probe(GstPropertyProbe *probe, guint prop_id, \ @@ -77,7 +77,7 @@ interface_as_function ## _needs_probe(GstPropertyProbe *probe, guint prop_id, g_return_val_if_fail(this != NULL, FALSE); \ g_return_val_if_fail(this->probe != NULL, FALSE); \ \ - return gst_polypprobe_needs_probe(this->probe, prop_id, pspec); \ + return gst_pulseprobe_needs_probe(this->probe, prop_id, pspec); \ } \ static void \ interface_as_function ## _probe_property(GstPropertyProbe *probe, \ @@ -88,7 +88,7 @@ interface_as_function ## _probe_property(GstPropertyProbe *probe, g_return_if_fail(this != NULL); \ g_return_if_fail(this->probe != NULL); \ \ - gst_polypprobe_probe_property(this->probe, prop_id, pspec); \ + gst_pulseprobe_probe_property(this->probe, prop_id, pspec); \ } \ static GValueArray* \ interface_as_function ## _get_values(GstPropertyProbe *probe, guint prop_id, \ @@ -99,7 +99,7 @@ interface_as_function ## _get_values(GstPropertyProbe *probe, guint prop_id, g_return_val_if_fail(this != NULL, NULL); \ g_return_val_if_fail(this->probe != NULL, NULL); \ \ - return gst_polypprobe_get_values(this->probe, prop_id, pspec); \ + return gst_pulseprobe_get_values(this->probe, prop_id, pspec); \ } \ static void \ interface_as_function ## _property_probe_interface_init(GstPropertyProbeInterface *iface)\ diff --git a/src/polypsink.c b/src/polypsink.c index 8e8a0b2..a1f5990 100644 --- a/src/polypsink.c +++ b/src/polypsink.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -29,11 +29,11 @@ #include #include -#include "polypsink.h" -#include "polyputil.h" +#include "pulsesink.h" +#include "pulseutil.h" -GST_DEBUG_CATEGORY_EXTERN(polyp_debug); -#define GST_CAT_DEFAULT polyp_debug +GST_DEBUG_CATEGORY_EXTERN(pulse_debug); +#define GST_CAT_DEFAULT pulse_debug enum { PROP_SERVER = 1, @@ -42,25 +42,25 @@ enum { static GstAudioSinkClass *parent_class = NULL; -static void gst_polypsink_destroy_stream(GstPolypSink *polypsink); -static void gst_polypsink_destroy_context(GstPolypSink *polypsink); +static void gst_pulsesink_destroy_stream(GstPolypSink *pulsesink); +static void gst_pulsesink_destroy_context(GstPolypSink *pulsesink); -static void gst_polypsink_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_polypsink_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gst_polypsink_finalize(GObject *object); -static void gst_polypsink_dispose(GObject *object); +static void gst_pulsesink_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); +static void gst_pulsesink_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_pulsesink_finalize(GObject *object); +static void gst_pulsesink_dispose(GObject *object); -static gboolean gst_polypsink_open(GstAudioSink *asink); -static gboolean gst_polypsink_close(GstAudioSink *asink); +static gboolean gst_pulsesink_open(GstAudioSink *asink); +static gboolean gst_pulsesink_close(GstAudioSink *asink); -static gboolean gst_polypsink_prepare(GstAudioSink *asink, GstRingBufferSpec *spec); -static gboolean gst_polypsink_unprepare(GstAudioSink *asink); +static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *spec); +static gboolean gst_pulsesink_unprepare(GstAudioSink *asink); -static guint gst_polypsink_write(GstAudioSink *asink, gpointer data, guint length); -static guint gst_polypsink_delay(GstAudioSink *asink); -static void gst_polypsink_reset(GstAudioSink *asink); +static guint gst_pulsesink_write(GstAudioSink *asink, gpointer data, guint length); +static guint gst_pulsesink_delay(GstAudioSink *asink); +static void gst_pulsesink_reset(GstAudioSink *asink); -static gboolean gst_polypsink_event(GstBaseSink *sink, GstEvent *event); +static gboolean gst_pulsesink_event(GstBaseSink *sink, GstEvent *event); #if (G_BYTE_ORDER == G_LITTLE_ENDIAN) # define ENDIANNESS "LITTLE_ENDIAN, BIG_ENDIAN" @@ -68,7 +68,7 @@ static gboolean gst_polypsink_event(GstBaseSink *sink, GstEvent *event); # define ENDIANNESS "BIG_ENDIAN, LITTLE_ENDIAN" #endif -static void gst_polypsink_base_init(gpointer g_class) { +static void gst_pulsesink_base_init(gpointer g_class) { static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE( "sink", @@ -108,9 +108,9 @@ static void gst_polypsink_base_init(gpointer g_class) { static const GstElementDetails details = GST_ELEMENT_DETAILS( - "Polypaudio Audio Sink", + "PulseAudio Audio Sink", "Sink/Audio", - "Plays audio to a Polypaudio server", + "Plays audio to a PulseAudio server", "Lennart Poettering"); GstElementClass *element_class = GST_ELEMENT_CLASS(g_class); @@ -119,7 +119,7 @@ static void gst_polypsink_base_init(gpointer g_class) { gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&pad_template)); } -static void gst_polypsink_class_init( +static void gst_pulsesink_class_init( gpointer g_class, gpointer class_data) { @@ -128,109 +128,109 @@ static void gst_polypsink_class_init( 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_polypsink_dispose); - gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_polypsink_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_polypsink_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_polypsink_get_property); + 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_polypsink_event); + gstbasesink_class->event = GST_DEBUG_FUNCPTR(gst_pulsesink_event); - gstaudiosink_class->open = GST_DEBUG_FUNCPTR(gst_polypsink_open); - gstaudiosink_class->close = GST_DEBUG_FUNCPTR(gst_polypsink_close); - gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR(gst_polypsink_prepare); - gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR(gst_polypsink_unprepare); - gstaudiosink_class->write = GST_DEBUG_FUNCPTR(gst_polypsink_write); - gstaudiosink_class->delay = GST_DEBUG_FUNCPTR(gst_polypsink_delay); - gstaudiosink_class->reset = GST_DEBUG_FUNCPTR(gst_polypsink_reset); + 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); + gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR(gst_pulsesink_unprepare); + 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, PROP_SERVER, - g_param_spec_string("server", "Server", "The Polypaudio server to connect to", NULL, G_PARAM_READWRITE)); + g_param_spec_string("server", "Server", "The PulseAudio server to connect to", NULL, G_PARAM_READWRITE)); g_object_class_install_property( gobject_class, PROP_DEVICE, - g_param_spec_string("device", "Sink", "The Polypaudio sink device to connect to", NULL, G_PARAM_READWRITE)); + g_param_spec_string("device", "Sink", "The PulseAudio sink device to connect to", NULL, G_PARAM_READWRITE)); } -static void gst_polypsink_init( +static void gst_pulsesink_init( GTypeInstance * instance, gpointer g_class) { - GstPolypSink *polypsink = GST_POLYPSINK(instance); + GstPolypSink *pulsesink = GST_PULSESINK(instance); int e; - polypsink->server = polypsink->device = polypsink->stream_name = NULL; + pulsesink->server = pulsesink->device = pulsesink->stream_name = NULL; - polypsink->context = NULL; - polypsink->stream = NULL; + pulsesink->context = NULL; + pulsesink->stream = NULL; - polypsink->mainloop = pa_threaded_mainloop_new(); - g_assert(polypsink->mainloop); + pulsesink->mainloop = pa_threaded_mainloop_new(); + g_assert(pulsesink->mainloop); - e = pa_threaded_mainloop_start(polypsink->mainloop); + e = pa_threaded_mainloop_start(pulsesink->mainloop); g_assert(e == 0); } -static void gst_polypsink_destroy_stream(GstPolypSink* polypsink) { - if (polypsink->stream) { - pa_stream_disconnect(polypsink->stream); - pa_stream_unref(polypsink->stream); - polypsink->stream = NULL; +static void gst_pulsesink_destroy_stream(GstPolypSink* pulsesink) { + if (pulsesink->stream) { + pa_stream_disconnect(pulsesink->stream); + pa_stream_unref(pulsesink->stream); + pulsesink->stream = NULL; } - g_free(polypsink->stream_name); - polypsink->stream_name = NULL; + g_free(pulsesink->stream_name); + pulsesink->stream_name = NULL; } -static void gst_polypsink_destroy_context(GstPolypSink* polypsink) { +static void gst_pulsesink_destroy_context(GstPolypSink* pulsesink) { - gst_polypsink_destroy_stream(polypsink); + gst_pulsesink_destroy_stream(pulsesink); - if (polypsink->context) { - pa_context_disconnect(polypsink->context); - pa_context_unref(polypsink->context); - polypsink->context = NULL; + if (pulsesink->context) { + pa_context_disconnect(pulsesink->context); + pa_context_unref(pulsesink->context); + pulsesink->context = NULL; } } -static void gst_polypsink_finalize(GObject * object) { - GstPolypSink *polypsink = GST_POLYPSINK(object); +static void gst_pulsesink_finalize(GObject * object) { + GstPolypSink *pulsesink = GST_PULSESINK(object); - pa_threaded_mainloop_stop(polypsink->mainloop); + pa_threaded_mainloop_stop(pulsesink->mainloop); - gst_polypsink_destroy_context(polypsink); + gst_pulsesink_destroy_context(pulsesink); - g_free(polypsink->server); - g_free(polypsink->device); - g_free(polypsink->stream_name); + g_free(pulsesink->server); + g_free(pulsesink->device); + g_free(pulsesink->stream_name); - pa_threaded_mainloop_free(polypsink->mainloop); + pa_threaded_mainloop_free(pulsesink->mainloop); G_OBJECT_CLASS(parent_class)->finalize(object); } -static void gst_polypsink_dispose(GObject * object) { +static void gst_pulsesink_dispose(GObject * object) { G_OBJECT_CLASS(parent_class)->dispose(object); } -static void gst_polypsink_set_property( +static void gst_pulsesink_set_property( GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstPolypSink *polypsink = GST_POLYPSINK(object); + GstPolypSink *pulsesink = GST_PULSESINK(object); switch (prop_id) { case PROP_SERVER: - g_free(polypsink->server); - polypsink->server = g_value_dup_string(value); + g_free(pulsesink->server); + pulsesink->server = g_value_dup_string(value); break; case PROP_DEVICE: - g_free(polypsink->device); - polypsink->device = g_value_dup_string(value); + g_free(pulsesink->device); + pulsesink->device = g_value_dup_string(value); break; default: @@ -239,21 +239,21 @@ static void gst_polypsink_set_property( } } -static void gst_polypsink_get_property( +static void gst_pulsesink_get_property( GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstPolypSink *polypsink = GST_POLYPSINK(object); + GstPolypSink *pulsesink = GST_PULSESINK(object); switch(prop_id) { case PROP_SERVER: - g_value_set_string(value, polypsink->server); + g_value_set_string(value, pulsesink->server); break; case PROP_DEVICE: - g_value_set_string(value, polypsink->device); + g_value_set_string(value, pulsesink->device); break; default: @@ -262,14 +262,14 @@ static void gst_polypsink_get_property( } } -static void gst_polypsink_context_state_cb(pa_context *c, void *userdata) { - GstPolypSink *polypsink = GST_POLYPSINK(userdata); +static void gst_pulsesink_context_state_cb(pa_context *c, void *userdata) { + GstPolypSink *pulsesink = GST_PULSESINK(userdata); switch (pa_context_get_state(c)) { case PA_CONTEXT_READY: case PA_CONTEXT_TERMINATED: case PA_CONTEXT_FAILED: - pa_threaded_mainloop_signal(polypsink->mainloop, 0); + pa_threaded_mainloop_signal(pulsesink->mainloop, 0); break; case PA_CONTEXT_UNCONNECTED: @@ -280,15 +280,15 @@ static void gst_polypsink_context_state_cb(pa_context *c, void *userdata) { } } -static void gst_polypsink_stream_state_cb(pa_stream *s, void * userdata) { - GstPolypSink *polypsink = GST_POLYPSINK(userdata); +static void gst_pulsesink_stream_state_cb(pa_stream *s, void * userdata) { + GstPolypSink *pulsesink = GST_PULSESINK(userdata); switch (pa_stream_get_state(s)) { case PA_STREAM_READY: case PA_STREAM_FAILED: case PA_STREAM_TERMINATED: - pa_threaded_mainloop_signal(polypsink->mainloop, 0); + pa_threaded_mainloop_signal(pulsesink->mainloop, 0); break; case PA_STREAM_UNCONNECTED: @@ -297,167 +297,167 @@ static void gst_polypsink_stream_state_cb(pa_stream *s, void * userdata) { } } -static void gst_polypsink_stream_request_cb(pa_stream *s, size_t length, void *userdata) { - GstPolypSink *polypsink = GST_POLYPSINK(userdata); +static void gst_pulsesink_stream_request_cb(pa_stream *s, size_t length, void *userdata) { + GstPolypSink *pulsesink = GST_PULSESINK(userdata); - pa_threaded_mainloop_signal(polypsink->mainloop, 0); + pa_threaded_mainloop_signal(pulsesink->mainloop, 0); } -static void gst_polypsink_stream_latency_update_cb(pa_stream *s, void *userdata) { - GstPolypSink *polypsink = GST_POLYPSINK(userdata); +static void gst_pulsesink_stream_latency_update_cb(pa_stream *s, void *userdata) { + GstPolypSink *pulsesink = GST_PULSESINK(userdata); - pa_threaded_mainloop_signal(polypsink->mainloop, 0); + pa_threaded_mainloop_signal(pulsesink->mainloop, 0); } -static gboolean gst_polypsink_open(GstAudioSink *asink) { - GstPolypSink *polypsink = GST_POLYPSINK(asink); - gchar *name = gst_polyp_client_name(); +static gboolean gst_pulsesink_open(GstAudioSink *asink) { + GstPolypSink *pulsesink = GST_PULSESINK(asink); + gchar *name = gst_pulse_client_name(); - pa_threaded_mainloop_lock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); - if (!(polypsink->context = pa_context_new(pa_threaded_mainloop_get_api(polypsink->mainloop), name))) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Failed to create context"), (NULL)); + if (!(pulsesink->context = pa_context_new(pa_threaded_mainloop_get_api(pulsesink->mainloop), name))) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to create context"), (NULL)); goto unlock_and_fail; } - pa_context_set_state_callback(polypsink->context, gst_polypsink_context_state_cb, polypsink); + pa_context_set_state_callback(pulsesink->context, gst_pulsesink_context_state_cb, pulsesink); - if (pa_context_connect(polypsink->context, polypsink->server, 0, NULL) < 0) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + 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; } /* Wait until the context is ready */ - pa_threaded_mainloop_wait(polypsink->mainloop); + pa_threaded_mainloop_wait(pulsesink->mainloop); - if (pa_context_get_state(polypsink->context) != PA_CONTEXT_READY) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (pa_context_get_state(pulsesink->context) != PA_CONTEXT_READY) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); g_free(name); return TRUE; unlock_and_fail: - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); g_free(name); return FALSE; } -static gboolean gst_polypsink_close(GstAudioSink *asink) { - GstPolypSink *polypsink = GST_POLYPSINK(asink); +static gboolean gst_pulsesink_close(GstAudioSink *asink) { + GstPolypSink *pulsesink = GST_PULSESINK(asink); - pa_threaded_mainloop_lock(polypsink->mainloop); - gst_polypsink_destroy_context(polypsink); - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); + gst_pulsesink_destroy_context(pulsesink); + pa_threaded_mainloop_unlock(pulsesink->mainloop); return TRUE; } -static gboolean gst_polypsink_prepare(GstAudioSink *asink, GstRingBufferSpec *spec) { +static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *spec) { pa_buffer_attr buf_attr; - GstPolypSink *polypsink = GST_POLYPSINK(asink); + GstPolypSink *pulsesink = GST_PULSESINK(asink); - if (!gst_polyp_fill_sample_spec(spec, &polypsink->sample_spec)) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, SETTINGS, ("Invalid sample specification."), (NULL)); + if (!gst_pulse_fill_sample_spec(spec, &pulsesink->sample_spec)) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, SETTINGS, ("Invalid sample specification."), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_lock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); - if (!polypsink->context || pa_context_get_state(polypsink->context) != PA_CONTEXT_READY) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Bad context state: %s", polypsink->context ? pa_strerror(pa_context_errno(polypsink->context)) : NULL), (NULL)); + if (!pulsesink->context || pa_context_get_state(pulsesink->context) != PA_CONTEXT_READY) { + 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 (!(polypsink->stream = pa_stream_new(polypsink->context, polypsink->stream_name ? polypsink->stream_name : "Playback Stream", &polypsink->sample_spec, NULL))) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (!(pulsesink->stream = pa_stream_new(pulsesink->context, pulsesink->stream_name ? pulsesink->stream_name : "Playback Stream", &pulsesink->sample_spec, NULL))) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } - pa_stream_set_state_callback(polypsink->stream, gst_polypsink_stream_state_cb, polypsink); - pa_stream_set_write_callback(polypsink->stream, gst_polypsink_stream_request_cb, polypsink); - pa_stream_set_latency_update_callback(polypsink->stream, gst_polypsink_stream_latency_update_cb, polypsink); + pa_stream_set_state_callback(pulsesink->stream, gst_pulsesink_stream_state_cb, pulsesink); + pa_stream_set_write_callback(pulsesink->stream, gst_pulsesink_stream_request_cb, pulsesink); + pa_stream_set_latency_update_callback(pulsesink->stream, gst_pulsesink_stream_latency_update_cb, pulsesink); 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; - if (pa_stream_connect_playback(polypsink->stream, polypsink->device, &buf_attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_NOT_MONOTONOUS, NULL, NULL) < 0) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + 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; } /* Wait until the stream is ready */ - pa_threaded_mainloop_wait(polypsink->mainloop); + pa_threaded_mainloop_wait(pulsesink->mainloop); - if (pa_stream_get_state(polypsink->stream) != PA_STREAM_READY) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (pa_stream_get_state(pulsesink->stream) != PA_STREAM_READY) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); - spec->bytes_per_sample = pa_frame_size(&polypsink->sample_spec); + 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(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); return FALSE; } -static gboolean gst_polypsink_unprepare(GstAudioSink * asink) { - GstPolypSink *polypsink = GST_POLYPSINK(asink); +static gboolean gst_pulsesink_unprepare(GstAudioSink * asink) { + GstPolypSink *pulsesink = GST_PULSESINK(asink); - pa_threaded_mainloop_lock(polypsink->mainloop); - gst_polypsink_destroy_stream(polypsink); - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); + gst_pulsesink_destroy_stream(pulsesink); + pa_threaded_mainloop_unlock(pulsesink->mainloop); return TRUE; } -#define CHECK_DEAD_GOTO(polypsink, label) \ -if (!(polypsink)->context || pa_context_get_state((polypsink)->context) != PA_CONTEXT_READY || \ - !(polypsink)->stream || pa_stream_get_state((polypsink)->stream) != PA_STREAM_READY) { \ - GST_ELEMENT_ERROR((polypsink), RESOURCE, FAILED, ("Disconnected: %s", (polypsink)->context ? pa_strerror(pa_context_errno((polypsink)->context)) : NULL), (NULL)); \ +#define CHECK_DEAD_GOTO(pulsesink, label) \ +if (!(pulsesink)->context || pa_context_get_state((pulsesink)->context) != PA_CONTEXT_READY || \ + !(pulsesink)->stream || pa_stream_get_state((pulsesink)->stream) != PA_STREAM_READY) { \ + GST_ELEMENT_ERROR((pulsesink), RESOURCE, FAILED, ("Disconnected: %s", (pulsesink)->context ? pa_strerror(pa_context_errno((pulsesink)->context)) : NULL), (NULL)); \ goto label; \ } -static guint gst_polypsink_write(GstAudioSink *asink, gpointer data, guint length) { - GstPolypSink *polypsink = GST_POLYPSINK(asink); +static guint gst_pulsesink_write(GstAudioSink *asink, gpointer data, guint length) { + GstPolypSink *pulsesink = GST_PULSESINK(asink); size_t sum = 0; - pa_threaded_mainloop_lock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); while (length > 0) { size_t l; for (;;) { - CHECK_DEAD_GOTO(polypsink, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesink, unlock_and_fail); - if ((l = pa_stream_writable_size(polypsink->stream)) == (size_t) -1) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("pa_stream_writable_size() failed: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + 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; } if (l > 0) break; - pa_threaded_mainloop_wait(polypsink->mainloop); + pa_threaded_mainloop_wait(pulsesink->mainloop); } if (l > length) l = length; - if (pa_stream_write(polypsink->stream, data, l, NULL, 0, PA_SEEK_RELATIVE) < 0) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("pa_stream_write() failed: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + 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; } @@ -467,75 +467,75 @@ static guint gst_polypsink_write(GstAudioSink *asink, gpointer data, guint lengt sum += l; } - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); return sum; unlock_and_fail: - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); return 0; } -static guint gst_polypsink_delay(GstAudioSink *asink) { - GstPolypSink *polypsink = GST_POLYPSINK(asink); +static guint gst_pulsesink_delay(GstAudioSink *asink) { + GstPolypSink *pulsesink = GST_PULSESINK(asink); pa_usec_t t; - pa_threaded_mainloop_lock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); for (;;) { - CHECK_DEAD_GOTO(polypsink, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesink, unlock_and_fail); - if (pa_stream_get_latency(polypsink->stream, &t, NULL) >= 0) + if (pa_stream_get_latency(pulsesink->stream, &t, NULL) >= 0) break; - if (pa_context_errno(polypsink->context) != PA_ERR_NODATA) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("pa_stream_get_latency() failed: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (pa_context_errno(pulsesink->context) != PA_ERR_NODATA) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("pa_stream_get_latency() failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_wait(polypsink->mainloop); + pa_threaded_mainloop_wait(pulsesink->mainloop); } - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); - return gst_util_uint64_scale_int (t, polypsink->sample_spec.rate, 1000000LL); + return gst_util_uint64_scale_int (t, pulsesink->sample_spec.rate, 1000000LL); unlock_and_fail: - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); return 0; } -static void gst_polypsink_success_cb(pa_stream *s, int success, void *userdata) { - GstPolypSink *polypsink = GST_POLYPSINK(userdata); +static void gst_pulsesink_success_cb(pa_stream *s, int success, void *userdata) { + GstPolypSink *pulsesink = GST_PULSESINK(userdata); - polypsink->operation_success = success; - pa_threaded_mainloop_signal(polypsink->mainloop, 0); + pulsesink->operation_success = success; + pa_threaded_mainloop_signal(pulsesink->mainloop, 0); } -static void gst_polypsink_reset(GstAudioSink *asink) { - GstPolypSink *polypsink = GST_POLYPSINK(asink); +static void gst_pulsesink_reset(GstAudioSink *asink) { + GstPolypSink *pulsesink = GST_PULSESINK(asink); pa_operation *o = NULL; - pa_threaded_mainloop_lock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); - CHECK_DEAD_GOTO(polypsink, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesink, unlock_and_fail); - if (!(o = pa_stream_flush(polypsink->stream, gst_polypsink_success_cb, polypsink))) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (!(o = pa_stream_flush(pulsesink->stream, gst_pulsesink_success_cb, pulsesink))) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } - polypsink->operation_success = 0; + pulsesink->operation_success = 0; while (pa_operation_get_state(o) != PA_OPERATION_DONE) { - CHECK_DEAD_GOTO(polypsink, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesink, unlock_and_fail); - pa_threaded_mainloop_wait(polypsink->mainloop); + pa_threaded_mainloop_wait(pulsesink->mainloop); } - if (!polypsink->operation_success) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("Flush failed: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (!pulsesink->operation_success) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Flush failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } @@ -546,24 +546,24 @@ unlock_and_fail: pa_operation_unref(o); } - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); } -static void gst_polypsink_change_title(GstPolypSink *polypsink, const gchar *t) { +static void gst_pulsesink_change_title(GstPolypSink *pulsesink, const gchar *t) { pa_operation *o = NULL; - pa_threaded_mainloop_lock(polypsink->mainloop); + pa_threaded_mainloop_lock(pulsesink->mainloop); - g_free(polypsink->stream_name); - polypsink->stream_name = g_strdup(t); + g_free(pulsesink->stream_name); + pulsesink->stream_name = g_strdup(t); - if (!(polypsink)->context || pa_context_get_state((polypsink)->context) != PA_CONTEXT_READY || - !(polypsink)->stream || pa_stream_get_state((polypsink)->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; } - if (!(o = pa_stream_set_name(polypsink->stream, polypsink->stream_name, NULL, polypsink))) { - GST_ELEMENT_ERROR(polypsink, RESOURCE, FAILED, ("pa_stream_set_name() failed: %s", pa_strerror(pa_context_errno(polypsink->context))), (NULL)); + if (!(o = pa_stream_set_name(pulsesink->stream, pulsesink->stream_name, NULL, pulsesink))) { + GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("pa_stream_set_name() failed: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL)); goto unlock_and_fail; } @@ -574,11 +574,11 @@ unlock_and_fail: if (o) pa_operation_unref(o); - pa_threaded_mainloop_unlock(polypsink->mainloop); + pa_threaded_mainloop_unlock(pulsesink->mainloop); } -static gboolean gst_polypsink_event(GstBaseSink *sink, GstEvent *event) { - GstPolypSink *polypsink = GST_POLYPSINK(sink); +static gboolean gst_pulsesink_event(GstBaseSink *sink, GstEvent *event) { + GstPolypSink *pulsesink = GST_PULSESINK(sink); switch (GST_EVENT_TYPE(event)) { case GST_EVENT_TAG: { @@ -602,7 +602,7 @@ static gboolean gst_polypsink_event(GstBaseSink *sink, GstEvent *event) { t = location; if (t) - gst_polypsink_change_title(polypsink, t); + gst_pulsesink_change_title(pulsesink, t); g_free(title); g_free(artist); @@ -619,29 +619,29 @@ static gboolean gst_polypsink_event(GstBaseSink *sink, GstEvent *event) { return GST_BASE_SINK_CLASS(parent_class)->event(sink, event); } -GType gst_polypsink_get_type(void) { - static GType polypsink_type = 0; +GType gst_pulsesink_get_type(void) { + static GType pulsesink_type = 0; - if (!polypsink_type) { + if (!pulsesink_type) { - static const GTypeInfo polypsink_info = { + static const GTypeInfo pulsesink_info = { sizeof(GstPolypSinkClass), - gst_polypsink_base_init, + gst_pulsesink_base_init, NULL, - gst_polypsink_class_init, + gst_pulsesink_class_init, NULL, NULL, sizeof(GstPolypSink), 0, - gst_polypsink_init, + gst_pulsesink_init, }; - polypsink_type = g_type_register_static( + pulsesink_type = g_type_register_static( GST_TYPE_AUDIO_SINK, "GstPolypSink", - &polypsink_info, + &pulsesink_info, 0); } - return polypsink_type; + return pulsesink_type; } diff --git a/src/polypsink.h b/src/polypsink.h index e66169e..84153ad 100644 --- a/src/polypsink.h +++ b/src/polypsink.h @@ -1,23 +1,23 @@ -#ifndef __GST_POLYPSINK_H__ -#define __GST_POLYPSINK_H__ +#ifndef __GST_PULSESINK_H__ +#define __GST_PULSESINK_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -25,21 +25,21 @@ #include #include -#include -#include +#include +#include G_BEGIN_DECLS -#define GST_TYPE_POLYPSINK \ - (gst_polypsink_get_type()) -#define GST_POLYPSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_POLYPSINK,GstPolypSink)) -#define GST_POLYPSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_POLYPSINK,GstPolypSinkClass)) -#define GST_IS_POLYPSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_POLYPSINK)) -#define GST_IS_POLYPSINK_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_POLYPSINK)) +#define GST_TYPE_PULSESINK \ + (gst_pulsesink_get_type()) +#define GST_PULSESINK(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESINK,GstPolypSink)) +#define GST_PULSESINK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESINK,GstPolypSinkClass)) +#define GST_IS_PULSESINK(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESINK)) +#define GST_IS_PULSESINK_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESINK)) typedef struct _GstPolypSink GstPolypSink; typedef struct _GstPolypSinkClass GstPolypSinkClass; @@ -63,8 +63,8 @@ struct _GstPolypSinkClass { GstAudioSinkClass parent_class; }; -GType gst_polypsink_get_type(void); +GType gst_pulsesink_get_type(void); G_END_DECLS -#endif /* __GST_POLYPSINK_H__ */ +#endif /* __GST_PULSESINK_H__ */ diff --git a/src/polypsrc.c b/src/polypsrc.c index 306ffff..c830ca8 100644 --- a/src/polypsrc.c +++ b/src/polypsrc.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -29,12 +29,12 @@ #include #include -#include "polypsrc.h" -#include "polyputil.h" -#include "polypmixerctrl.h" +#include "pulsesrc.h" +#include "pulseutil.h" +#include "pulsemixerctrl.h" -GST_DEBUG_CATEGORY_EXTERN(polyp_debug); -#define GST_CAT_DEFAULT polyp_debug +GST_DEBUG_CATEGORY_EXTERN(pulse_debug); +#define GST_CAT_DEFAULT pulse_debug enum { PROP_SERVER = 1, @@ -43,26 +43,26 @@ enum { static GstAudioSrcClass *parent_class = NULL; -GST_IMPLEMENT_POLYPMIXER_CTRL_METHODS(GstPolypSrc, gst_polypsrc) +GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS(GstPolypSrc, gst_pulsesrc) -static void gst_polypsrc_destroy_stream(GstPolypSrc *polypsrc); -static void gst_polypsrc_destroy_context(GstPolypSrc *polypsrc); +static void gst_pulsesrc_destroy_stream(GstPolypSrc *pulsesrc); +static void gst_pulsesrc_destroy_context(GstPolypSrc *pulsesrc); -static void gst_polypsrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_polypsrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gst_polypsrc_finalize(GObject *object); -static void gst_polypsrc_dispose(GObject *object); +static void gst_pulsesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); +static void gst_pulsesrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_pulsesrc_finalize(GObject *object); +static void gst_pulsesrc_dispose(GObject *object); -static gboolean gst_polypsrc_open(GstAudioSrc *asrc); -static gboolean gst_polypsrc_close(GstAudioSrc *asrc); +static gboolean gst_pulsesrc_open(GstAudioSrc *asrc); +static gboolean gst_pulsesrc_close(GstAudioSrc *asrc); -static gboolean gst_polypsrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec); -static gboolean gst_polypsrc_unprepare(GstAudioSrc *asrc); +static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec); +static gboolean gst_pulsesrc_unprepare(GstAudioSrc *asrc); -static guint gst_polypsrc_read(GstAudioSrc *asrc, gpointer data, guint length); -static guint gst_polypsrc_delay(GstAudioSrc *asrc); +static guint gst_pulsesrc_read(GstAudioSrc *asrc, gpointer data, guint length); +static guint gst_pulsesrc_delay(GstAudioSrc *asrc); -static GstStateChangeReturn gst_polypsrc_change_state(GstElement *element, GstStateChange transition); +static GstStateChangeReturn gst_pulsesrc_change_state(GstElement *element, GstStateChange transition); #if (G_BYTE_ORDER == G_LITTLE_ENDIAN) # define ENDIANNESS "LITTLE_ENDIAN, BIG_ENDIAN" @@ -70,8 +70,8 @@ static GstStateChangeReturn gst_polypsrc_change_state(GstElement *element, GstSt # define ENDIANNESS "BIG_ENDIAN, LITTLE_ENDIAN" #endif -static gboolean gst_polypsrc_interface_supported(GstImplementsInterface* iface, GType interface_type) { - GstPolypSrc *this = GST_POLYPSRC(iface); +static gboolean gst_pulsesrc_interface_supported(GstImplementsInterface* iface, GType interface_type) { + GstPolypSrc *this = GST_PULSESRC(iface); if (interface_type == GST_TYPE_MIXER && this->mixer) return TRUE; @@ -79,18 +79,18 @@ static gboolean gst_polypsrc_interface_supported(GstImplementsInterface* iface, return FALSE; } -static void gst_polypsrc_implements_interface_init(GstImplementsInterfaceClass* klass) { - klass->supported = gst_polypsrc_interface_supported; +static void gst_pulsesrc_implements_interface_init(GstImplementsInterfaceClass* klass) { + klass->supported = gst_pulsesrc_interface_supported; } -static void gst_polypsrc_init_interfaces(GType type) { +static void gst_pulsesrc_init_interfaces(GType type) { static const GInterfaceInfo implements_iface_info = { - (GInterfaceInitFunc) gst_polypsrc_implements_interface_init, + (GInterfaceInitFunc) gst_pulsesrc_implements_interface_init, NULL, NULL, }; static const GInterfaceInfo mixer_iface_info = { - (GInterfaceInitFunc) gst_polypsrc_mixer_interface_init, + (GInterfaceInitFunc) gst_pulsesrc_mixer_interface_init, NULL, NULL, }; @@ -99,7 +99,7 @@ static void gst_polypsrc_init_interfaces(GType type) { g_type_add_interface_static(type, GST_TYPE_MIXER, &mixer_iface_info); } -static void gst_polypsrc_base_init(gpointer g_class) { +static void gst_pulsesrc_base_init(gpointer g_class) { static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE( "src", @@ -139,9 +139,9 @@ static void gst_polypsrc_base_init(gpointer g_class) { static const GstElementDetails details = GST_ELEMENT_DETAILS( - "Polypaudio Audio Source", + "PulseAudio Audio Source", "Source/Audio", - "Captures audio from a Polypaudio server", + "Captures audio from a PulseAudio server", "Lennart Poettering"); GstElementClass *element_class = GST_ELEMENT_CLASS(g_class); @@ -150,7 +150,7 @@ static void gst_polypsrc_base_init(gpointer g_class) { gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&pad_template)); } -static void gst_polypsrc_class_init( +static void gst_pulsesrc_class_init( gpointer g_class, gpointer class_data) { @@ -159,113 +159,113 @@ static void gst_polypsrc_class_init( GstElementClass *gstelement_class = GST_ELEMENT_CLASS(g_class); parent_class = g_type_class_peek_parent(g_class); - gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_polypsrc_change_state); + gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_pulsesrc_change_state); - gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_polypsrc_dispose); - gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_polypsrc_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_polypsrc_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_polypsrc_get_property); + gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_pulsesrc_dispose); + gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_pulsesrc_finalize); + gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_pulsesrc_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_pulsesrc_get_property); - gstaudiosrc_class->open = GST_DEBUG_FUNCPTR(gst_polypsrc_open); - gstaudiosrc_class->close = GST_DEBUG_FUNCPTR(gst_polypsrc_close); - gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR(gst_polypsrc_prepare); - gstaudiosrc_class->unprepare = GST_DEBUG_FUNCPTR(gst_polypsrc_unprepare); - gstaudiosrc_class->read = GST_DEBUG_FUNCPTR(gst_polypsrc_read); - gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR(gst_polypsrc_delay); + gstaudiosrc_class->open = GST_DEBUG_FUNCPTR(gst_pulsesrc_open); + gstaudiosrc_class->close = GST_DEBUG_FUNCPTR(gst_pulsesrc_close); + gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR(gst_pulsesrc_prepare); + gstaudiosrc_class->unprepare = GST_DEBUG_FUNCPTR(gst_pulsesrc_unprepare); + gstaudiosrc_class->read = GST_DEBUG_FUNCPTR(gst_pulsesrc_read); + gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR(gst_pulsesrc_delay); /* Overwrite GObject fields */ g_object_class_install_property( gobject_class, PROP_SERVER, - g_param_spec_string("server", "Server", "The Polypaudio server to connect to", NULL, G_PARAM_READWRITE)); + g_param_spec_string("server", "Server", "The PulseAudio server to connect to", NULL, G_PARAM_READWRITE)); g_object_class_install_property( gobject_class, PROP_DEVICE, - g_param_spec_string("device", "Source", "The Polypaudio source device to connect to", NULL, G_PARAM_READWRITE)); + g_param_spec_string("device", "Source", "The PulseAudio source device to connect to", NULL, G_PARAM_READWRITE)); } -static void gst_polypsrc_init( +static void gst_pulsesrc_init( GTypeInstance * instance, gpointer g_class) { - GstPolypSrc *polypsrc = GST_POLYPSRC(instance); + GstPolypSrc *pulsesrc = GST_PULSESRC(instance); int e; - polypsrc->server = polypsrc->device = NULL; + pulsesrc->server = pulsesrc->device = NULL; - polypsrc->context = NULL; - polypsrc->stream = NULL; + pulsesrc->context = NULL; + pulsesrc->stream = NULL; - polypsrc->read_buffer = NULL; - polypsrc->read_buffer_length = 0; + pulsesrc->read_buffer = NULL; + pulsesrc->read_buffer_length = 0; - polypsrc->mainloop = pa_threaded_mainloop_new(); - g_assert(polypsrc->mainloop); + pulsesrc->mainloop = pa_threaded_mainloop_new(); + g_assert(pulsesrc->mainloop); - e = pa_threaded_mainloop_start(polypsrc->mainloop); + e = pa_threaded_mainloop_start(pulsesrc->mainloop); g_assert(e == 0); - polypsrc->mixer = NULL; + pulsesrc->mixer = NULL; } -static void gst_polypsrc_destroy_stream(GstPolypSrc* polypsrc) { - if (polypsrc->stream) { - pa_stream_disconnect(polypsrc->stream); - pa_stream_unref(polypsrc->stream); - polypsrc->stream = NULL; +static void gst_pulsesrc_destroy_stream(GstPolypSrc* pulsesrc) { + if (pulsesrc->stream) { + pa_stream_disconnect(pulsesrc->stream); + pa_stream_unref(pulsesrc->stream); + pulsesrc->stream = NULL; } } -static void gst_polypsrc_destroy_context(GstPolypSrc* polypsrc) { +static void gst_pulsesrc_destroy_context(GstPolypSrc* pulsesrc) { - gst_polypsrc_destroy_stream(polypsrc); + gst_pulsesrc_destroy_stream(pulsesrc); - if (polypsrc->context) { - pa_context_disconnect(polypsrc->context); - pa_context_unref(polypsrc->context); - polypsrc->context = NULL; + if (pulsesrc->context) { + pa_context_disconnect(pulsesrc->context); + pa_context_unref(pulsesrc->context); + pulsesrc->context = NULL; } } -static void gst_polypsrc_finalize(GObject * object) { - GstPolypSrc *polypsrc = GST_POLYPSRC(object); +static void gst_pulsesrc_finalize(GObject * object) { + GstPolypSrc *pulsesrc = GST_PULSESRC(object); - pa_threaded_mainloop_stop(polypsrc->mainloop); + pa_threaded_mainloop_stop(pulsesrc->mainloop); - gst_polypsrc_destroy_context(polypsrc); + gst_pulsesrc_destroy_context(pulsesrc); - g_free(polypsrc->server); - g_free(polypsrc->device); + g_free(pulsesrc->server); + g_free(pulsesrc->device); - pa_threaded_mainloop_free(polypsrc->mainloop); + pa_threaded_mainloop_free(pulsesrc->mainloop); - if (polypsrc->mixer) - gst_polypmixer_ctrl_free(polypsrc->mixer); + if (pulsesrc->mixer) + gst_pulsemixer_ctrl_free(pulsesrc->mixer); G_OBJECT_CLASS(parent_class)->finalize(object); } -static void gst_polypsrc_dispose(GObject * object) { +static void gst_pulsesrc_dispose(GObject * object) { G_OBJECT_CLASS(parent_class)->dispose(object); } -static void gst_polypsrc_set_property( +static void gst_pulsesrc_set_property( GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstPolypSrc *polypsrc = GST_POLYPSRC(object); + GstPolypSrc *pulsesrc = GST_PULSESRC(object); switch (prop_id) { case PROP_SERVER: - g_free(polypsrc->server); - polypsrc->server = g_value_dup_string(value); + g_free(pulsesrc->server); + pulsesrc->server = g_value_dup_string(value); break; case PROP_DEVICE: - g_free(polypsrc->device); - polypsrc->device = g_value_dup_string(value); + g_free(pulsesrc->device); + pulsesrc->device = g_value_dup_string(value); break; default: @@ -274,21 +274,21 @@ static void gst_polypsrc_set_property( } } -static void gst_polypsrc_get_property( +static void gst_pulsesrc_get_property( GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstPolypSrc *polypsrc = GST_POLYPSRC(object); + GstPolypSrc *pulsesrc = GST_PULSESRC(object); switch(prop_id) { case PROP_SERVER: - g_value_set_string(value, polypsrc->server); + g_value_set_string(value, pulsesrc->server); break; case PROP_DEVICE: - g_value_set_string(value, polypsrc->device); + g_value_set_string(value, pulsesrc->device); break; default: @@ -297,14 +297,14 @@ static void gst_polypsrc_get_property( } } -static void gst_polypsrc_context_state_cb(pa_context *c, void *userdata) { - GstPolypSrc *polypsrc = GST_POLYPSRC(userdata); +static void gst_pulsesrc_context_state_cb(pa_context *c, void *userdata) { + GstPolypSrc *pulsesrc = GST_PULSESRC(userdata); switch (pa_context_get_state(c)) { case PA_CONTEXT_READY: case PA_CONTEXT_TERMINATED: case PA_CONTEXT_FAILED: - pa_threaded_mainloop_signal(polypsrc->mainloop, 0); + pa_threaded_mainloop_signal(pulsesrc->mainloop, 0); break; case PA_CONTEXT_UNCONNECTED: @@ -315,15 +315,15 @@ static void gst_polypsrc_context_state_cb(pa_context *c, void *userdata) { } } -static void gst_polypsrc_stream_state_cb(pa_stream *s, void * userdata) { - GstPolypSrc *polypsrc = GST_POLYPSRC(userdata); +static void gst_pulsesrc_stream_state_cb(pa_stream *s, void * userdata) { + GstPolypSrc *pulsesrc = GST_PULSESRC(userdata); switch (pa_stream_get_state(s)) { case PA_STREAM_READY: case PA_STREAM_FAILED: case PA_STREAM_TERMINATED: - pa_threaded_mainloop_signal(polypsrc->mainloop, 0); + pa_threaded_mainloop_signal(pulsesrc->mainloop, 0); break; case PA_STREAM_UNCONNECTED: @@ -332,212 +332,212 @@ static void gst_polypsrc_stream_state_cb(pa_stream *s, void * userdata) { } } -static void gst_polypsrc_stream_request_cb(pa_stream *s, size_t length, void *userdata) { - GstPolypSrc *polypsrc = GST_POLYPSRC(userdata); +static void gst_pulsesrc_stream_request_cb(pa_stream *s, size_t length, void *userdata) { + GstPolypSrc *pulsesrc = GST_PULSESRC(userdata); - pa_threaded_mainloop_signal(polypsrc->mainloop, 0); + pa_threaded_mainloop_signal(pulsesrc->mainloop, 0); } -static gboolean gst_polypsrc_open(GstAudioSrc *asrc) { - GstPolypSrc *polypsrc = GST_POLYPSRC(asrc); - gchar *name = gst_polyp_client_name(); +static gboolean gst_pulsesrc_open(GstAudioSrc *asrc) { + GstPolypSrc *pulsesrc = GST_PULSESRC(asrc); + gchar *name = gst_pulse_client_name(); - pa_threaded_mainloop_lock(polypsrc->mainloop); + pa_threaded_mainloop_lock(pulsesrc->mainloop); - if (!(polypsrc->context = pa_context_new(pa_threaded_mainloop_get_api(polypsrc->mainloop), name))) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Failed to create context"), (NULL)); + if (!(pulsesrc->context = pa_context_new(pa_threaded_mainloop_get_api(pulsesrc->mainloop), name))) { + GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to create context"), (NULL)); goto unlock_and_fail; } - pa_context_set_state_callback(polypsrc->context, gst_polypsrc_context_state_cb, polypsrc); + pa_context_set_state_callback(pulsesrc->context, gst_pulsesrc_context_state_cb, pulsesrc); - if (pa_context_connect(polypsrc->context, polypsrc->server, 0, NULL) < 0) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + 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; } /* Wait until the context is ready */ - pa_threaded_mainloop_wait(polypsrc->mainloop); + pa_threaded_mainloop_wait(pulsesrc->mainloop); - if (pa_context_get_state(polypsrc->context) != PA_CONTEXT_READY) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + if (pa_context_get_state(pulsesrc->context) != PA_CONTEXT_READY) { + GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to connect: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); g_free(name); return TRUE; unlock_and_fail: - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); g_free(name); return FALSE; } -static gboolean gst_polypsrc_close(GstAudioSrc *asrc) { - GstPolypSrc *polypsrc = GST_POLYPSRC(asrc); +static gboolean gst_pulsesrc_close(GstAudioSrc *asrc) { + GstPolypSrc *pulsesrc = GST_PULSESRC(asrc); - pa_threaded_mainloop_lock(polypsrc->mainloop); - gst_polypsrc_destroy_context(polypsrc); - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_lock(pulsesrc->mainloop); + gst_pulsesrc_destroy_context(pulsesrc); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); return TRUE; } -static gboolean gst_polypsrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec) { +static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec) { pa_buffer_attr buf_attr; - GstPolypSrc *polypsrc = GST_POLYPSRC(asrc); + GstPolypSrc *pulsesrc = GST_PULSESRC(asrc); - if (!gst_polyp_fill_sample_spec(spec, &polypsrc->sample_spec)) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, SETTINGS, ("Invalid sample specification."), (NULL)); + if (!gst_pulse_fill_sample_spec(spec, &pulsesrc->sample_spec)) { + GST_ELEMENT_ERROR(pulsesrc, RESOURCE, SETTINGS, ("Invalid sample specification."), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_lock(polypsrc->mainloop); + pa_threaded_mainloop_lock(pulsesrc->mainloop); - if (!polypsrc->context || pa_context_get_state(polypsrc->context) != PA_CONTEXT_READY) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Bad context state: %s", polypsrc->context ? pa_strerror(pa_context_errno(polypsrc->context)) : NULL), (NULL)); + if (!pulsesrc->context || pa_context_get_state(pulsesrc->context) != PA_CONTEXT_READY) { + 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 (!(polypsrc->stream = pa_stream_new(polypsrc->context, "Record Stream", &polypsrc->sample_spec, NULL))) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + 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; } - pa_stream_set_state_callback(polypsrc->stream, gst_polypsrc_stream_state_cb, polypsrc); - pa_stream_set_read_callback(polypsrc->stream, gst_polypsrc_stream_request_cb, polypsrc); + pa_stream_set_state_callback(pulsesrc->stream, gst_pulsesrc_stream_state_cb, pulsesrc); + pa_stream_set_read_callback(pulsesrc->stream, gst_pulsesrc_stream_request_cb, pulsesrc); 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(polypsrc->stream, polypsrc->device, &buf_attr, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_NOT_MONOTONOUS) < 0) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + 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; } /* Wait until the stream is ready */ - pa_threaded_mainloop_wait(polypsrc->mainloop); + pa_threaded_mainloop_wait(pulsesrc->mainloop); - if (pa_stream_get_state(polypsrc->stream) != PA_STREAM_READY) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + if (pa_stream_get_state(pulsesrc->stream) != PA_STREAM_READY) { + GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to connect stream: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL)); goto unlock_and_fail; } - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); - spec->bytes_per_sample = pa_frame_size(&polypsrc->sample_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(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); return FALSE; } -static gboolean gst_polypsrc_unprepare(GstAudioSrc * asrc) { - GstPolypSrc *polypsrc = GST_POLYPSRC(asrc); +static gboolean gst_pulsesrc_unprepare(GstAudioSrc * asrc) { + GstPolypSrc *pulsesrc = GST_PULSESRC(asrc); - pa_threaded_mainloop_lock(polypsrc->mainloop); - gst_polypsrc_destroy_stream(polypsrc); + pa_threaded_mainloop_lock(pulsesrc->mainloop); + gst_pulsesrc_destroy_stream(pulsesrc); - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); - polypsrc->read_buffer = NULL; - polypsrc->read_buffer_length = 0; + pulsesrc->read_buffer = NULL; + pulsesrc->read_buffer_length = 0; return TRUE; } -#define CHECK_DEAD_GOTO(polypsrc, label) \ -if (!(polypsrc)->context || pa_context_get_state((polypsrc)->context) != PA_CONTEXT_READY || \ - !(polypsrc)->stream || pa_stream_get_state((polypsrc)->stream) != PA_STREAM_READY) { \ - GST_ELEMENT_ERROR((polypsrc), RESOURCE, FAILED, ("Disconnected: %s", (polypsrc)->context ? pa_strerror(pa_context_errno((polypsrc)->context)) : NULL), (NULL)); \ +#define CHECK_DEAD_GOTO(pulsesrc, label) \ +if (!(pulsesrc)->context || pa_context_get_state((pulsesrc)->context) != PA_CONTEXT_READY || \ + !(pulsesrc)->stream || pa_stream_get_state((pulsesrc)->stream) != PA_STREAM_READY) { \ + GST_ELEMENT_ERROR((pulsesrc), RESOURCE, FAILED, ("Disconnected: %s", (pulsesrc)->context ? pa_strerror(pa_context_errno((pulsesrc)->context)) : NULL), (NULL)); \ goto label; \ } -static guint gst_polypsrc_read(GstAudioSrc *asrc, gpointer data, guint length) { - GstPolypSrc *polypsrc = GST_POLYPSRC(asrc); +static guint gst_pulsesrc_read(GstAudioSrc *asrc, gpointer data, guint length) { + GstPolypSrc *pulsesrc = GST_PULSESRC(asrc); size_t sum = 0; - pa_threaded_mainloop_lock(polypsrc->mainloop); + pa_threaded_mainloop_lock(pulsesrc->mainloop); - CHECK_DEAD_GOTO(polypsrc, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesrc, unlock_and_fail); while (length > 0) { size_t l; - if (!polypsrc->read_buffer) { + if (!pulsesrc->read_buffer) { for (;;) { - if (pa_stream_peek(polypsrc->stream, &polypsrc->read_buffer, &polypsrc->read_buffer_length) < 0) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("pa_stream_peek() failed: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + 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 (polypsrc->read_buffer) + if (pulsesrc->read_buffer) break; - pa_threaded_mainloop_wait(polypsrc->mainloop); + pa_threaded_mainloop_wait(pulsesrc->mainloop); - CHECK_DEAD_GOTO(polypsrc, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesrc, unlock_and_fail); } } - g_assert(polypsrc->read_buffer && polypsrc->read_buffer_length); + g_assert(pulsesrc->read_buffer && pulsesrc->read_buffer_length); - l = polypsrc->read_buffer_length > length ? length : polypsrc->read_buffer_length; + l = pulsesrc->read_buffer_length > length ? length : pulsesrc->read_buffer_length; - memcpy(data, polypsrc->read_buffer, l); + memcpy(data, pulsesrc->read_buffer, l); - polypsrc->read_buffer = (const guint8*) polypsrc->read_buffer + l; - polypsrc->read_buffer_length -= l; + pulsesrc->read_buffer = (const guint8*) pulsesrc->read_buffer + l; + pulsesrc->read_buffer_length -= l; data = (guint8*) data + l; length -= l; sum += l; - if (polypsrc->read_buffer_length <= 0) { + if (pulsesrc->read_buffer_length <= 0) { - if (pa_stream_drop(polypsrc->stream) < 0) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("pa_stream_drop() failed: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + 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; } - polypsrc->read_buffer = NULL; - polypsrc->read_buffer_length = 0; + pulsesrc->read_buffer = NULL; + pulsesrc->read_buffer_length = 0; } } - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); return sum; unlock_and_fail: - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); return 0; } -static guint gst_polypsrc_delay(GstAudioSrc *asrc) { - GstPolypSrc *polypsrc = GST_POLYPSRC(asrc); +static guint gst_pulsesrc_delay(GstAudioSrc *asrc) { + GstPolypSrc *pulsesrc = GST_PULSESRC(asrc); pa_usec_t t; int negative; - pa_threaded_mainloop_lock(polypsrc->mainloop); + pa_threaded_mainloop_lock(pulsesrc->mainloop); - CHECK_DEAD_GOTO(polypsrc, unlock_and_fail); + CHECK_DEAD_GOTO(pulsesrc, unlock_and_fail); - if (pa_stream_get_latency(polypsrc->stream, &t, &negative) < 0) { + if (pa_stream_get_latency(pulsesrc->stream, &t, &negative) < 0) { - if (pa_context_errno(polypsrc->context) != PA_ERR_NODATA) { - GST_ELEMENT_ERROR(polypsrc, RESOURCE, FAILED, ("pa_stream_get_latency() failed: %s", pa_strerror(pa_context_errno(polypsrc->context))), (NULL)); + if (pa_context_errno(pulsesrc->context) != PA_ERR_NODATA) { + GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("pa_stream_get_latency() failed: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL)); goto unlock_and_fail; } @@ -546,31 +546,31 @@ static guint gst_polypsrc_delay(GstAudioSrc *asrc) { } else if (negative) t = 0; - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); - return (guint) ((t * polypsrc->sample_spec.rate) / 1000000LL); + return (guint) ((t * pulsesrc->sample_spec.rate) / 1000000LL); unlock_and_fail: - pa_threaded_mainloop_unlock(polypsrc->mainloop); + pa_threaded_mainloop_unlock(pulsesrc->mainloop); return 0; } -static GstStateChangeReturn gst_polypsrc_change_state(GstElement *element, GstStateChange transition) { - GstPolypSrc *this = GST_POLYPSRC(element); +static GstStateChangeReturn gst_pulsesrc_change_state(GstElement *element, GstStateChange transition) { + GstPolypSrc *this = GST_PULSESRC(element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: if (!this->mixer) - this->mixer = gst_polypmixer_ctrl_new(this->server, this->device, GST_POLYPMIXER_SOURCE); + 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_polypmixer_ctrl_free(this->mixer); + gst_pulsemixer_ctrl_free(this->mixer); this->mixer = NULL; } @@ -586,31 +586,31 @@ static GstStateChangeReturn gst_polypsrc_change_state(GstElement *element, GstSt return GST_STATE_CHANGE_SUCCESS; } -GType gst_polypsrc_get_type(void) { - static GType polypsrc_type = 0; +GType gst_pulsesrc_get_type(void) { + static GType pulsesrc_type = 0; - if (!polypsrc_type) { + if (!pulsesrc_type) { - static const GTypeInfo polypsrc_info = { + static const GTypeInfo pulsesrc_info = { sizeof(GstPolypSrcClass), - gst_polypsrc_base_init, + gst_pulsesrc_base_init, NULL, - gst_polypsrc_class_init, + gst_pulsesrc_class_init, NULL, NULL, sizeof(GstPolypSrc), 0, - gst_polypsrc_init, + gst_pulsesrc_init, }; - polypsrc_type = g_type_register_static( + pulsesrc_type = g_type_register_static( GST_TYPE_AUDIO_SRC, "GstPolypSrc", - &polypsrc_info, + &pulsesrc_info, 0); - gst_polypsrc_init_interfaces(polypsrc_type); + gst_pulsesrc_init_interfaces(pulsesrc_type); } - return polypsrc_type; + return pulsesrc_type; } diff --git a/src/polypsrc.h b/src/polypsrc.h index d426c7d..c78072f 100644 --- a/src/polypsrc.h +++ b/src/polypsrc.h @@ -1,23 +1,23 @@ -#ifndef __GST_POLYPSRC_H__ -#define __GST_POLYPSRC_H__ +#ifndef __GST_PULSESRC_H__ +#define __GST_PULSESRC_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -25,23 +25,23 @@ #include #include -#include -#include +#include +#include -#include "polypmixerctrl.h" +#include "pulsemixerctrl.h" G_BEGIN_DECLS -#define GST_TYPE_POLYPSRC \ - (gst_polypsrc_get_type()) -#define GST_POLYPSRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_POLYPSRC,GstPolypSrc)) -#define GST_POLYPSRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_POLYPSRC,GstPolypSrcClass)) -#define GST_IS_POLYPSRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_POLYPSRC)) -#define GST_IS_POLYPSRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_POLYPSRC)) +#define GST_TYPE_PULSESRC \ + (gst_pulsesrc_get_type()) +#define GST_PULSESRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSESRC,GstPolypSrc)) +#define GST_PULSESRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSESRC,GstPolypSrcClass)) +#define GST_IS_PULSESRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSESRC)) +#define GST_IS_PULSESRC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESRC)) typedef struct _GstPolypSrc GstPolypSrc; typedef struct _GstPolypSrcClass GstPolypSrcClass; @@ -68,8 +68,8 @@ struct _GstPolypSrcClass { GstAudioSrcClass parent_class; }; -GType gst_polypsrc_get_type(void); +GType gst_pulsesrc_get_type(void); G_END_DECLS -#endif /* __GST_POLYPSRC_H__ */ +#endif /* __GST_PULSESRC_H__ */ diff --git a/src/polyputil.c b/src/polyputil.c index 5495fb6..ab0c852 100644 --- a/src/polyputil.c +++ b/src/polyputil.c @@ -1,20 +1,20 @@ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -23,9 +23,9 @@ #include "config.h" #endif -#include "polyputil.h" +#include "pulseutil.h" -gboolean gst_polyp_fill_sample_spec(GstRingBufferSpec *spec, pa_sample_spec *ss) { +gboolean gst_pulse_fill_sample_spec(GstRingBufferSpec *spec, pa_sample_spec *ss) { if (spec->format == GST_MU_LAW && spec->width == 8) ss->format = PA_SAMPLE_ULAW; @@ -53,7 +53,7 @@ gboolean gst_polyp_fill_sample_spec(GstRingBufferSpec *spec, pa_sample_spec *ss) return TRUE; } -gchar *gst_polyp_client_name(void) { +gchar *gst_pulse_client_name(void) { gchar buf[PATH_MAX]; if (pa_get_binary_name(buf, sizeof(buf))) diff --git a/src/polyputil.h b/src/polyputil.h index b800bb2..8cd6a5c 100644 --- a/src/polyputil.h +++ b/src/polyputil.h @@ -1,33 +1,33 @@ -#ifndef __GST_POLYPUTIL_H__ -#define __GST_POLYPUTIL_H__ +#ifndef __GST_PULSEUTIL_H__ +#define __GST_PULSEUTIL_H__ /* $Id$ */ /*** - This file is part of gst-polyp. + This file is part of gst-pulse. - gst-polyp is free software; you can redistribute it and/or modify + 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-polyp is distributed in the hope that it will be useful, but + 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-polyp; if not, write to the Free Software + License along with gst-pulse; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ #include -#include +#include #include -gboolean gst_polyp_fill_sample_spec(GstRingBufferSpec *spec, pa_sample_spec *ss); +gboolean gst_pulse_fill_sample_spec(GstRingBufferSpec *spec, pa_sample_spec *ss); -gchar *gst_polyp_client_name(void); +gchar *gst_pulse_client_name(void); #endif -- cgit