aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-20 12:11:28 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-20 12:11:28 +0000
commitaea1ae9b9ec6d2e8d00d11ee59047a8e71afe123 (patch)
treea2881aff2096e87878cfa32deec863803a150c64
parente40d39b05eaf8b32aee3454495b527c1e60470d5 (diff)
downloadmpd-aea1ae9b9ec6d2e8d00d11ee59047a8e71afe123.tar.gz
mpd-aea1ae9b9ec6d2e8d00d11ee59047a8e71afe123.tar.xz
mpd-aea1ae9b9ec6d2e8d00d11ee59047a8e71afe123.zip
forgot to clear the mad_stream buffer when doing a seek
git-svn-id: https://svn.musicpd.org/mpd/trunk@1115 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--src/mp3_decode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index 9fd67ca1a..716ad70a2 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -137,7 +137,6 @@ typedef struct _mp3DecodeData {
int flush;
unsigned long bitRate;
InputStream * inStream;
- int bufferReset;
} mp3DecodeData;
void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
@@ -151,7 +150,6 @@ void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
data->currentFrame = 0;
data->flush = 1;
data->inStream = inStream;
- data->bufferReset = 0;
mad_stream_init(&data->stream);
data->stream.options |= MAD_OPTION_IGNORECRC;
@@ -164,7 +162,9 @@ int seekMp3InputBuffer(mp3DecodeData * data, long offset) {
if(seekInputStream(data->inStream,offset,SEEK_SET) < 0) {
return -1;
}
- data->bufferReset = 1;
+
+ mad_stream_buffer(&data->stream,data->readBuffer,0);
+ (data->stream).error = 0;
return 0;
}
@@ -175,7 +175,7 @@ int fillMp3InputBuffer(mp3DecodeData * data) {
size_t readed;
unsigned char * readStart;
- if(!data->bufferReset && (data->stream).next_frame!=NULL) {
+ if((data->stream).next_frame!=NULL) {
remaining = (data->stream).bufend-(data->stream).next_frame;
memmove(data->readBuffer,(data->stream).next_frame,remaining);
readStart = (data->readBuffer)+remaining;
@@ -185,7 +185,6 @@ int fillMp3InputBuffer(mp3DecodeData * data) {
readSize = READ_BUFFER_SIZE;
readStart = data->readBuffer,
remaining = 0;
- data->bufferReset = 0;
}
readed = readFromInputStream(data->inStream, readStart, (size_t)1,
@@ -466,6 +465,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
break;
case MUTEFRAME_SEEK:
if(dc->seekWhere<=data->elapsedTime) {
+ data->outputPtr = data->outputBuffer;
clearOutputBuffer(cb);
dc->seekChunk = cb->end;
data->muteFrame = 0;
@@ -522,6 +522,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
if(seekMp3InputBuffer(data,
data->frameOffset[i]) == 0)
{
+ data->outputPtr = data->outputBuffer;
clearOutputBuffer(cb);
dc->seekChunk = cb->end;
data->currentFrame = i;