mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
port #121143 to HEAD (flac file detection)
Original commit message from CVS: port #121143 to HEAD (flac file detection)
This commit is contained in:
parent
ffb4b651be
commit
6ecea15a25
1 changed files with 23 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue