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
This commit is contained in:
Magnus Holmgren 2009-11-22 16:37:36 +00:00
parent bbfe57377c
commit 6b6463c8b7
2 changed files with 17 additions and 8 deletions

View file

@ -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;

View file

@ -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;
}