summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornialv7 <nialv7@gmail.com>2014-09-15 01:33:20 -0400
committerMarcin Bukat <marcin.bukat@gmail.com>2014-09-22 10:20:39 +0200
commitd392da8002adfe95c8d52ac2b85143b862591aa8 (patch)
treee04fdc25ee775ad83c3a0c9d94faf714ae047327 /lib
parent582035c5cbd4f04588615d2f9b91b2f97c80f949 (diff)
metadata: Add cuesheet embedded in ape tags.
Change-Id: I5d9e731c3ea786fb910afbb0a5201fc68dcab9f9 Reviewed-on: http://gerrit.rockbox.org/965 Reviewed-by: Nick Peskett <rockbox@peskett.co.uk> Tested: Nick Peskett <rockbox@peskett.co.uk> Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/rbcodec/metadata/ape.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/lib/rbcodec/metadata/ape.c b/lib/rbcodec/metadata/ape.c
index ba0ad1598f..8b650dbb3d 100644
--- a/lib/rbcodec/metadata/ape.c
+++ b/lib/rbcodec/metadata/ape.c
@@ -44,17 +44,17 @@
struct apetag_header
{
char id[8];
- long version;
- long length;
- long item_count;
- long flags;
+ uint32_t version;
+ uint32_t length;
+ uint32_t item_count;
+ uint32_t flags;
char reserved[8];
};
struct apetag_item_header
{
- long length;
- long flags;
+ uint32_t length;
+ uint32_t flags;
};
/* Read the items in an APEV2 tag. Only looks for a tag at the end of a
@@ -79,9 +79,9 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
unsigned int buf_remaining = sizeof(id3->id3v2buf)
+ sizeof(id3->id3v1buf);
unsigned int tag_remaining = header.length - APETAG_HEADER_LENGTH;
- int i;
-
- if (lseek(fd, -header.length, SEEK_END) < 0)
+ unsigned int i;
+
+ if (lseek(fd, -((int)header.length), SEEK_END) < 0)
{
return false;
}
@@ -117,17 +117,27 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
if ((item.flags & APETAG_ITEM_TYPE_MASK) == 0)
{
long len;
-
+
if (read_string(fd, value, sizeof(value), -1, item.length)
!= item.length)
{
return false;
}
- len = parse_tag(name, value, id3, buf, buf_remaining,
+ if (!strcasecmp(name, "cuesheet"))
+ {
+ id3->has_embedded_cuesheet = true;
+ id3->embedded_cuesheet.pos = lseek(fd, 0, SEEK_CUR)-item.length;
+ id3->embedded_cuesheet.size = item.length;
+ id3->embedded_cuesheet.encoding = CHAR_ENC_UTF_8;
+ }
+ else
+ {
+ len = parse_tag(name, value, id3, buf, buf_remaining,
TAGTYPE_APE);
- buf += len;
- buf_remaining -= len;
+ buf += len;
+ buf_remaining -= len;
+ }
}
else
{