aboutsummaryrefslogtreecommitdiffstats
path: root/src/flac_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/flac_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 '')
-rw-r--r--src/flac_decode.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/flac_decode.c b/src/flac_decode.c
index ee9255efe..b8d768428 100644
--- a/src/flac_decode.c
+++ b/src/flac_decode.c
@@ -24,6 +24,7 @@
#include "log.h"
#include "pcm_utils.h"
#include "inputStream.h"
+#include "outputBuffer.h"
#include <stdio.h>
#include <string.h>
@@ -159,7 +160,10 @@ void flacPlayFile(char *file, OutputBuffer * cb, AudioFormat * af,
}
FLAC__seekable_stream_decoder_delete(flacDec);
/* send last little bit */
- if(data.chunk_length>0 && !dc->stop) flacSendChunk(&data);
+ if(data.chunk_length>0 && !dc->stop) {
+ flacSendChunk(&data);
+ flushOutputBuffer(data.cb);
+ }
}
FLAC__SeekableStreamDecoderReadStatus flacRead(
@@ -279,25 +283,13 @@ void flacMetadata(const FLAC__SeekableStreamDecoder *dec,
}
int flacSendChunk(FlacData * data) {
- while(data->cb->begin==data->cb->end && data->cb->wrap &&
- !data->dc->stop && !data->dc->seek)
+ switch(sendDataToOutputBuffer(data->cb,data->dc,data->chunk,
+ data->chunk_length,data->time,data->bitRate))
{
- my_usleep(10000);
- }
-
- if(data->dc->stop) return -1;
- if(data->dc->seek) return 0;
-
- memcpy(data->cb->chunks+data->cb->end*CHUNK_SIZE,data->chunk,
- CHUNK_SIZE);
- data->cb->chunkSize[data->cb->end] = data->chunk_length;
- data->cb->times[data->cb->end] = data->time;
- data->cb->bitRate[data->cb->end] = data->bitRate;
-
- data->cb->end++;
- if(data->cb->end>=buffered_chunks) {
- data->cb->end = 0;
- data->cb->wrap = 1;
+ case OUTPUT_BUFFER_DC_STOP:
+ return -1;
+ default:
+ return 0;
}
return 0;