diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.cpp | 15 | ||||
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.h | 2 | ||||
| -rw-r--r-- | src/plugins/Input/vorbis/decoder_vorbis.cpp | 5 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp index d2a5f7d3c..5685da28a 100644 --- a/src/plugins/Input/mad/decoder_mad.cpp +++ b/src/plugins/Input/mad/decoder_mad.cpp @@ -35,6 +35,7 @@ DecoderMAD::DecoderMAD(QObject *parent, DecoderFactory *d, QIODevice *i, Output m_output_bytes = 0; m_output_at = 0; m_skip_frames = 0; + m_eof = false; } DecoderMAD::~DecoderMAD() @@ -96,10 +97,9 @@ bool DecoderMAD::initialize() return FALSE; } mad_stream_buffer(&stream, (unsigned char *) m_input_buf, m_input_bytes); - stream.error = MAD_ERROR_NONE; stream.error = MAD_ERROR_BUFLEN; mad_frame_mute (&frame); - stream.next_frame = NULL; + stream.next_frame = 0; stream.sync = 0; configure(m_freq, m_channels, 16); @@ -127,6 +127,7 @@ void DecoderMAD::deinit() m_output_bytes = 0; m_output_at = 0; m_skip_frames = 0; + m_eof = false; } bool DecoderMAD::findXingHeader(struct mad_bitptr ptr, unsigned int bitlen) @@ -317,10 +318,9 @@ qint64 DecoderMAD::readAudio(char *data, qint64 size) { forever { - if(stream.error == MAD_ERROR_BUFLEN || !stream.buffer) + if((stream.error == MAD_ERROR_BUFLEN) || !stream.buffer) { - if(!fillBuffer()) - return 0; + m_eof = !fillBuffer(); } if(mad_frame_decode(&frame, &stream) < 0) { @@ -339,6 +339,8 @@ qint64 DecoderMAD::readAudio(char *data, qint64 size) continue; } case MAD_ERROR_BUFLEN: + if(m_eof) + return 0; continue; default: if (!MAD_RECOVERABLE(stream.error)) @@ -353,6 +355,7 @@ qint64 DecoderMAD::readAudio(char *data, qint64 size) continue; } mad_synth_frame(&synth, &frame); + //stream.error = MAD_ERROR_NONE; return madOutput(data, size); } } @@ -387,7 +390,7 @@ bool DecoderMAD::fillBuffer() } else if(len < 0) { - qWarning("error"); + qWarning("DecoderMAD: error"); return FALSE; } m_input_bytes += len; diff --git a/src/plugins/Input/mad/decoder_mad.h b/src/plugins/Input/mad/decoder_mad.h index f25ad2b80..8e66ac0c4 100644 --- a/src/plugins/Input/mad/decoder_mad.h +++ b/src/plugins/Input/mad/decoder_mad.h @@ -41,7 +41,7 @@ private: bool findHeader(); bool findXingHeader(struct mad_bitptr, unsigned int); uint findID3v2(uchar *data, ulong size); - bool m_inited; + bool m_inited, m_eof; qint64 m_totalTime; int m_channels, m_skip_frames; uint m_bitrate; diff --git a/src/plugins/Input/vorbis/decoder_vorbis.cpp b/src/plugins/Input/vorbis/decoder_vorbis.cpp index fdbfd1432..e1e431f94 100644 --- a/src/plugins/Input/vorbis/decoder_vorbis.cpp +++ b/src/plugins/Input/vorbis/decoder_vorbis.cpp @@ -224,9 +224,8 @@ qint64 DecoderVorbis::readAudio(char *data, qint64 maxSize) { len = -1; while (len < 0) - { - len = ov_read(&oggfile, data, maxSize, 0, 2, 1, &m_section); - } + len = ov_read(&oggfile, data, maxSize, 0, 2, 1, &m_section); + if (m_section != m_last_section) updateTags(); m_last_section = m_section; |
