From 2f438e5d238840b96414079d17f1b56ab1fba9a5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 2 Mar 2009 18:12:44 +0100 Subject: tag_id3: parse ID3 tags in AIFF files Added a small AIFF parser library, code copied from the RIFF parser (big-endian integers). Look for an "ID3" chunk, and let libid3tag parse it. --- src/tag_id3.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/tag_id3.c') diff --git a/src/tag_id3.c b/src/tag_id3.c index 7cf82c10..2193f2e7 100644 --- a/src/tag_id3.c +++ b/src/tag_id3.c @@ -19,6 +19,7 @@ #include "tag_id3.h" #include "tag.h" #include "riff.h" +#include "aiff.h" #include "conf.h" #include @@ -426,7 +427,7 @@ static struct id3_tag *findId3TagFromEnd(FILE * stream) } static struct id3_tag * -tag_id3_riff_load(FILE *file) +tag_id3_riff_aiff_load(FILE *file) { size_t size; void *buffer; @@ -434,10 +435,12 @@ tag_id3_riff_load(FILE *file) struct id3_tag *tag; size = riff_seek_id3(file); + if (size == 0) + size = aiff_seek_id3(file); if (size == 0) return NULL; - if (size > 65536) + if (size > 256 * 1024) /* too large, don't allocate so much memory */ return NULL; @@ -469,7 +472,7 @@ struct tag *tag_id3_load(const char *file) tag = findId3TagFromBeginning(stream); if (tag == NULL) - tag = tag_id3_riff_load(stream); + tag = tag_id3_riff_aiff_load(stream); if (!tag) tag = findId3TagFromEnd(stream); -- cgit v1.2.3