forked from len0rd/rockbox
Make the AAC (and ALAC) codec more flexible when dealing with the MP4 file structure. Should fix some podcasts that don't play.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11680 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b774bae5fd
commit
7aab5302ac
1 changed files with 33 additions and 32 deletions
|
|
@ -525,8 +525,8 @@ static bool read_chunk_stbl(qtmovie_t *qtmovie, size_t chunk_len)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DEBUGF("(stbl) unknown chunk id: %c%c%c%c\n",
|
/*DEBUGF("(stbl) unknown chunk id: %c%c%c%c\n",
|
||||||
SPLITFOURCC(sub_chunk_id));
|
SPLITFOURCC(sub_chunk_id));*/
|
||||||
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -537,57 +537,58 @@ static bool read_chunk_stbl(qtmovie_t *qtmovie, size_t chunk_len)
|
||||||
|
|
||||||
static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len)
|
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;
|
size_t size_remaining = chunk_len - 8;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
/**** SOUND HEADER CHUNK ****/
|
/* Check for smhd, only kind of minf we care about */
|
||||||
if ((i=stream_read_uint32(qtmovie->stream)) != 16)
|
|
||||||
|
if ((i = stream_read_uint32(qtmovie->stream)) != 16)
|
||||||
{
|
{
|
||||||
DEBUGF("unexpected size in media info: %d\n",i);
|
DEBUGF("unexpected size in media info: %d\n",i);
|
||||||
stream_skip(qtmovie->stream, size_remaining-4);
|
stream_skip(qtmovie->stream, size_remaining-4);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('s','m','h','d'))
|
if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('s','m','h','d'))
|
||||||
{
|
{
|
||||||
DEBUGF("not a sound header! can't handle this.\n");
|
DEBUGF("not a sound header! can't handle this.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* now skip the rest */
|
|
||||||
|
/* now skip the rest of the atom */
|
||||||
stream_skip(qtmovie->stream, 16 - 8);
|
stream_skip(qtmovie->stream, 16 - 8);
|
||||||
size_remaining -= 16;
|
size_remaining -= 16;
|
||||||
/****/
|
|
||||||
|
|
||||||
/**** DINF CHUNK ****/
|
while (size_remaining)
|
||||||
dinf_size = stream_read_uint32(qtmovie->stream);
|
|
||||||
if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('d','i','n','f'))
|
|
||||||
{
|
{
|
||||||
DEBUGF("expected dinf, didn't get it.\n");
|
size_t sub_chunk_len;
|
||||||
return false;
|
fourcc_t sub_chunk_id;
|
||||||
}
|
|
||||||
/* skip it */
|
|
||||||
stream_skip(qtmovie->stream, dinf_size - 8);
|
|
||||||
size_remaining -= dinf_size;
|
|
||||||
/****/
|
|
||||||
|
|
||||||
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
||||||
|
|
||||||
/**** SAMPLE TABLE ****/
|
if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
|
||||||
stbl_size = stream_read_uint32(qtmovie->stream);
|
{
|
||||||
if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('s','t','b','l'))
|
DEBUGF("strange size (%u) for chunk inside minf\n", sub_chunk_len);
|
||||||
{
|
return false;
|
||||||
DEBUGF("expected stbl, didn't get it.\n");
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!read_chunk_stbl(qtmovie, stbl_size)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_remaining -= stbl_size;
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
||||||
|
|
||||||
|
switch (sub_chunk_id)
|
||||||
|
{
|
||||||
|
case MAKEFOURCC('s','t','b','l'):
|
||||||
|
if (!read_chunk_stbl(qtmovie, sub_chunk_len)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/*DEBUGF("(minf) unknown chunk id: %c%c%c%c\n",
|
||||||
|
SPLITFOURCC(sub_chunk_id));*/
|
||||||
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (size_remaining)
|
size_remaining -= sub_chunk_len;
|
||||||
{
|
|
||||||
DEBUGF("oops\n");
|
|
||||||
stream_skip(qtmovie->stream, size_remaining);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue