aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp3_decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-07 19:11:43 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-07 19:11:43 +0000
commitc9f0d22f0ac19dcee7d1991020c75c8a3691b1b7 (patch)
tree9a7a1f0877821c01c808b6e65420e833fa31f263 /src/mp3_decode.c
parent3794126e5609112d68a2e0c9cbae5a923da301b6 (diff)
downloadmpd-c9f0d22f0ac19dcee7d1991020c75c8a3691b1b7.tar.gz
mpd-c9f0d22f0ac19dcee7d1991020c75c8a3691b1b7.tar.xz
mpd-c9f0d22f0ac19dcee7d1991020c75c8a3691b1b7.zip
rewrite outputBuffer'ing abstraction a bit to be more effecient and easier
to interface. Also, use outputBuffer abstraction for ogg git-svn-id: https://svn.musicpd.org/mpd/trunk@941 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/mp3_decode.c')
-rw-r--r--src/mp3_decode.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index 973f96541..d3a6a592e 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -468,21 +468,15 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
if(data->outputPtr==data->outputBufferEnd) {
ret = sendDataToOutputBuffer(cb,dc,
- 0,data->outputBuffer,
+ data->outputBuffer,
MP3_DATA_OUTPUT_BUFFER_SIZE,
data->elapsedTime,
data->bitRate/1000);
if(ret == OUTPUT_BUFFER_DC_STOP) {
return DECODE_BREAK;
}
- if(ret >= 0) {
- memmove(data->outputBuffer,
- data->outputBuffer+ret,
- MP3_DATA_OUTPUT_BUFFER_SIZE-
- ret);
- data->outputPtr-=ret;
- }
- else data->outputPtr = data->outputBuffer;
+
+ data->outputPtr = data->outputBuffer;
if(ret == OUTPUT_BUFFER_DC_SEEK) break;
}
@@ -545,9 +539,12 @@ int mp3_decode(OutputBuffer * cb, AudioFormat * af, DecoderControl * dc) {
while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
/* send last little bit if not dc->stop */
if(data.outputPtr!=data.outputBuffer && data.flush) {
- sendDataToOutputBuffer(cb,dc,1,data.outputBuffer,
+ if(sendDataToOutputBuffer(cb,dc,data.outputBuffer,
data.outputPtr-data.outputBuffer,
- data.elapsedTime,data.bitRate/1000);
+ data.elapsedTime,data.bitRate/1000) == 0)
+ {
+ flushOutputBuffer(cb);
+ }
}
mp3DecodeDataFinalize(&data);