diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-05 13:06:31 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-05 13:06:31 +0000 |
commit | 1cf07bfa40183177b4171cb677f6edff6515b35f (patch) | |
tree | 2409044e8ab2f05870792a7906cd1f4b411be83e | |
parent | 170824db8c3f97ef6b5c1dbf8a527199acf0bb88 (diff) | |
download | mpd-1cf07bfa40183177b4171cb677f6edff6515b35f.tar.gz mpd-1cf07bfa40183177b4171cb677f6edff6515b35f.tar.xz mpd-1cf07bfa40183177b4171cb677f6edff6515b35f.zip |
skip over all bad frames
git-svn-id: https://svn.musicpd.org/mpd/trunk@203 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/mp3_decode.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mp3_decode.c b/src/mp3_decode.c index 790f9db46..b041da3b9 100644 --- a/src/mp3_decode.c +++ b/src/mp3_decode.c @@ -424,6 +424,7 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) { static int i; static int ret; static struct audio_dither dither; + static int skip; if(data->currentFrame>=data->highestFrame && data->highestFrame<data->maxFrames) @@ -501,15 +502,18 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) { } } - if(data->muteFrame) { - while((ret=decodeNextFrameHeader(data))==DECODE_CONT || - ret==DECODE_SKIP); - } - else { - while((ret=decodeNextFrame(data))==DECODE_CONT || - ret==DECODE_SKIP); + while(1) { + skip = 0; + 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; } - + return ret; } |