summaryrefslogtreecommitdiffstats
path: root/apps/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata')
-rw-r--r--apps/metadata/id3tags.c34
-rw-r--r--apps/metadata/vorbis.c20
2 files changed, 51 insertions, 3 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];
diff --git a/apps/metadata/vorbis.c b/apps/metadata/vorbis.c
index f6d3af1cef..29848daa19 100644
--- a/apps/metadata/vorbis.c
+++ b/apps/metadata/vorbis.c
@@ -341,15 +341,29 @@ long read_vorbis_tags(int fd, struct mp3entry *id3,
}
len -= read_len;
+ read_len = file_read_string(&file, id3->path, sizeof(id3->path), -1, len);
- if (file_read_string(&file, id3->path, sizeof(id3->path), -1, len) < 0)
+ if (read_len < 0)
{
return 0;
}
logf("Vorbis comment %d: %s=%s", i, name, id3->path);
- len = parse_tag(name, id3->path, id3, buf, buf_remaining,
- TAGTYPE_VORBIS);
+
+ /* Is it an embedded cuesheet? */
+ if (!strcasecmp(name, "CUESHEET"))
+ {
+ id3->embed_cuesheet.present = true;
+ id3->embed_cuesheet.pos = lseek(file.fd, 0, SEEK_CUR) - read_len;
+ id3->embed_cuesheet.size = len;
+ id3->embed_cuesheet.encoding = CHAR_ENC_UTF_8;
+ }
+ else
+ {
+ len = parse_tag(name, id3->path, id3, buf, buf_remaining,
+ TAGTYPE_VORBIS);
+ }
+
buf += len;
buf_remaining -= len;
}