diff options
| -rw-r--r-- | audio/Makefile.am | 7 | ||||
| -rw-r--r-- | audio/gsta2dpsink.c | 68 | ||||
| -rw-r--r-- | audio/gsta2dpsink.h | 4 | ||||
| -rw-r--r-- | audio/gstbluetooth.c | 15 | ||||
| -rw-r--r-- | audio/gstsbcdec.c | 60 | ||||
| -rw-r--r-- | audio/gstsbcdec.h | 55 | ||||
| -rw-r--r-- | audio/gstsbcenc.c | 60 | ||||
| -rw-r--r-- | audio/gstsbcenc.h | 55 | 
8 files changed, 283 insertions, 41 deletions
diff --git a/audio/Makefile.am b/audio/Makefile.am index f5eb30e9..240c737f 100644 --- a/audio/Makefile.am +++ b/audio/Makefile.am @@ -37,9 +37,12 @@ endif  if GSTREAMER  gstreamerdir = $(libdir)/gstreamer-0.10 -noinst_LTLIBRARIES = libgstbluetooth.la +gstreamer_LTLIBRARIES = libgstbluetooth.la -libgstbluetooth_la_SOURCES = gstbluetooth.c gsta2dpsink.h gsta2dpsink.c ipc.h +libgstbluetooth_la_SOURCES = gstbluetooth.c ipc.h \ +				gstsbcdec.h gstsbcdec.c \ +				gstsbcenc.h gstsbcenc.c \ +				gsta2dpsink.h gsta2dpsink.c  libgstbluetooth_la_LDFLAGS = -module -avoid-version -export-dynamic  libgstbluetooth_la_LIBADD = @SBC_LIBS@ @GSTREAMER_LIBS@ -lgstaudio-0.10  libgstbluetooth_la_CFLAGS = @GSTREAMER_CFLAGS@ @SBC_CFLAGS@ diff --git a/audio/gsta2dpsink.c b/audio/gsta2dpsink.c index bb033a58..08832524 100644 --- a/audio/gsta2dpsink.c +++ b/audio/gsta2dpsink.c @@ -30,12 +30,12 @@  #include "gsta2dpsink.h" -GST_DEBUG_CATEGORY_EXTERN(bluetooth_debug); -#define GST_CAT_DEFAULT bluetooth_debug +GST_DEBUG_CATEGORY_STATIC(a2dp_sink_debug); +#define GST_CAT_DEFAULT a2dp_sink_debug -GST_BOILERPLATE(GstA2dpSink, gst_a2dpsink, GstAudioSink, GST_TYPE_AUDIO_SINK); +GST_BOILERPLATE(GstA2dpSink, gst_a2dp_sink, GstAudioSink, GST_TYPE_AUDIO_SINK); -static const GstElementDetails a2dpsink_details = +static const GstElementDetails a2dp_sink_details =  	GST_ELEMENT_DETAILS("Bluetooth A2DP sink",  				"Sink/Audio",  				"Plays audio to an A2DP device", @@ -45,7 +45,7 @@ static GstStaticPadTemplate sink_factory =  	GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS,  							GST_STATIC_CAPS("ANY")); -static void gst_a2dpsink_base_init(gpointer g_class) +static void gst_a2dp_sink_base_init(gpointer g_class)  {  	GstElementClass *element_class = GST_ELEMENT_CLASS(g_class); @@ -54,20 +54,20 @@ static void gst_a2dpsink_base_init(gpointer g_class)  	gst_element_class_add_pad_template(element_class,  			gst_static_pad_template_get(&sink_factory)); -	gst_element_class_set_details(element_class, &a2dpsink_details); +	gst_element_class_set_details(element_class, &a2dp_sink_details);  } -static void gst_a2dpsink_dispose(GObject *object) +static void gst_a2dp_sink_dispose(GObject *object)  {  	G_OBJECT_CLASS(parent_class)->dispose(object);  } -static void gst_a2dpsink_finalize(GObject *object) +static void gst_a2dp_sink_finalize(GObject *object)  {  	G_OBJECT_CLASS(parent_class)->finalize(object);  } -static void gst_a2dpsink_get_property(GObject *object, guint prop_id, +static void gst_a2dp_sink_get_property(GObject *object, guint prop_id,  					GValue *value, GParamSpec *pspec)  {  	switch (prop_id) { @@ -77,7 +77,7 @@ static void gst_a2dpsink_get_property(GObject *object, guint prop_id,  	}  } -static void gst_a2dpsink_set_property(GObject *object, guint prop_id, +static void gst_a2dp_sink_set_property(GObject *object, guint prop_id,  					const GValue *value, GParamSpec *pspec)  {  	switch (prop_id) { @@ -87,21 +87,21 @@ static void gst_a2dpsink_set_property(GObject *object, guint prop_id,  	}  } -static GstCaps *gst_a2dpsink_getcaps(GstBaseSink *basesink) +static GstCaps *gst_a2dp_sink_getcaps(GstBaseSink *basesink)  {  	GST_DEBUG_OBJECT(basesink, "");  	return NULL;  } -static gboolean gst_a2dpsink_open(GstAudioSink *audiosink) +static gboolean gst_a2dp_sink_open(GstAudioSink *audiosink)  {  	GST_DEBUG_OBJECT(audiosink, "");  	return TRUE;  } -static gboolean gst_a2dpsink_prepare(GstAudioSink *audiosink, +static gboolean gst_a2dp_sink_prepare(GstAudioSink *audiosink,  						GstRingBufferSpec *spec)  {  	GST_DEBUG_OBJECT(audiosink, "spec %p", spec); @@ -109,21 +109,21 @@ static gboolean gst_a2dpsink_prepare(GstAudioSink *audiosink,  	return TRUE;  } -static gboolean gst_a2dpsink_unprepare(GstAudioSink *audiosink) +static gboolean gst_a2dp_sink_unprepare(GstAudioSink *audiosink)  {  	GST_DEBUG_OBJECT(audiosink, "");  	return TRUE;  } -static gboolean gst_a2dpsink_close(GstAudioSink *audiosink) +static gboolean gst_a2dp_sink_close(GstAudioSink *audiosink)  {  	GST_DEBUG_OBJECT(audiosink, "");  	return TRUE;  } -static guint gst_a2dpsink_write(GstAudioSink *audiosink, +static guint gst_a2dp_sink_write(GstAudioSink *audiosink,  						gpointer data, guint length)  {  	GST_DEBUG_OBJECT(audiosink, "data %p length %d", data, length); @@ -131,18 +131,19 @@ static guint gst_a2dpsink_write(GstAudioSink *audiosink,  	return length;  } -static guint gst_a2dpsink_delay(GstAudioSink *audiosink) +static guint gst_a2dp_sink_delay(GstAudioSink *audiosink)  {  	GST_DEBUG_OBJECT(audiosink, "");  	return 0;  } -static void gst_a2dpsink_reset(GstAudioSink *audiosink) +static void gst_a2dp_sink_reset(GstAudioSink *audiosink)  { +	GST_DEBUG_OBJECT(audiosink, "");  } -static void gst_a2dpsink_class_init(GstA2dpSinkClass *klass) +static void gst_a2dp_sink_class_init(GstA2dpSinkClass *klass)  {  	GObjectClass *gobject_class = G_OBJECT_CLASS(klass);  	GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS(klass); @@ -152,23 +153,26 @@ static void gst_a2dpsink_class_init(GstA2dpSinkClass *klass)  	parent_class = g_type_class_peek_parent(klass); -	gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_a2dpsink_dispose); -	gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_a2dpsink_finalize); -	gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_a2dpsink_get_property); -	gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_a2dpsink_set_property); +	gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_a2dp_sink_dispose); +	gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_a2dp_sink_finalize); +	gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_a2dp_sink_get_property); +	gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_a2dp_sink_set_property); + +	gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR(gst_a2dp_sink_getcaps); -	gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR(gst_a2dpsink_getcaps); +	gstaudiosink_class->open = GST_DEBUG_FUNCPTR(gst_a2dp_sink_open); +	gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR(gst_a2dp_sink_prepare); +	gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR(gst_a2dp_sink_unprepare); +	gstaudiosink_class->close = GST_DEBUG_FUNCPTR(gst_a2dp_sink_close); +	gstaudiosink_class->write = GST_DEBUG_FUNCPTR(gst_a2dp_sink_write); +	gstaudiosink_class->delay = GST_DEBUG_FUNCPTR(gst_a2dp_sink_delay); +	gstaudiosink_class->reset = GST_DEBUG_FUNCPTR(gst_a2dp_sink_reset); -	gstaudiosink_class->open = GST_DEBUG_FUNCPTR(gst_a2dpsink_open); -	gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR(gst_a2dpsink_prepare); -	gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR(gst_a2dpsink_unprepare); -	gstaudiosink_class->close = GST_DEBUG_FUNCPTR(gst_a2dpsink_close); -	gstaudiosink_class->write = GST_DEBUG_FUNCPTR(gst_a2dpsink_write); -	gstaudiosink_class->delay = GST_DEBUG_FUNCPTR(gst_a2dpsink_delay); -	gstaudiosink_class->reset = GST_DEBUG_FUNCPTR(gst_a2dpsink_reset); +	GST_DEBUG_CATEGORY_INIT(a2dp_sink_debug, "a2dpsink", 0, +						"A2DP sink element");  } -static void gst_a2dpsink_init(GstA2dpSink *a2dpsink, GstA2dpSinkClass *klass) +static void gst_a2dp_sink_init(GstA2dpSink *a2dpsink, GstA2dpSinkClass *klass)  {  	GST_DEBUG_OBJECT(a2dpsink, "");  } diff --git a/audio/gsta2dpsink.h b/audio/gsta2dpsink.h index 9630c11a..9575bc44 100644 --- a/audio/gsta2dpsink.h +++ b/audio/gsta2dpsink.h @@ -27,7 +27,7 @@  G_BEGIN_DECLS  #define GST_TYPE_A2DP_SINK \ -	(gst_a2dpsink_get_type()) +	(gst_a2dp_sink_get_type())  #define GST_A2DP_SINK(obj) \  	(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_A2DP_SINK,GstA2dpSink))  #define GST_A2DP_SINK_CLASS(klass) \ @@ -48,6 +48,6 @@ struct _GstA2dpSinkClass {  	GstAudioSinkClass parent_class;  }; -GType gst_a2dpsink_get_type(void); +GType gst_a2dp_sink_get_type(void);  G_END_DECLS diff --git a/audio/gstbluetooth.c b/audio/gstbluetooth.c index 392de194..58655573 100644 --- a/audio/gstbluetooth.c +++ b/audio/gstbluetooth.c @@ -25,21 +25,26 @@  #include <config.h>  #endif +#include "gstsbcenc.h" +#include "gstsbcdec.h"  #include "gsta2dpsink.h" -GST_DEBUG_CATEGORY(bluetooth_debug); -  static gboolean plugin_init(GstPlugin *plugin)  {  	GST_INFO("Bluetooth plugin %s", VERSION); +	if (gst_element_register(plugin, "sbcenc", +			GST_RANK_NONE, GST_TYPE_SBC_ENC) == FALSE) +		return FALSE; + +	if (gst_element_register(plugin, "sbcdec", +			GST_RANK_PRIMARY, GST_TYPE_SBC_DEC) == FALSE) +		return FALSE; +  	if (gst_element_register(plugin, "a2dpsink",  			GST_RANK_PRIMARY, GST_TYPE_A2DP_SINK) == FALSE)  		return FALSE; -	GST_DEBUG_CATEGORY_INIT(bluetooth_debug, "bluetooth", 0, -							"Bluetooth plugin"); -  	return TRUE;  } diff --git a/audio/gstsbcdec.c b/audio/gstsbcdec.c new file mode 100644 index 00000000..9d547eda --- /dev/null +++ b/audio/gstsbcdec.c @@ -0,0 +1,60 @@ +/* + * + *  BlueZ - Bluetooth protocol stack for Linux + * + *  Copyright (C) 2004-2007  Marcel Holtmann <marcel@holtmann.org> + * + * + *  This library 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. + * + *  This library 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 this library; if not, write to the Free Software + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "sbc.h" + +#include "gstsbcdec.h" + +GST_DEBUG_CATEGORY_STATIC(sbc_dec_debug); +#define GST_CAT_DEFAULT sbc_dec_debug + +GST_BOILERPLATE(GstSbcDec, gst_sbc_dec, GstElement, GST_TYPE_ELEMENT); + +static const GstElementDetails sbc_dec_details = +	GST_ELEMENT_DETAILS("Bluetooth SBC decoder", +				"Codec/Decoder/Audio", +				"Decode a SBC audio stream", +				"Marcel Holtmann <marcel@holtmann.org>"); + +static void gst_sbc_dec_base_init(gpointer g_class) +{ +	GstElementClass *element_class = GST_ELEMENT_CLASS(g_class); + +	gst_element_class_set_details(element_class, &sbc_dec_details); +} + +static void gst_sbc_dec_class_init(GstSbcDecClass *klass) +{ +	parent_class = g_type_class_peek_parent(klass); + +	GST_DEBUG_CATEGORY_INIT(sbc_dec_debug, "sbcdec", 0, +						"SBC decoding element"); +} + +static void gst_sbc_dec_init(GstSbcDec *sbcdec, GstSbcDecClass *klass) +{ +} diff --git a/audio/gstsbcdec.h b/audio/gstsbcdec.h new file mode 100644 index 00000000..0737b9d9 --- /dev/null +++ b/audio/gstsbcdec.h @@ -0,0 +1,55 @@ +/* + * + *  BlueZ - Bluetooth protocol stack for Linux + * + *  Copyright (C) 2004-2007  Marcel Holtmann <marcel@holtmann.org> + * + * + *  This library 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. + * + *  This library 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 this library; if not, write to the Free Software + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + * + */ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_SBC_DEC \ +	(gst_sbc_dec_get_type()) +#define GST_SBC_DEC(obj) \ +	(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SBC_DEC,GstSbcDec)) +#define GST_SBC_DEC_CLASS(klass) \ +	(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SBC_DEC,GstSbcDecClass)) +#define GST_IS_SBC_DEC(obj) \ +	(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SBC_DEC)) +#define GST_IS_SBC_DEC_CLASS(obj) \ +	(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SBC_DEC)) + +typedef struct _GstSbcDec GstSbcDec; +typedef struct _GstSbcDecClass GstSbcDecClass; + +struct _GstSbcDec { +	GstElement element; + +	GstPad *sinkpad; +	GstPad *srcpad; +}; + +struct _GstSbcDecClass { +	GstElementClass parent_class; +}; + +GType gst_sbc_dec_get_type(void); + +G_END_DECLS diff --git a/audio/gstsbcenc.c b/audio/gstsbcenc.c new file mode 100644 index 00000000..6e63ac45 --- /dev/null +++ b/audio/gstsbcenc.c @@ -0,0 +1,60 @@ +/* + * + *  BlueZ - Bluetooth protocol stack for Linux + * + *  Copyright (C) 2004-2007  Marcel Holtmann <marcel@holtmann.org> + * + * + *  This library 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. + * + *  This library 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 this library; if not, write to the Free Software + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "sbc.h" + +#include "gstsbcenc.h" + +GST_DEBUG_CATEGORY_STATIC(sbc_enc_debug); +#define GST_CAT_DEFAULT sbc_enc_debug + +GST_BOILERPLATE(GstSbcEnc, gst_sbc_enc, GstElement, GST_TYPE_ELEMENT); + +static const GstElementDetails sbc_enc_details = +	GST_ELEMENT_DETAILS("Bluetooth SBC encoder", +				"Codec/Encoder/Audio", +				"Encode a SBC audio stream", +				"Marcel Holtmann <marcel@holtmann.org>"); + +static void gst_sbc_enc_base_init(gpointer g_class) +{ +	GstElementClass *element_class = GST_ELEMENT_CLASS(g_class); + +	gst_element_class_set_details(element_class, &sbc_enc_details); +} + +static void gst_sbc_enc_class_init(GstSbcEncClass *klass) +{ +	parent_class = g_type_class_peek_parent(klass); + +	GST_DEBUG_CATEGORY_INIT(sbc_enc_debug, "sbcenc", 0, +						"SBC encoding element"); +} + +static void gst_sbc_enc_init(GstSbcEnc *sbcenc, GstSbcEncClass *klass) +{ +} diff --git a/audio/gstsbcenc.h b/audio/gstsbcenc.h new file mode 100644 index 00000000..64457d21 --- /dev/null +++ b/audio/gstsbcenc.h @@ -0,0 +1,55 @@ +/* + * + *  BlueZ - Bluetooth protocol stack for Linux + * + *  Copyright (C) 2004-2007  Marcel Holtmann <marcel@holtmann.org> + * + * + *  This library 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. + * + *  This library 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 this library; if not, write to the Free Software + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA + * + */ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_SBC_ENC \ +	(gst_sbc_enc_get_type()) +#define GST_SBC_ENC(obj) \ +	(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SBC_ENC,GstSbcEnc)) +#define GST_SBC_ENC_CLASS(klass) \ +	(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SBC_ENC,GstSbcEncClass)) +#define GST_IS_SBC_ENC(obj) \ +	(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SBC_ENC)) +#define GST_IS_SBC_ENC_CLASS(obj) \ +	(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SBC_ENC)) + +typedef struct _GstSbcEnc GstSbcEnc; +typedef struct _GstSbcEncClass GstSbcEncClass; + +struct _GstSbcEnc { +	GstElement element; + +	GstPad *sinkpad; +	GstPad *srcpad; +}; + +struct _GstSbcEncClass { +	GstElementClass parent_class; +}; + +GType gst_sbc_enc_get_type(void); + +G_END_DECLS  | 
