diff options
| author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-07 15:23:57 +0000 |
|---|---|---|
| committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-07 15:23:57 +0000 |
| commit | 93c6f1329a5691a8be158cefe15641bd1daf9ef8 (patch) | |
| tree | a473f97552dd7a87284335a6b1831a6d5f9c2e9b | |
| parent | 0bba82bf946167e334130526d025ce02b0e6580e (diff) | |
| download | rockbox-93c6f1329a5691a8be158cefe15641bd1daf9ef8.zip rockbox-93c6f1329a5691a8be158cefe15641bd1daf9ef8.tar.gz rockbox-93c6f1329a5691a8be158cefe15641bd1daf9ef8.tar.bz2 rockbox-93c6f1329a5691a8be158cefe15641bd1daf9ef8.tar.xz | |
Submit FS#12218. Add support for embedded album art for ASF tags. For now the support is limited to embedded pictures of max 64 KB size.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30263 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/metadata/asf.c | 47 | ||||
| -rw-r--r-- | manual/appendix/file_formats.tex | 4 |
2 files changed, 50 insertions, 1 deletions
diff --git a/apps/metadata/asf.c b/apps/metadata/asf.c index bcba3f0..f5532fa 100644 --- a/apps/metadata/asf.c +++ b/apps/metadata/asf.c @@ -462,6 +462,53 @@ static int asf_parse_header(int fd, struct mp3entry* id3, } else if (!strcmp("MusicBrainz/Track Id", utf8buf)) { id3->mb_track_id = id3buf; asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining); +#ifdef HAVE_ALBUMART + } else if (!strcmp("WM/Picture", utf8buf)) { + uint32_t datalength, strlength; + /* Expected is either "01 00 xx xx 03 yy yy yy yy" or + * "03 yy yy yy yy". xx is the size of the WM/Picture + * container in bytes. yy equals the raw data length of + * the embedded image. */ + lseek(fd, -4, SEEK_CUR); + read(fd, &type, 1); + if (type == 1) { + lseek(fd, 3, SEEK_CUR); + read(fd, &type, 1); + /* In case the parsing will fail in the next step we + * might at least be able to skip the whole section. */ + datalength = length - 1; + } + if (type == 3) { + /* Read the raw data length of the embedded image. */ + read_uint32le(fd, &datalength); + + /* Reset utf8 buffer */ + utf8 = utf8buf; + utf8length = 512; + + /* Gather the album art format, this string has a + * double zero-termination. */ + asf_utf16LEdecode(fd, 32, &utf8, &utf8length); + strlength = (strlen(utf8buf) + 2) * 2; + lseek(fd, strlength-32, SEEK_CUR); + if (!strcmp("image/jpeg", utf8buf)) { + id3->albumart.type = AA_TYPE_JPG; + } else if (!strcmp("image/png", utf8buf)) { + id3->albumart.type = AA_TYPE_PNG; + } else { + id3->albumart.type = AA_TYPE_UNKNOWN; + } + + /* Set the album art size and position. */ + if (id3->albumart.type != AA_TYPE_UNKNOWN) { + id3->albumart.pos = lseek(fd, 0, SEEK_CUR); + id3->albumart.size = datalength; + id3->embed_albumart = true; + } + } + + lseek(fd, datalength, SEEK_CUR); +#endif } else { lseek(fd, length, SEEK_CUR); } diff --git a/manual/appendix/file_formats.tex b/manual/appendix/file_formats.tex index 696c0d6..4e5d96a 100644 --- a/manual/appendix/file_formats.tex +++ b/manual/appendix/file_formats.tex @@ -295,7 +295,7 @@ {\textbf{Feature} & \textbf{ID3} & \textbf{APE} & \textbf{Vorbis} & \textbf{MP4} & \textbf{ASF}}{}{} Embedded albumart \fname{.bmp} & & & & & \\ - Embedded albumart \fname{.jpg} & x & x & & x & \\ + Embedded albumart \fname{.jpg} & x & x & & x & x \\ Embedded albumart \fname{.png} & & & & & \\ Replaygain information & x & x & x & x & x \\ Title (string) & x & x & x & x & x \\ @@ -311,6 +311,8 @@ Grouping (string) & & x & x & x & \\ \end{rbtabular} + \note{Embedded album art for ASF is limited to pictures of maximum 64 KB size.} + \subsection{Featureset for codec specific metadata} \begin{rbtabular}{\textwidth}{lX}% {\textbf{Feature} & \textbf{Codec specific metadata (file extension)}}{}{} |