From af96bccf44a68436ea49cfdb940f0500beb64a23 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 4 Feb 2010 21:24:30 +0000 Subject: mad plugin: fixed channel number detection (reported by Grzegorz Gibas) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1548 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/mad/decoder_mad.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/plugins/Input/mad/decoder_mad.cpp') diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp index 7ae79a580..b6d7c3edb 100644 --- a/src/plugins/Input/mad/decoder_mad.cpp +++ b/src/plugins/Input/mad/decoder_mad.cpp @@ -214,11 +214,17 @@ bool DecoderMAD::findHeader() stream.error = MAD_ERROR_NONE; } - if (mad_header_decode(&header, &stream) == -1) + if (mad_header_decode(&header, &stream) < 0) { - if (stream.error == MAD_ERROR_BUFLEN) + if(stream.error == MAD_ERROR_LOSTSYNC) + { + uint tagSize = findID3v2((uchar *)stream.this_frame, + (ulong) (stream.bufend - stream.this_frame)); + if (tagSize > 0) + mad_stream_skip(&stream, tagSize); continue; - else if (MAD_RECOVERABLE(stream.error)) + } + else if (stream.error == MAD_ERROR_BUFLEN || MAD_RECOVERABLE(stream.error)) continue; else { -- cgit v1.2.3-13-gbd6f