From: Jeremy Simon Date: Sat, 20 Sep 2003 19:34:31 +0000 (+0000) Subject: port #121143 to HEAD (flac file detection) X-Git-Tag: TYPEFIND-ROOT~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ecea15a25119e14d754450db283be5102645cb5;p=platform%2Fupstream%2Fgst-plugins-good.git port #121143 to HEAD (flac file detection) Original commit message from CVS: port #121143 to HEAD (flac file detection) --- diff --git a/ext/flac/gstflac.c b/ext/flac/gstflac.c index b8dd73e..2c30df3 100644 --- a/ext/flac/gstflac.c +++ b/ext/flac/gstflac.c @@ -68,19 +68,39 @@ static GstTypeDefinition flacdefinition = { flac_type_find, }; + static GstCaps* flac_type_find (GstBuffer *buf, gpointer private) { + gint offset; + guint8 *data; + gint size; guint32 head; if (GST_BUFFER_SIZE (buf) < 4) return NULL; + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); - if (head != 0x664C6143) - return NULL; - return gst_caps_new ("flac_type_find", "audio/x-flac", NULL); + if (head == 0x664C6143) + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + else { + /* checks for existance of flac identification header in case + * there's an ID3 tag */ + for (offset = 0; offset < size-4; offset++) { + if (data[offset] == 'f' && + data[offset+1] == 'L' && + data[offset+2] == 'a' && + data[offset+3] == 'C' ) { + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + } + } + } + + return NULL; }