aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp3_decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-30 13:33:13 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-30 13:33:13 +0000
commitd80093fed6c084e38a4c3808e62649bd723adc5b (patch)
treec44e0ba8d87662d78e8e0ad1b9b90a174aee02fb /src/mp3_decode.c
parentc4396a6be687907583972cb64c42a2923a5bf5c9 (diff)
downloadmpd-d80093fed6c084e38a4c3808e62649bd723adc5b.tar.gz
mpd-d80093fed6c084e38a4c3808e62649bd723adc5b.tar.xz
mpd-d80093fed6c084e38a4c3808e62649bd723adc5b.zip
fixed seek, its now blocking again
git-svn-id: https://svn.musicpd.org/mpd/trunk@1237 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/mp3_decode.c')
-rw-r--r--src/mp3_decode.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index 1e309bd79..467a656df 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -468,7 +468,6 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
if(dc->seekWhere<=data->elapsedTime) {
data->outputPtr = data->outputBuffer;
clearOutputBuffer(cb);
- dc->seekChunk = cb->end;
data->muteFrame = 0;
dc->seek = 0;
}
@@ -528,26 +527,29 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
{
data->outputPtr = data->outputBuffer;
clearOutputBuffer(cb);
- dc->seekChunk = cb->end;
data->currentFrame = i;
}
+ else dc->seekError = 1;
data->muteFrame = 0;
dc->seek = 0;
}
}
- else if(dc->seek && !data->inStream->seekable) dc->seek = 0;
+ else if(dc->seek && !data->inStream->seekable) {
+ dc->seek = 0;
+ dc->seekError = 1;
+ }
}
while(1) {
skip = 0;
while((ret = decodeNextFrameHeader(data))==DECODE_CONT &&
- !dc->stop);
- if(ret==DECODE_SKIP) skip = 1;
- else if(ret==DECODE_BREAK || dc->stop) break;
+ !dc->stop && !dc->seek);
+ if(ret==DECODE_BREAK || dc->stop || dc->seek) break;
+ else if(ret==DECODE_SKIP) skip = 1;
if(!data->muteFrame) {
while((ret = decodeNextFrame(data))==DECODE_CONT &&
- !dc->stop);
- if(ret==DECODE_BREAK || dc->stop) break;
+ !dc->stop && !dc->seek);
+ if(ret==DECODE_BREAK || dc->stop || dc->seek) break;
}
if(!skip && ret==DECODE_OK) break;
}
@@ -590,17 +592,20 @@ int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream,
while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
/* send last little bit if not dc->stop */
if(data.outputPtr!=data.outputBuffer && data.flush) {
- if(sendDataToOutputBuffer(cb,NULL,dc,0,data.outputBuffer,
+ sendDataToOutputBuffer(cb, NULL, dc,
+ data.inStream->seekable,
+ data.outputBuffer,
data.outputPtr-data.outputBuffer,
- data.elapsedTime,data.bitRate/1000) == 0)
- {
- flushOutputBuffer(cb);
- }
+ data.elapsedTime,data.bitRate/1000);
}
+ flushOutputBuffer(cb);
mp3DecodeDataFinalize(&data);
- if(dc->seek) dc->seek = 0;
+ /*if(dc->seek) {
+ dc->seekError = 1;
+ dc->seek = 0;
+ }*/
if(dc->stop) {
dc->state = DECODE_STATE_STOP;