1
0
Fork 0
forked from len0rd/rockbox

Make the m4a parser happier with Nero-encoded .mp4 files. This still needs more work.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7728 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2005-11-02 14:01:27 +00:00
parent 744437132e
commit 53dc1fefe9
2 changed files with 12 additions and 7 deletions

View file

@ -59,7 +59,8 @@ static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len)
type = stream_read_uint32(qtmovie->stream);
size_remaining-=4;
if (type != MAKEFOURCC('M','4','A',' '))
if ((type != MAKEFOURCC('M','4','A',' ')) &&
(type != MAKEFOURCC('m','p','4','2')))
{
DEBUGF("not M4A file\n");
return;
@ -485,7 +486,7 @@ static bool read_chunk_stbl(qtmovie_t *qtmovie, size_t chunk_len)
default:
DEBUGF("(stbl) unknown chunk id: %c%c%c%c\n",
SPLITFOURCC(sub_chunk_id));
return false;
stream_skip(qtmovie->stream, sub_chunk_len - 8); /* FIXME not 8 */
}
size_remaining -= sub_chunk_len;
@ -497,12 +498,14 @@ static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len)
{
size_t dinf_size, stbl_size;
size_t size_remaining = chunk_len - 8; /* FIXME WRONG */
uint32_t i;
/**** SOUND HEADER CHUNK ****/
if (stream_read_uint32(qtmovie->stream) != 16)
if ((i=stream_read_uint32(qtmovie->stream)) != 16)
{
DEBUGF("unexpected size in media info\n");
return false;
DEBUGF("unexpected size in media info: %d\n",i);
stream_skip(qtmovie->stream, size_remaining-4);
return true;
}
if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('s','m','h','d'))
{
@ -582,6 +585,7 @@ static bool read_chunk_mdia(qtmovie_t *qtmovie, size_t chunk_len)
default:
DEBUGF("(mdia) unknown chunk id: %c%c%c%c\n",
SPLITFOURCC(sub_chunk_id));
stream_skip(qtmovie->stream, sub_chunk_len - 8);
return false;
}
@ -684,7 +688,7 @@ static bool read_chunk_moov(qtmovie_t *qtmovie, size_t chunk_len)
default:
DEBUGF("(moov) unknown chunk id: %c%c%c%c\n",
SPLITFOURCC(sub_chunk_id));
return false;
stream_skip(qtmovie->stream, sub_chunk_len - 8); /* FIXME not 8 */
}
size_remaining -= sub_chunk_len;

View file

@ -1010,7 +1010,8 @@ static bool get_m4a_metadata(int fd, struct mp3entry* id3)
if (memcmp(&chunk_id,"ftyp",4)==0) {
/* Check for M4A type */
n=read(fd,&chunk_id,4);
if (memcmp(&chunk_id,"M4A ",4)!=0) {
if ((memcmp(&chunk_id,"M4A ",4)!=0) &&
(memcmp(&chunk_id,"mp42",4)!=0)) {
logf("Not an M4A file, aborting\n");
return false;
}