summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-08-25 17:01:57 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-08-25 17:01:57 +0000
commita889dc322a49c0bf8f8b77389cfbaa97703e828e (patch)
treef268bad929f7e5f6b3d6542d09d0f60053fbb6c6
parentaec1793366001cdda187e851f9e37113678d7ee8 (diff)
Add SBC stream detection
-rw-r--r--audio/gstbluetooth.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/audio/gstbluetooth.c b/audio/gstbluetooth.c
index 58655573..8c07bae3 100644
--- a/audio/gstbluetooth.c
+++ b/audio/gstbluetooth.c
@@ -29,10 +29,31 @@
#include "gstsbcdec.h"
#include "gsta2dpsink.h"
+static GstStaticCaps sbc_caps = GST_STATIC_CAPS("audio/x-sbc");
+
+#define SBC_CAPS (gst_static_caps_get(&sbc_caps))
+
+static void sbc_typefind(GstTypeFind *tf, gpointer ignore)
+{
+ guint8 *data = gst_type_find_peek(tf, 0, 1);
+
+ if (*data != 0x9c) /* SBC syncword */
+ return;
+
+ gst_type_find_suggest(tf, GST_TYPE_FIND_POSSIBLE, SBC_CAPS);
+}
+
+static gchar *sbc_exts[] = { "sbc", NULL };
+
static gboolean plugin_init(GstPlugin *plugin)
{
GST_INFO("Bluetooth plugin %s", VERSION);
+ if (gst_type_find_register(plugin, "sbc",
+ GST_RANK_PRIMARY, sbc_typefind, sbc_exts,
+ SBC_CAPS, NULL, NULL) == FALSE)
+ return FALSE;
+
if (gst_element_register(plugin, "sbcenc",
GST_RANK_NONE, GST_TYPE_SBC_ENC) == FALSE)
return FALSE;