From a889dc322a49c0bf8f8b77389cfbaa97703e828e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 25 Aug 2007 17:01:57 +0000 Subject: Add SBC stream detection --- audio/gstbluetooth.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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; -- cgit