aboutsummaryrefslogtreecommitdiffstats
path: root/src/aac_decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-07 19:35:39 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-07 19:35:39 +0000
commitff3323334aa3e140584d2a8aecf4f092dfb13bb2 (patch)
treedf750d7d2c88f9e707dd392db8527ea3a8684c00 /src/aac_decode.c
parentc9f0d22f0ac19dcee7d1991020c75c8a3691b1b7 (diff)
downloadmpd-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/aac_decode.c')
-rw-r--r--src/aac_decode.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/src/aac_decode.c b/src/aac_decode.c
index 42da876be..24171adb7 100644
--- a/src/aac_decode.c
+++ b/src/aac_decode.c
@@ -27,6 +27,7 @@
#include "audio.h"
#include "log.h"
#include "inputStream.h"
+#include "outputBuffer.h"
#include <stdio.h>
#include <unistd.h>
@@ -361,45 +362,20 @@ int aac_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBufferLen = sampleCount*2;
- while(sampleBufferLen>0) {
- 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->seek) {
- dc->seekError = 1;
- dc->seek = 0;
- }
- else if(dc->stop) {
- eof = 1;
- break;
- }
- else {
- 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->seek) {
+ dc->seekError = 1;
+ dc->seek = 0;
+ }
+ else if(dc->stop) {
+ eof = 1;
+ break;
}
} while (!eof);
+ flushOutputBuffer(cb);
+
faacDecClose(decoder);
closeInputStream(b.inStream);
if(b.buffer) free(b.buffer);