gstbluetooth.c revision 7e8ae7f5bd23a425674180df138d3dcc3b21afb6
1/*
2 *
3 *  BlueZ - Bluetooth protocol stack for Linux
4 *
5 *  Copyright (C) 2004-2007  Marcel Holtmann <marcel@holtmann.org>
6 *
7 *
8 *  This library is free software; you can redistribute it and/or
9 *  modify it under the terms of the GNU Lesser General Public
10 *  License as published by the Free Software Foundation; either
11 *  version 2.1 of the License, or (at your option) any later version.
12 *
13 *  This library is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 *  Lesser General Public License for more details.
17 *
18 *  You should have received a copy of the GNU Lesser General Public
19 *  License along with this library; if not, write to the Free Software
20 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 *
22 */
23
24#ifdef HAVE_CONFIG_H
25#include <config.h>
26#endif
27
28#include "gstsbcenc.h"
29#include "gstsbcdec.h"
30#include "gstsbcparse.h"
31#include "gsta2dpsink.h"
32
33static GstStaticCaps sbc_caps = GST_STATIC_CAPS("audio/x-sbc");
34
35#define SBC_CAPS (gst_static_caps_get(&sbc_caps))
36
37static void sbc_typefind(GstTypeFind *tf, gpointer ignore)
38{
39	guint8 *data = gst_type_find_peek(tf, 0, 1);
40
41	if (*data != 0x9c)	/* SBC syncword */
42		return;
43
44	gst_type_find_suggest(tf, GST_TYPE_FIND_POSSIBLE, SBC_CAPS);
45}
46
47static gchar *sbc_exts[] = { "sbc", NULL };
48
49static gboolean plugin_init(GstPlugin *plugin)
50{
51	GST_INFO("Bluetooth plugin %s", VERSION);
52
53	if (gst_type_find_register(plugin, "sbc",
54			GST_RANK_PRIMARY, sbc_typefind, sbc_exts,
55					SBC_CAPS, NULL, NULL) == FALSE)
56		return FALSE;
57
58	if (gst_element_register(plugin, "sbcenc",
59			GST_RANK_NONE, GST_TYPE_SBC_ENC) == FALSE)
60		return FALSE;
61
62	if (gst_element_register(plugin, "sbcdec",
63			GST_RANK_PRIMARY, GST_TYPE_SBC_DEC) == FALSE)
64		return FALSE;
65
66	if (gst_element_register(plugin, "sbcparse",
67			GST_RANK_PRIMARY, GST_TYPE_SBC_PARSE) == FALSE)
68		return FALSE;
69
70	if (gst_element_register(plugin, "a2dpsink",
71			GST_RANK_PRIMARY, GST_TYPE_A2DP_SINK) == FALSE)
72		return FALSE;
73
74	return TRUE;
75}
76
77GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR,
78	"bluetooth", "Bluetooth plugin library",
79	plugin_init, VERSION, "LGPL", "BlueZ", "http://www.bluez.org/")
80