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
This commit is contained in:
parent
e40d39b05e
commit
aea1ae9b9e
@ -137,7 +137,6 @@ typedef struct _mp3DecodeData {
|
|||||||
int flush;
|
int flush;
|
||||||
unsigned long bitRate;
|
unsigned long bitRate;
|
||||||
InputStream * inStream;
|
InputStream * inStream;
|
||||||
int bufferReset;
|
|
||||||
} mp3DecodeData;
|
} mp3DecodeData;
|
||||||
|
|
||||||
void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
|
void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
|
||||||
@ -151,7 +150,6 @@ void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
|
|||||||
data->currentFrame = 0;
|
data->currentFrame = 0;
|
||||||
data->flush = 1;
|
data->flush = 1;
|
||||||
data->inStream = inStream;
|
data->inStream = inStream;
|
||||||
data->bufferReset = 0;
|
|
||||||
|
|
||||||
mad_stream_init(&data->stream);
|
mad_stream_init(&data->stream);
|
||||||
data->stream.options |= MAD_OPTION_IGNORECRC;
|
data->stream.options |= MAD_OPTION_IGNORECRC;
|
||||||
@ -164,7 +162,9 @@ int seekMp3InputBuffer(mp3DecodeData * data, long offset) {
|
|||||||
if(seekInputStream(data->inStream,offset,SEEK_SET) < 0) {
|
if(seekInputStream(data->inStream,offset,SEEK_SET) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
data->bufferReset = 1;
|
|
||||||
|
mad_stream_buffer(&data->stream,data->readBuffer,0);
|
||||||
|
(data->stream).error = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ int fillMp3InputBuffer(mp3DecodeData * data) {
|
|||||||
size_t readed;
|
size_t readed;
|
||||||
unsigned char * readStart;
|
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;
|
remaining = (data->stream).bufend-(data->stream).next_frame;
|
||||||
memmove(data->readBuffer,(data->stream).next_frame,remaining);
|
memmove(data->readBuffer,(data->stream).next_frame,remaining);
|
||||||
readStart = (data->readBuffer)+remaining;
|
readStart = (data->readBuffer)+remaining;
|
||||||
@ -185,7 +185,6 @@ int fillMp3InputBuffer(mp3DecodeData * data) {
|
|||||||
readSize = READ_BUFFER_SIZE;
|
readSize = READ_BUFFER_SIZE;
|
||||||
readStart = data->readBuffer,
|
readStart = data->readBuffer,
|
||||||
remaining = 0;
|
remaining = 0;
|
||||||
data->bufferReset = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readed = readFromInputStream(data->inStream, readStart, (size_t)1,
|
readed = readFromInputStream(data->inStream, readStart, (size_t)1,
|
||||||
@ -466,6 +465,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
break;
|
break;
|
||||||
case MUTEFRAME_SEEK:
|
case MUTEFRAME_SEEK:
|
||||||
if(dc->seekWhere<=data->elapsedTime) {
|
if(dc->seekWhere<=data->elapsedTime) {
|
||||||
|
data->outputPtr = data->outputBuffer;
|
||||||
clearOutputBuffer(cb);
|
clearOutputBuffer(cb);
|
||||||
dc->seekChunk = cb->end;
|
dc->seekChunk = cb->end;
|
||||||
data->muteFrame = 0;
|
data->muteFrame = 0;
|
||||||
@ -522,6 +522,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
if(seekMp3InputBuffer(data,
|
if(seekMp3InputBuffer(data,
|
||||||
data->frameOffset[i]) == 0)
|
data->frameOffset[i]) == 0)
|
||||||
{
|
{
|
||||||
|
data->outputPtr = data->outputBuffer;
|
||||||
clearOutputBuffer(cb);
|
clearOutputBuffer(cb);
|
||||||
dc->seekChunk = cb->end;
|
dc->seekChunk = cb->end;
|
||||||
data->currentFrame = i;
|
data->currentFrame = i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user