diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-03-15 20:17:28 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-03-15 20:17:28 +0000 |
commit | d9e85475c58b5450f4477c26430bc408489cf08c (patch) | |
tree | 734319692458ffbd4f544fd0835a27e61657cd9d | |
parent | 55e75866422aabbe927a52fb2ddaccc2525061a1 (diff) | |
download | rockbox-d9e85475c58b5450f4477c26430bc408489cf08c.tar.gz rockbox-d9e85475c58b5450f4477c26430bc408489cf08c.zip |
Submit FS#12009. Add embedded album art support for m4a. Thanks to Jason Yu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29591 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/metadata/mp4.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index a431231e12..4feb56cf98 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c | |||
@@ -33,6 +33,11 @@ | |||
33 | #include "debug.h" | 33 | #include "debug.h" |
34 | #include "replaygain.h" | 34 | #include "replaygain.h" |
35 | 35 | ||
36 | #ifdef DEBUGF | ||
37 | #undef DEBUGF | ||
38 | #define DEBUGF(...) | ||
39 | #endif | ||
40 | |||
36 | #define MP4_3gp6 FOURCC('3', 'g', 'p', '6') | 41 | #define MP4_3gp6 FOURCC('3', 'g', 'p', '6') |
37 | #define MP4_aART FOURCC('a', 'A', 'R', 'T') | 42 | #define MP4_aART FOURCC('a', 'A', 'R', 'T') |
38 | #define MP4_alac FOURCC('a', 'l', 'a', 'c') | 43 | #define MP4_alac FOURCC('a', 'l', 'a', 'c') |
@@ -45,6 +50,7 @@ | |||
45 | #define MP4_cwrt FOURCC(0xa9, 'w', 'r', 't') | 50 | #define MP4_cwrt FOURCC(0xa9, 'w', 'r', 't') |
46 | #define MP4_ccmt FOURCC(0xa9, 'c', 'm', 't') | 51 | #define MP4_ccmt FOURCC(0xa9, 'c', 'm', 't') |
47 | #define MP4_cday FOURCC(0xa9, 'd', 'a', 'y') | 52 | #define MP4_cday FOURCC(0xa9, 'd', 'a', 'y') |
53 | #define MP4_covr FOURCC('c', 'o', 'v', 'r') | ||
48 | #define MP4_disk FOURCC('d', 'i', 's', 'k') | 54 | #define MP4_disk FOURCC('d', 'i', 's', 'k') |
49 | #define MP4_esds FOURCC('e', 's', 'd', 's') | 55 | #define MP4_esds FOURCC('e', 's', 'd', 's') |
50 | #define MP4_ftyp FOURCC('f', 't', 'y', 'p') | 56 | #define MP4_ftyp FOURCC('f', 't', 'y', 'p') |
@@ -461,6 +467,32 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3, | |||
461 | } | 467 | } |
462 | break; | 468 | break; |
463 | 469 | ||
470 | #ifdef HAVE_ALBUMART | ||
471 | case MP4_covr: | ||
472 | { | ||
473 | int pos = lseek(fd, 0, SEEK_CUR) + 16; | ||
474 | |||
475 | read_mp4_tag(fd, size, buffer, 8); | ||
476 | id3->albumart.type = AA_TYPE_UNKNOWN; | ||
477 | if (memcmp(buffer, "\xff\xd8\xff\xe0", 4) == 0) | ||
478 | { | ||
479 | id3->albumart.type = AA_TYPE_JPG; | ||
480 | } | ||
481 | else if (memcmp(buffer, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0) | ||
482 | { | ||
483 | id3->albumart.type = AA_TYPE_PNG; | ||
484 | } | ||
485 | |||
486 | if (id3->albumart.type != AA_TYPE_UNKNOWN) | ||
487 | { | ||
488 | id3->albumart.pos = pos; | ||
489 | id3->albumart.size = size - 16; | ||
490 | id3->embed_albumart = true; | ||
491 | } | ||
492 | } | ||
493 | break; | ||
494 | #endif | ||
495 | |||
464 | case MP4_extra: | 496 | case MP4_extra: |
465 | { | 497 | { |
466 | char tag_name[TAG_NAME_LENGTH]; | 498 | char tag_name[TAG_NAME_LENGTH]; |