aboutsummaryrefslogtreecommitdiffstats
path: root/src/audiofile_decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audiofile_decode.c')
-rw-r--r--src/audiofile_decode.c26
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) {