diff options
Diffstat (limited to 'lib/rbcodec/metadata')
-rw-r--r-- | lib/rbcodec/metadata/ape.c | 36 |
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 @@ | |||
44 | struct apetag_header | 44 | struct apetag_header |
45 | { | 45 | { |
46 | char id[8]; | 46 | char id[8]; |
47 | long version; | 47 | uint32_t version; |
48 | long length; | 48 | uint32_t length; |
49 | long item_count; | 49 | uint32_t item_count; |
50 | long flags; | 50 | uint32_t flags; |
51 | char reserved[8]; | 51 | char reserved[8]; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | struct apetag_item_header | 54 | struct apetag_item_header |
55 | { | 55 | { |
56 | long length; | 56 | uint32_t length; |
57 | long flags; | 57 | uint32_t flags; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | /* Read the items in an APEV2 tag. Only looks for a tag at the end of a | 60 | /* 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) | |||
79 | unsigned int buf_remaining = sizeof(id3->id3v2buf) | 79 | unsigned int buf_remaining = sizeof(id3->id3v2buf) |
80 | + sizeof(id3->id3v1buf); | 80 | + sizeof(id3->id3v1buf); |
81 | unsigned int tag_remaining = header.length - APETAG_HEADER_LENGTH; | 81 | unsigned int tag_remaining = header.length - APETAG_HEADER_LENGTH; |
82 | int i; | 82 | unsigned int i; |
83 | 83 | ||
84 | if (lseek(fd, -header.length, SEEK_END) < 0) | 84 | if (lseek(fd, -((int)header.length), SEEK_END) < 0) |
85 | { | 85 | { |
86 | return false; | 86 | return false; |
87 | } | 87 | } |
@@ -117,17 +117,27 @@ bool read_ape_tags(int fd, struct mp3entry* id3) | |||
117 | if ((item.flags & APETAG_ITEM_TYPE_MASK) == 0) | 117 | if ((item.flags & APETAG_ITEM_TYPE_MASK) == 0) |
118 | { | 118 | { |
119 | long len; | 119 | long len; |
120 | 120 | ||
121 | if (read_string(fd, value, sizeof(value), -1, item.length) | 121 | if (read_string(fd, value, sizeof(value), -1, item.length) |
122 | != item.length) | 122 | != item.length) |
123 | { | 123 | { |
124 | return false; | 124 | return false; |
125 | } | 125 | } |
126 | 126 | ||
127 | len = parse_tag(name, value, id3, buf, buf_remaining, | 127 | if (!strcasecmp(name, "cuesheet")) |
128 | { | ||
129 | id3->has_embedded_cuesheet = true; | ||
130 | id3->embedded_cuesheet.pos = lseek(fd, 0, SEEK_CUR)-item.length; | ||
131 | id3->embedded_cuesheet.size = item.length; | ||
132 | id3->embedded_cuesheet.encoding = CHAR_ENC_UTF_8; | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | len = parse_tag(name, value, id3, buf, buf_remaining, | ||
128 | TAGTYPE_APE); | 137 | TAGTYPE_APE); |
129 | buf += len; | 138 | buf += len; |
130 | buf_remaining -= len; | 139 | buf_remaining -= len; |
140 | } | ||
131 | } | 141 | } |
132 | else | 142 | else |
133 | { | 143 | { |