aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/Input/mad/decoder_mad.cpp15
-rw-r--r--src/plugins/Input/mad/decoder_mad.h2
-rw-r--r--src/plugins/Input/vorbis/decoder_vorbis.cpp5
-rw-r--r--src/qmmp/soundcore.cpp1
4 files changed, 12 insertions, 11 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;
diff --git a/src/qmmp/soundcore.cpp b/src/qmmp/soundcore.cpp
index 0684fec42..44dbac11f 100644
--- a/src/qmmp/soundcore.cpp
+++ b/src/qmmp/soundcore.cpp
@@ -84,7 +84,6 @@ bool SoundCore::play(const QString &source)
m_decoder->clearNextUrl();
return TRUE;
}
- qDebug("stop!");
stop();
m_source = source;