skip over all bad frames

git-svn-id: https://svn.musicpd.org/mpd/trunk@203 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes 2004-03-05 13:06:31 +00:00
parent 170824db8c
commit 1cf07bfa40
1 changed files with 12 additions and 8 deletions

View File

@ -424,6 +424,7 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
static int i; static int i;
static int ret; static int ret;
static struct audio_dither dither; static struct audio_dither dither;
static int skip;
if(data->currentFrame>=data->highestFrame && if(data->currentFrame>=data->highestFrame &&
data->highestFrame<data->maxFrames) data->highestFrame<data->maxFrames)
@ -501,15 +502,18 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
} }
} }
if(data->muteFrame) { while(1) {
while((ret=decodeNextFrameHeader(data))==DECODE_CONT || skip = 0;
ret==DECODE_SKIP); while((ret = decodeNextFrameHeader(data))==DECODE_CONT);
if(ret==DECODE_SKIP) skip = 1;
else if(ret==DECODE_BREAK) return -1;
if(data->muteFrame) {
while((ret = decodeNextFrame(data))==DECODE_CONT);
if(ret==DECODE_BREAK) return -1;
}
if(!skip && ret==DECODE_OK) break;
} }
else {
while((ret=decodeNextFrame(data))==DECODE_CONT ||
ret==DECODE_SKIP);
}
return ret; return ret;
} }