bluez: Remove a2dpsrc bin

This element isn't really useful. The original plan was to use this to
eventually allow dynamically picking a format based on what we can
support while negotiating with the source device. We can just plug in a
decodebin downstream and it'll handle RTP depayloading and decoding of
whatever format we negotiated with the source device.
This commit is contained in:
Arun Raghavan 2013-03-28 17:36:07 +00:00
parent a3713f7be1
commit 6adddc7c51
4 changed files with 0 additions and 256 deletions

View file

@ -4,7 +4,6 @@ libgstbluez_la_SOURCES = \
bluez-plugin.c \
gsta2dpsink.c \
gstavdtpsink.c \
gsta2dpsrc.c \
gstavdtpsrc.c \
gstavdtputil.c
@ -27,6 +26,5 @@ noinst_HEADERS = \
a2dp-codecs.h \
gsta2dpsink.h \
gstavdtpsink.h \
gsta2dpsrc.h \
gstavdtpsrc.h \
gstavdtputil.h

View file

@ -24,7 +24,6 @@
#include "gsta2dpsink.h"
#include "gstavdtpsink.h"
#include "gsta2dpsrc.h"
#include "gstavdtpsrc.h"
#include <string.h>
@ -36,8 +35,6 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin, "avdtpsink",
GST_RANK_NONE, GST_TYPE_AVDTP_SINK);
gst_element_register (plugin, "a2dpsrc", GST_RANK_NONE, GST_TYPE_A2DP_SRC);
gst_element_register (plugin, "avdtpsrc", GST_RANK_NONE, GST_TYPE_AVDTP_SRC);
return TRUE;

View file

@ -1,190 +0,0 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Collabora Ltd.
*
*
* 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 "gsta2dpsrc.h"
#include "gstavdtputil.h"
GST_DEBUG_CATEGORY (a2dpsrc_debug);
#define GST_CAT_DEFAULT (a2dpsrc_debug)
enum
{
PROP_0,
PROP_TRANSPORT
};
#define parent_class gst_a2dp_src_parent_class
G_DEFINE_TYPE (GstA2dpSrc, gst_a2dp_src, GST_TYPE_BIN);
static void gst_a2dp_src_finalize (GObject * object);
static void gst_a2dp_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_a2dp_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static GstStaticPadTemplate gst_a2dp_src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-sbc, "
"rate = (int) { 16000, 32000, 44100, 48000 }, "
"channels = (int) [ 1, 2 ], "
"mode = (string) { \"mono\", \"dual\", "
"\"stereo\", \"joint\" }, "
"blocks = (int) { 4, 8, 12, 16 }, "
"subbands = (int) { 4, 8 }, "
"allocation = (string) { \"snr\", \"loudness\" }, "
"bitpool = (int) [ 2, " TEMPLATE_MAX_BITPOOL_STR " ]"));
static void
gst_a2dp_src_class_init (GstA2dpSrcClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_a2dp_src_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_a2dp_src_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_a2dp_src_get_property);
g_object_class_install_property (gobject_class, PROP_TRANSPORT,
g_param_spec_string ("transport",
"Transport", "Use configured transport", NULL, G_PARAM_READWRITE));
gst_element_class_set_static_metadata (element_class,
"Bluetooth A2DP Source",
"Source/Audio/Network",
"Receives and depayloads audio from an A2DP device",
"Arun Raghavan <arun.raghavan@collabora.co.uk>");
GST_DEBUG_CATEGORY_INIT (a2dpsrc_debug, "a2dpsrc", 0,
"Bluetooth A2DP Source");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_a2dp_src_template));
}
static void
gst_a2dp_src_init (GstA2dpSrc * a2dpsrc)
{
GstBin *bin = GST_BIN (a2dpsrc);
GstElement *depay = NULL;
GstPad *srcpad = NULL, *depay_srcpad;
/* FIXME: We can set up the bin elements here since we only support
* SBC. When supporting more formats, we would need to only instantiate
* an avdtpsrc here, wait for it to get to READY, query its srcpad caps
* and attach the appropriate RTP depayloader. */
a2dpsrc->avdtpsrc = gst_element_factory_make ("avdtpsrc", NULL);
if (!a2dpsrc->avdtpsrc) {
GST_ERROR_OBJECT (a2dpsrc, "Unable to instantiate avdtpsrc");
goto fail;
}
depay = gst_element_factory_make ("rtpsbcdepay", NULL);
if (!depay) {
GST_ERROR_OBJECT (a2dpsrc, "Unable to instantiate rtpsbcdepay");
goto fail;
}
if (!gst_bin_add (bin, a2dpsrc->avdtpsrc) || !gst_bin_add (bin, depay) ||
!gst_element_link (a2dpsrc->avdtpsrc, depay)) {
GST_ERROR_OBJECT (a2dpsrc, "Unable to add elements to bin");
goto fail;
}
depay_srcpad = gst_element_get_static_pad (depay, "src");
srcpad = gst_ghost_pad_new ("sink", depay_srcpad);
gst_object_unref (depay_srcpad);
if (!gst_element_add_pad (GST_ELEMENT (a2dpsrc), srcpad)) {
GST_ERROR_OBJECT (a2dpsrc, "Could not add srcpad");
goto fail;
}
/* We keep a copy for easy proxying of properties */
gst_object_ref (a2dpsrc->avdtpsrc);
return;
fail:
if (a2dpsrc->avdtpsrc)
gst_object_unref (a2dpsrc->avdtpsrc);
if (depay)
gst_object_unref (depay);
if (srcpad)
gst_object_unref (srcpad);
return;
}
static void
gst_a2dp_src_finalize (GObject * object)
{
GstA2dpSrc *a2dpsrc = GST_A2DP_SRC (object);
gst_object_unref (a2dpsrc->avdtpsrc);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_a2dp_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstA2dpSrc *a2dpsrc = GST_A2DP_SRC (object);
switch (prop_id) {
case PROP_TRANSPORT:
g_object_get_property (G_OBJECT (a2dpsrc->avdtpsrc), "transport", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_a2dp_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstA2dpSrc *a2dpsrc = GST_A2DP_SRC (object);
switch (prop_id) {
case PROP_TRANSPORT:
g_object_set_property (G_OBJECT (a2dpsrc->avdtpsrc), "transport", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
gboolean
gst_a2dp_src_plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "a2dpsrc", GST_RANK_NONE,
GST_TYPE_A2DP_SRC);
}

View file

@ -1,61 +0,0 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Collabora Ltd.
*
*
* 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
*
*/
#ifndef __GST_A2DP_SRC_H
#define __GST_A2DP_SRC_H
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_A2DP_SRC \
(gst_a2dp_src_get_type())
#define GST_A2DP_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_A2DP_SRC, GstA2dpSrc))
#define GST_A2DP_SRC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_A2DP_SRC, GstA2dpSrc))
#define GST_IS_A2DP_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_A2DP_SRC))
#define GST_IS_A2DP_SRC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_A2DP_SRC))
typedef struct _GstA2dpSrc GstA2dpSrc;
typedef struct _GstA2dpSrcClass GstA2dpSrcClass;
struct _GstA2dpSrcClass
{
GstBinClass parentclass;
};
struct _GstA2dpSrc
{
GstBin parent;
GstElement *avdtpsrc;
GstPad *srcpad;
};
GType gst_a2dp_src_get_type (void);
gboolean gst_a2dp_src_plugin_init (GstPlugin * plugin);
G_END_DECLS
#endif