From de8b4e7ab91bad2c1c6e796f53d4e69ecbadd0bd Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 23 Jan 2008 13:19:32 +0000 Subject: Add mp3 support for gstreamer plugin. --- audio/gstbluetooth.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'audio/gstbluetooth.c') 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 #endif +#include + +#include "gstsbcutil.h" +#include + #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 }; -- cgit