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/audiofile_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/audiofile_decode.c')
-rw-r--r-- | src/audiofile_decode.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/audiofile_decode.c b/src/audiofile_decode.c index 9a5103716..f3e88395b 100644 --- a/src/audiofile_decode.c +++ b/src/audiofile_decode.c @@ -109,30 +109,18 @@ int audiofile_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) ret = afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk, CHUNK_SIZE/fs); if(ret<=0) eof = 1; else { - while(cb->begin==cb->end && cb->wrap && - !dc->stop && !dc->seek){ - my_usleep(10000); - } + current += ret; + sendDataToOutputBuffer(cb,dc,chunk,ret*fs, + (float)current / + (float)af->sampleRate, + bitRate); if(dc->stop) break; else if(dc->seek) continue; - - memcpy(cb->chunks+cb->end*CHUNK_SIZE,chunk, - CHUNK_SIZE); - cb->chunkSize[cb->end] = CHUNK_SIZE; - - current += ret; - cb->times[cb->end] = (float)current/(float)af->sampleRate; - cb->bitRate[cb->end] = bitRate; - - ++cb->end; - - if(cb->end>=buffered_chunks) { - cb->end = 0; - cb->wrap = 1; - } } } + flushOutputBuffer(cb); + if(dc->seek) dc->seek = 0; if(dc->stop) { |