1
0
Fork 0
forked from len0rd/rockbox

Fix a couple of MP4 demuxing problems, preventing playback in a few cases. All my test files now play properly.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12161 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2007-01-30 21:42:36 +00:00
parent ca3b5bb8e4
commit fc1efc7b13
3 changed files with 14 additions and 3 deletions

View file

@ -157,6 +157,12 @@ next_track:
{
ci->advance_buffer(file_offset - ci->curpos);
}
else if (file_offset == 0)
{
LOGF("AAC: get_sample_offset error\n");
err = CODEC_ERROR;
goto done;
}
/* Request the required number of bytes from the input buffer */
buffer=ci->request_buffer(&n,sample_byte_size);

View file

@ -762,7 +762,11 @@ int qtmovie_read(stream_t *file, demux_res_t *demux_res)
read_chunk_mdat(&qtmovie, chunk_len);
/* Keep track of start of stream in file - used for seeking */
qtmovie.res->mdat_offset=stream_tell(qtmovie.stream);
return 1;
/* There can be empty mdats before the real one. If so, skip them */
if (qtmovie.res->mdat_len > 0) {
return 1;
}
break;
/* these following atoms can be skipped !!!! */
case MAKEFOURCC('f','r','e','e'):

View file

@ -199,7 +199,7 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample)
prev_chunk_samples = demux_res->sample_to_chunk[i].num_samples;
}
if (demux_res->num_sample_to_chunks > 1)
if (sample >= demux_res->sample_to_chunk[0].num_samples)
{
chunk = prev_chunk + (sample - total_samples) / prev_chunk_samples;
}
@ -223,7 +223,8 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample)
file_offset = demux_res->chunk_offset[chunk - 1];
}
if (chunk_sample > sample) {
if (chunk_sample > sample)
{
return 0;
}