diff options
author | Jeremy Simon <jsimon13@yahoo.fr> | 2003-09-20 19:34:31 +0000 |
---|---|---|
committer | Jeremy Simon <jsimon13@yahoo.fr> | 2003-09-20 19:34:31 +0000 |
commit | 6ecea15a25119e14d754450db283be5102645cb5 (patch) | |
tree | ebb02f39e180f4ae9a0330ff68bbd2db3e23334f /ext/flac/gstflac.c | |
parent | ffb4b651be94662ec04d3cdacb4a4a938d07e14e (diff) |
port #121143 to HEAD (flac file detection)
Original commit message from CVS:
port #121143 to HEAD (flac file detection)
Diffstat (limited to 'ext/flac/gstflac.c')
-rw-r--r-- | ext/flac/gstflac.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/ext/flac/gstflac.c b/ext/flac/gstflac.c index b8dd73e8..2c30df32 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; } |