summaryrefslogtreecommitdiffstats
path: root/audio/gstbluetooth.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-01-23 13:19:32 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-01-23 13:19:32 +0000
commitde8b4e7ab91bad2c1c6e796f53d4e69ecbadd0bd (patch)
tree463d60836eb333740023dabc85b68fe442e588c5 /audio/gstbluetooth.c
parent489c2e0dbd76d9cecec62d19fafd9e7baddb72e7 (diff)
Add mp3 support for gstreamer plugin.
Diffstat (limited to 'audio/gstbluetooth.c')
-rw-r--r--audio/gstbluetooth.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/audio/gstbluetooth.c b/audio/gstbluetooth.c
index 764bc899..eaab23d2 100644
--- a/audio/gstbluetooth.c
+++ b/audio/gstbluetooth.c
@@ -25,6 +25,11 @@
#include <config.h>
#endif
+#include <gst/gst.h>
+
+#include "gstsbcutil.h"
+#include <sbc.h>
+
#include "gstsbcenc.h"
#include "gstsbcdec.h"
#include "gstsbcparse.h"
@@ -38,12 +43,26 @@ static GstStaticCaps sbc_caps = GST_STATIC_CAPS("audio/x-sbc");
static void sbc_typefind(GstTypeFind *tf, gpointer ignore)
{
- guint8 *data = gst_type_find_peek(tf, 0, 1);
+ GstCaps *caps;
+ guint8 *aux;
+ sbc_t sbc;
+ guint8 *data = gst_type_find_peek(tf, 0, 32);
+
+ if (sbc_init(&sbc, 0) < 0)
+ return;
if (data == NULL || *data != 0x9c) /* SBC syncword */
return;
- gst_type_find_suggest(tf, GST_TYPE_FIND_POSSIBLE, SBC_CAPS);
+ aux = g_new(guint8, 32);
+ memcpy(aux, data, 32);
+ sbc_parse(&sbc, aux, 32);
+ g_free(aux);
+ caps = gst_sbc_parse_caps_from_sbc(&sbc);
+ sbc_finish(&sbc);
+
+ gst_type_find_suggest(tf, GST_TYPE_FIND_POSSIBLE, caps);
+ gst_caps_unref(caps);
}
static gchar *sbc_exts[] = { "sbc", NULL };