diff options
Diffstat (limited to 'audio/gstbluetooth.c')
| -rw-r--r-- | audio/gstbluetooth.c | 23 | 
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 };  | 
