diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2009-11-22 16:37:36 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2009-11-22 16:37:36 +0000 |
commit | 6b6463c8b702ee4860a1c2ae63fa8b334e1eb5d5 (patch) | |
tree | b09d35a86ded06ac581a2620f30ec55d4c713456 /apps/metadata/mp4.c | |
parent | bbfe57377c429e7d91d04353c916fd404623ed24 (diff) | |
download | rockbox-6b6463c8b702ee4860a1c2ae63fa8b334e1eb5d5.tar.gz rockbox-6b6463c8b702ee4860a1c2ae63fa8b334e1eb5d5.zip |
Add support for the MP4 file type 'isom'. Based on FS#10790 with an additional fix, making the sample file play. Also updated some debug prints.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23708 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/mp4.c')
-rw-r--r-- | apps/metadata/mp4.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 410bb79b81..44bc68eb5c 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #define MP4_gnre FOURCC('g', 'n', 'r', 'e') | 51 | #define MP4_gnre FOURCC('g', 'n', 'r', 'e') |
52 | #define MP4_hdlr FOURCC('h', 'd', 'l', 'r') | 52 | #define MP4_hdlr FOURCC('h', 'd', 'l', 'r') |
53 | #define MP4_ilst FOURCC('i', 'l', 's', 't') | 53 | #define MP4_ilst FOURCC('i', 'l', 's', 't') |
54 | #define MP4_isom FOURCC('i', 's', 'o', 'm') | ||
54 | #define MP4_M4A FOURCC('M', '4', 'A', ' ') | 55 | #define MP4_M4A FOURCC('M', '4', 'A', ' ') |
55 | #define MP4_M4B FOURCC('M', '4', 'B', ' ') | 56 | #define MP4_M4B FOURCC('M', '4', 'B', ' ') |
56 | #define MP4_mdat FOURCC('m', 'd', 'a', 't') | 57 | #define MP4_mdat FOURCC('m', 'd', 'a', 't') |
@@ -552,9 +553,10 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
552 | { | 553 | { |
553 | size_left = read_mp4_atom(fd, &size, &type, size_left); | 554 | size_left = read_mp4_atom(fd, &size, &type, size_left); |
554 | 555 | ||
555 | /* DEBUGF("Atom: '%c%c%c%c' (0x%08x, %d bytes left)\n", | 556 | /* DEBUGF("Atom: '%c%c%c%c' (0x%08lx, %lu bytes left)\n", |
556 | (type >> 24) & 0xff, (type >> 16) & 0xff, (type >> 8) & 0xff, | 557 | (int) ((type >> 24) & 0xff), (int) ((type >> 16) & 0xff), |
557 | type & 0xff, type, size); */ | 558 | (int) ((type >> 8) & 0xff), (int) (type & 0xff), |
559 | type, size); */ | ||
558 | 560 | ||
559 | switch (type) | 561 | switch (type) |
560 | { | 562 | { |
@@ -566,7 +568,8 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
566 | size -= 4; | 568 | size -= 4; |
567 | 569 | ||
568 | if ((id != MP4_M4A) && (id != MP4_M4B) && (id != MP4_mp42) | 570 | if ((id != MP4_M4A) && (id != MP4_M4B) && (id != MP4_mp42) |
569 | && (id != MP4_qt) && (id != MP4_3gp6)) | 571 | && (id != MP4_qt) && (id != MP4_3gp6) |
572 | && (id != MP4_isom)) | ||
570 | { | 573 | { |
571 | DEBUGF("Unknown MP4 file type: '%c%c%c%c'\n", | 574 | DEBUGF("Unknown MP4 file type: '%c%c%c%c'\n", |
572 | (int)(id >> 24 & 0xff), (int)(id >> 16 & 0xff), | 575 | (int)(id >> 24 & 0xff), (int)(id >> 16 & 0xff), |
@@ -704,7 +707,11 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
704 | break; | 707 | break; |
705 | } | 708 | } |
706 | 709 | ||
707 | lseek(fd, size, SEEK_CUR); | 710 | /* Skip final seek. */ |
711 | if (id3->filesize == 0) | ||
712 | { | ||
713 | lseek(fd, size, SEEK_CUR); | ||
714 | } | ||
708 | } | 715 | } |
709 | while (rc && (size_left > 0) && (errno == 0) && (id3->filesize == 0)); | 716 | while (rc && (size_left > 0) && (errno == 0) && (id3->filesize == 0)); |
710 | /* Break on non-zero filesize, since Rockbox currently doesn't support | 717 | /* Break on non-zero filesize, since Rockbox currently doesn't support |
@@ -745,8 +752,9 @@ bool get_mp4_metadata(int fd, struct mp3entry* id3) | |||
745 | else | 752 | else |
746 | { | 753 | { |
747 | logf("MP4 metadata error"); | 754 | logf("MP4 metadata error"); |
748 | DEBUGF("MP4 metadata error. errno %d, frequency %ld, filesize %ld\n", | 755 | DEBUGF("MP4 metadata error. errno %d, samples %ld, frequency %ld, " |
749 | errno, id3->frequency, id3->filesize); | 756 | "filesize %ld\n", errno, id3->samples, id3->frequency, |
757 | id3->filesize); | ||
750 | return false; | 758 | return false; |
751 | } | 759 | } |
752 | 760 | ||