summaryrefslogtreecommitdiffstats
path: root/apps/metadata/id3tags.c
diff options
context:
space:
mode:
authorNick Peskett <rockbox@peskett.co.uk>2011-12-16 10:09:41 +0000
committerNick Peskett <rockbox@peskett.co.uk>2011-12-16 10:09:41 +0000
commit02fd314a0b426d6d445e2c9b167681ade6b0c1d2 (patch)
treead6100925dadaae0a69b8ec87b03eb8c1c5b23ab /apps/metadata/id3tags.c
parent014003afac4e6ab5f132df25e0e92106ed21607a (diff)
downloadrockbox-02fd314a0b426d6d445e2c9b167681ade6b0c1d2.tar.gz
rockbox-02fd314a0b426d6d445e2c9b167681ade6b0c1d2.tar.bz2
rockbox-02fd314a0b426d6d445e2c9b167681ade6b0c1d2.zip
FS #12419 : Support for embedded cuesheets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31321 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/id3tags.c')
-rw-r--r--apps/metadata/id3tags.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c
index dcf71f71bf..e9b59e012a 100644
--- a/apps/metadata/id3tags.c
+++ b/apps/metadata/id3tags.c
@@ -995,6 +995,40 @@ void setid3v2title(int fd, struct mp3entry *entry)
if(bytesread >= buffersize - bufferpos)
bytesread = buffersize - bufferpos - 1;
+ if ( /* Is it an embedded cuesheet? */
+ (tr->tag_length == 4 && !memcmp(header, "TXXX", 4)) &&
+ (bytesread >= 14 && !strncmp(utf8buf, "CUESHEET", 8))
+ ) {
+ unsigned char char_enc = 0;
+ /* 0CUESHEET0 = 10 bytes */
+ unsigned char cuesheet_offset = 10;
+ switch (tag[0]) {
+ case 0x00:
+ char_enc = CHAR_ENC_ISO_8859_1;
+ break;
+ case 0x01:
+ char_enc = CHAR_ENC_UTF_16_LE;
+ cuesheet_offset += cuesheet_offset+1;
+ break;
+ case 0x02:
+ char_enc = CHAR_ENC_UTF_16_BE;
+ cuesheet_offset += cuesheet_offset+1;
+ break;
+ case 0x03:
+ char_enc = CHAR_ENC_UTF_8;
+ break;
+ }
+ if (char_enc > 0) {
+ entry->embed_cuesheet.present = true;
+ entry->embed_cuesheet.pos = lseek(fd, 0, SEEK_CUR)
+ - framelen + cuesheet_offset;
+ entry->embed_cuesheet.size = totframelen
+ - cuesheet_offset;
+ entry->embed_cuesheet.encoding = char_enc;
+ }
+ break;
+ }
+
for (j = 0; j < bytesread; j++)
tag[j] = utf8buf[j];