From 6b6463c8b702ee4860a1c2ae63fa8b334e1eb5d5 Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Sun, 22 Nov 2009 16:37:36 +0000 Subject: 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 --- apps/codecs/libm4a/demux.c | 3 ++- apps/metadata/mp4.c | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c index 61ff16c0d9..00fd3132aa 100644 --- a/apps/codecs/libm4a/demux.c +++ b/apps/codecs/libm4a/demux.c @@ -66,7 +66,8 @@ static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len) (type != MAKEFOURCC('M','4','B',' ')) && (type != MAKEFOURCC('m','p','4','2')) && (type != MAKEFOURCC('3','g','p','6')) && - (type != MAKEFOURCC('q','t',' ',' '))) + (type != MAKEFOURCC('q','t',' ',' ')) && + (type != MAKEFOURCC('i','s','o','m'))) { DEBUGF("not M4A file\n"); return; 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 @@ #define MP4_gnre FOURCC('g', 'n', 'r', 'e') #define MP4_hdlr FOURCC('h', 'd', 'l', 'r') #define MP4_ilst FOURCC('i', 'l', 's', 't') +#define MP4_isom FOURCC('i', 's', 'o', 'm') #define MP4_M4A FOURCC('M', '4', 'A', ' ') #define MP4_M4B FOURCC('M', '4', 'B', ' ') #define MP4_mdat FOURCC('m', 'd', 'a', 't') @@ -552,9 +553,10 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, { size_left = read_mp4_atom(fd, &size, &type, size_left); - /* DEBUGF("Atom: '%c%c%c%c' (0x%08x, %d bytes left)\n", - (type >> 24) & 0xff, (type >> 16) & 0xff, (type >> 8) & 0xff, - type & 0xff, type, size); */ + /* DEBUGF("Atom: '%c%c%c%c' (0x%08lx, %lu bytes left)\n", + (int) ((type >> 24) & 0xff), (int) ((type >> 16) & 0xff), + (int) ((type >> 8) & 0xff), (int) (type & 0xff), + type, size); */ switch (type) { @@ -566,7 +568,8 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, size -= 4; if ((id != MP4_M4A) && (id != MP4_M4B) && (id != MP4_mp42) - && (id != MP4_qt) && (id != MP4_3gp6)) + && (id != MP4_qt) && (id != MP4_3gp6) + && (id != MP4_isom)) { DEBUGF("Unknown MP4 file type: '%c%c%c%c'\n", (int)(id >> 24 & 0xff), (int)(id >> 16 & 0xff), @@ -704,7 +707,11 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, break; } - lseek(fd, size, SEEK_CUR); + /* Skip final seek. */ + if (id3->filesize == 0) + { + lseek(fd, size, SEEK_CUR); + } } while (rc && (size_left > 0) && (errno == 0) && (id3->filesize == 0)); /* Break on non-zero filesize, since Rockbox currently doesn't support @@ -745,8 +752,9 @@ bool get_mp4_metadata(int fd, struct mp3entry* id3) else { logf("MP4 metadata error"); - DEBUGF("MP4 metadata error. errno %d, frequency %ld, filesize %ld\n", - errno, id3->frequency, id3->filesize); + DEBUGF("MP4 metadata error. errno %d, samples %ld, frequency %ld, " + "filesize %ld\n", errno, id3->samples, id3->frequency, + id3->filesize); return false; } -- cgit v1.2.3