diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-23 01:12:30 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-23 01:12:30 +0000 |
commit | 0783a2bde14af02c99c7c9fc137b3944bbee14c0 (patch) | |
tree | 9f8a58754aee9505d9dc644ce044515d23b27ea3 /src/aac_decode.c | |
parent | 4b4438853c3ae05392964eadd8962cb50eae7987 (diff) | |
download | mpd-0783a2bde14af02c99c7c9fc137b3944bbee14c0.tar.gz mpd-0783a2bde14af02c99c7c9fc137b3944bbee14c0.tar.xz mpd-0783a2bde14af02c99c7c9fc137b3944bbee14c0.zip |
fix a bug, due to not resetting decodeType in playerSeek when the file to
seek isn't the same as the current playing file
git-svn-id: https://svn.musicpd.org/mpd/trunk@409 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/aac_decode.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/aac_decode.c b/src/aac_decode.c index fe8ede2fd..c4d8dcf4d 100644 --- a/src/aac_decode.c +++ b/src/aac_decode.c @@ -173,7 +173,7 @@ void initAacBuffer(FILE * fp, AacBuffer * b, float * length, if(retFileread) *retFileread = fileread; if(retTagsize) *retTagsize = tagsize; - if(!length) return; + if(length==NULL) return; if((b->buffer[0] == 0xFF) && ((b->buffer[1] & 0xF6) == 0xF0)) { adtsParse(b, length); @@ -308,14 +308,15 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { time = 0.0; advanceAacBuffer(&b,bread); - fillAacBuffer(&b); - do { - if(dc->seek) { - dc->seekError = 1; - dc->seek = 0; + while(!eof) { + fillAacBuffer(&b); + + if(b.bytesIntoBuffer==0) { + eof = 1; + break; } - + sampleBuffer = faacDecDecode(decoder,&frameInfo,b.buffer, b.bytesIntoBuffer); @@ -348,7 +349,7 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { sampleBufferLen = sampleCount*2; - while(sampleBufferLen>0 && !dc->seek) { + while(sampleBufferLen>0) { size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ? CHUNK_SIZE-chunkLen: sampleBufferLen; @@ -357,11 +358,15 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { { usleep(10000); } - if(dc->stop) { + if(dc->seek) { + dc->seekError = 1; + dc->seek = 0; + } + else if(dc->stop) { eof = 1; break; } - else if(!dc->seek) { + else { sampleBufferLen-=size; memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen, sampleBuffer,size); @@ -381,10 +386,6 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) { } } } - - fillAacBuffer(&b); - - if(b.bytesIntoBuffer==0) eof = 1; } while (!eof); faacDecClose(decoder); |