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.tar.gz rockbox-93c6f1329a5691a8be158cefe15641bd1daf9ef8.zip |
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 bcba3f0f79..f5532fa628 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, | |||
462 | } else if (!strcmp("MusicBrainz/Track Id", utf8buf)) { | 462 | } else if (!strcmp("MusicBrainz/Track Id", utf8buf)) { |
463 | id3->mb_track_id = id3buf; | 463 | id3->mb_track_id = id3buf; |
464 | asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining); | 464 | asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining); |
465 | #ifdef HAVE_ALBUMART | ||
466 | } else if (!strcmp("WM/Picture", utf8buf)) { | ||
467 | uint32_t datalength, strlength; | ||
468 | /* Expected is either "01 00 xx xx 03 yy yy yy yy" or | ||
469 | * "03 yy yy yy yy". xx is the size of the WM/Picture | ||
470 | * container in bytes. yy equals the raw data length of | ||
471 | * the embedded image. */ | ||
472 | lseek(fd, -4, SEEK_CUR); | ||
473 | read(fd, &type, 1); | ||
474 | if (type == 1) { | ||
475 | lseek(fd, 3, SEEK_CUR); | ||
476 | read(fd, &type, 1); | ||
477 | /* In case the parsing will fail in the next step we | ||
478 | * might at least be able to skip the whole section. */ | ||
479 | datalength = length - 1; | ||
480 | } | ||
481 | if (type == 3) { | ||
482 | /* Read the raw data length of the embedded image. */ | ||
483 | read_uint32le(fd, &datalength); | ||
484 | |||
485 | /* Reset utf8 buffer */ | ||
486 | utf8 = utf8buf; | ||
487 | utf8length = 512; | ||
488 | |||
489 | /* Gather the album art format, this string has a | ||
490 | * double zero-termination. */ | ||
491 | asf_utf16LEdecode(fd, 32, &utf8, &utf8length); | ||
492 | strlength = (strlen(utf8buf) + 2) * 2; | ||
493 | lseek(fd, strlength-32, SEEK_CUR); | ||
494 | if (!strcmp("image/jpeg", utf8buf)) { | ||
495 | id3->albumart.type = AA_TYPE_JPG; | ||
496 | } else if (!strcmp("image/png", utf8buf)) { | ||
497 | id3->albumart.type = AA_TYPE_PNG; | ||
498 | } else { | ||
499 | id3->albumart.type = AA_TYPE_UNKNOWN; | ||
500 | } | ||
501 | |||
502 | /* Set the album art size and position. */ | ||
503 | if (id3->albumart.type != AA_TYPE_UNKNOWN) { | ||
504 | id3->albumart.pos = lseek(fd, 0, SEEK_CUR); | ||
505 | id3->albumart.size = datalength; | ||
506 | id3->embed_albumart = true; | ||
507 | } | ||
508 | } | ||
509 | |||
510 | lseek(fd, datalength, SEEK_CUR); | ||
511 | #endif | ||
465 | } else { | 512 | } else { |
466 | lseek(fd, length, SEEK_CUR); | 513 | lseek(fd, length, SEEK_CUR); |
467 | } | 514 | } |
diff --git a/manual/appendix/file_formats.tex b/manual/appendix/file_formats.tex index 696c0d62d9..4e5d96aedf 100644 --- a/manual/appendix/file_formats.tex +++ b/manual/appendix/file_formats.tex | |||
@@ -295,7 +295,7 @@ | |||
295 | {\textbf{Feature} & \textbf{ID3} & \textbf{APE} & \textbf{Vorbis} & | 295 | {\textbf{Feature} & \textbf{ID3} & \textbf{APE} & \textbf{Vorbis} & |
296 | \textbf{MP4} & \textbf{ASF}}{}{} | 296 | \textbf{MP4} & \textbf{ASF}}{}{} |
297 | Embedded albumart \fname{.bmp} & & & & & \\ | 297 | Embedded albumart \fname{.bmp} & & & & & \\ |
298 | Embedded albumart \fname{.jpg} & x & x & & x & \\ | 298 | Embedded albumart \fname{.jpg} & x & x & & x & x \\ |
299 | Embedded albumart \fname{.png} & & & & & \\ | 299 | Embedded albumart \fname{.png} & & & & & \\ |
300 | Replaygain information & x & x & x & x & x \\ | 300 | Replaygain information & x & x & x & x & x \\ |
301 | Title (string) & x & x & x & x & x \\ | 301 | Title (string) & x & x & x & x & x \\ |
@@ -311,6 +311,8 @@ | |||
311 | Grouping (string) & & x & x & x & \\ | 311 | Grouping (string) & & x & x & x & \\ |
312 | \end{rbtabular} | 312 | \end{rbtabular} |
313 | 313 | ||
314 | \note{Embedded album art for ASF is limited to pictures of maximum 64 KB size.} | ||
315 | |||
314 | \subsection{Featureset for codec specific metadata} | 316 | \subsection{Featureset for codec specific metadata} |
315 | \begin{rbtabular}{\textwidth}{lX}% | 317 | \begin{rbtabular}{\textwidth}{lX}% |
316 | {\textbf{Feature} & \textbf{Codec specific metadata (file extension)}}{}{} | 318 | {\textbf{Feature} & \textbf{Codec specific metadata (file extension)}}{}{} |