git-svn-id: https://svn.musicpd.org/mpd/trunk@319 09075e82-0dd4-0310-85a5-a0d7c8717e4f

This commit is contained in:
Warren Dukes 2004-03-20 01:34:25 +00:00
parent 61b9e2fc47
commit ffd0ccfc3b
1 changed files with 12 additions and 4 deletions

View File

@ -189,7 +189,6 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
dur = mp4ff_get_sample_duration(mp4fh,track,sampleId); dur = mp4ff_get_sample_duration(mp4fh,track,sampleId);
offset = mp4ff_get_sample_offset(mp4fh,track,sampleId); offset = mp4ff_get_sample_offset(mp4fh,track,sampleId);
dur-=offset;
if(sampleId>seekTableEnd) { if(sampleId>seekTableEnd) {
seekTable[sampleId] = time; seekTable[sampleId] = time;
@ -197,6 +196,8 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
} }
if(sampleId==0) dur = 0; if(sampleId==0) dur = 0;
if(offset>dur) dur = 0;
else dur-=offset;
time+=((float)dur)/scale; time+=((float)dur)/scale;
if(dc->seek && time>dc->seekWhere) seekPositionFound = 1; if(dc->seek && time>dc->seekWhere) seekPositionFound = 1;
@ -221,6 +222,16 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBuffer = faacDecDecode(decoder,&frameInfo,mp4Buffer, sampleBuffer = faacDecDecode(decoder,&frameInfo,mp4Buffer,
mp4BufferSize); mp4BufferSize);
if(mp4Buffer) free(mp4Buffer); if(mp4Buffer) free(mp4Buffer);
if(frameInfo.error > 0) {
eof = 1;
break;
}
if(dur+offset > frameInfo.samples) {
dur = frameInfo.samples;
offset = 0;
}
sampleCount = (unsigned long)(dur*channels); sampleCount = (unsigned long)(dur*channels);
if(sampleCount>0) initial =0; if(sampleCount>0) initial =0;
@ -228,9 +239,6 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBuffer+=offset*channels*2; sampleBuffer+=offset*channels*2;
printf("dur=%li offset=%li frameInfo.samples=%li\n",dur,offset,
frameInfo.samples);
while(sampleBufferLen>0 && !dc->seek) { while(sampleBufferLen>0 && !dc->seek) {
size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ? size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ?
CHUNK_SIZE-chunkLen: CHUNK_SIZE-chunkLen: