summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-04-07 16:48:06 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-04-07 16:48:06 +0000
commite57ce075090d08cd4235ec9ab0115d1238553389 (patch)
treec2c20a1b1d58274a3a316cffccce832fc211324a
parent4bac11bda04d87b4ff083996c2e60be1f8308e38 (diff)
downloadgstreamer-plugins-base-e57ce075090d08cd4235ec9ab0115d1238553389.tar.gz
Fixes #106448
Original commit message from CVS: Fixes #106448
-rw-r--r--ext/vorbis/vorbis.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/ext/vorbis/vorbis.c b/ext/vorbis/vorbis.c
index a7297a9e1..dda04430a 100644
--- a/ext/vorbis/vorbis.c
+++ b/ext/vorbis/vorbis.c
@@ -84,12 +84,38 @@ static GstTypeDefinition vorbisdefinition = {
static GstCaps*
vorbis_type_find (GstBuffer *buf, gpointer private)
{
- gulong head = GULONG_FROM_BE (*((gulong *)GST_BUFFER_DATA (buf)));
+ guint32 head;
+ gint offset;
+ guint8 *data;
+ gint size;
- if (head != 0x4F676753)
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
+
+ if (size < sizeof(guint32))
return NULL;
- return gst_caps_new ("vorbis_type_find", "application/x-ogg", NULL);
+ head = GUINT32_FROM_BE (*((guint32 *)data));
+
+ if (head == 0x4F676753) {
+ return gst_caps_new ("vorbis_type_find", "application/x-ogg", NULL);
+ } else {
+ /* checks for existance of vorbis identification header in case
+ * there's an ID3 tag */
+ for (offset = 0; offset < size-7; offset++) {
+ if (data[offset] == 0x01 &&
+ data[offset+1] == 'v' &&
+ data[offset+2] == 'o' &&
+ data[offset+3] == 'r' &&
+ data[offset+4] == 'b' &&
+ data[offset+5] == 'i' &&
+ data[offset+6] == 's' ) {
+ return gst_caps_new ("vorbis_type_find", "application/x-ogg", NULL);
+ }
+ }
+ }
+
+ return NULL;
}