diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-05-07 19:35:39 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-05-07 19:35:39 +0000 |
commit | ff3323334aa3e140584d2a8aecf4f092dfb13bb2 (patch) | |
tree | df750d7d2c88f9e707dd392db8527ea3a8684c00 /src/mp4_decode.c | |
parent | c9f0d22f0ac19dcee7d1991020c75c8a3691b1b7 (diff) | |
download | mpd-ff3323334aa3e140584d2a8aecf4f092dfb13bb2.tar.gz mpd-ff3323334aa3e140584d2a8aecf4f092dfb13bb2.tar.xz mpd-ff3323334aa3e140584d2a8aecf4f092dfb13bb2.zip |
implement new outputBuffering stuff for rest of decoders
git-svn-id: https://svn.musicpd.org/mpd/trunk@942 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/mp4_decode.c')
-rw-r--r-- | src/mp4_decode.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/src/mp4_decode.c b/src/mp4_decode.c index e1faff837..7f0825ff0 100644 --- a/src/mp4_decode.c +++ b/src/mp4_decode.c @@ -280,41 +280,16 @@ int mp4_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) { sampleBuffer+=offset*channels*2; - while(sampleBufferLen>0 && !dc->seek) { - size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ? - CHUNK_SIZE-chunkLen: - sampleBufferLen; - while(cb->begin==cb->end && cb->wrap && - !dc->stop && !dc->seek) - { - my_usleep(10000); - } - if(dc->stop) { - eof = 1; - break; - } - else if(!dc->seek) { - sampleBufferLen-=size; - memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen, - sampleBuffer,size); - cb->times[cb->end] = time; - cb->bitRate[cb->end] = bitRate; - sampleBuffer+=size; - chunkLen+=size; - if(chunkLen>=CHUNK_SIZE) { - cb->chunkSize[cb->end] = CHUNK_SIZE; - ++cb->end; - - if(cb->end>=buffered_chunks) { - cb->end = 0; - cb->wrap = 1; - } - chunkLen = 0; - } - } + sendDataToOutputBuffer(cb,dc,sampleBuffer, + sampleBufferLen,time,bitRate); + if(dc->stop) { + eof = 1; + break; } } + flushOutputBuffer(cb); + free(seekTable); faacDecClose(decoder); mp4ff_close(mp4fh); |