aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/mad/decoder_mad.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-03-24 14:56:00 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-03-24 14:56:00 +0000
commit14193841a9706b77af36937d4c895bb4f253d142 (patch)
tree492c28cc1b0b2acc74cd4f874ff0ef45b21e4fc3 /src/plugins/Input/mad/decoder_mad.cpp
parenta75f4d3cb39bbe832086acb494aaf2320a02b2c6 (diff)
downloadqmmp-14193841a9706b77af36937d4c895bb4f253d142.tar.gz
qmmp-14193841a9706b77af36937d4c895bb4f253d142.tar.bz2
qmmp-14193841a9706b77af36937d4c895bb4f253d142.zip
faster mp3 seeking
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@877 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/mad/decoder_mad.cpp')
-rw-r--r--src/plugins/Input/mad/decoder_mad.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp
index 2bda8322b..095d80371 100644
--- a/src/plugins/Input/mad/decoder_mad.cpp
+++ b/src/plugins/Input/mad/decoder_mad.cpp
@@ -359,7 +359,7 @@ void DecoderMAD::flush(bool final)
{
ulong min = final ? 0 : bks;
- while ((! done && ! m_finish) && output_bytes > min)
+ while ((! done && ! m_finish) && output_bytes > min && seekTime == -1.)
{
output()->recycler()->mutex()->lock();
@@ -425,19 +425,20 @@ void DecoderMAD::run()
stream.next_frame = 0;
skip_frames = 2;
eof = false;
+ seekTime = -1;
}
m_finish = eof;
if (! eof)
{
- if (stream.next_frame && seekTime == -1.)
+ if (stream.next_frame)
{
input_bytes = &input_buf[input_bytes] - (char *) stream.next_frame;
memmove(input_buf, stream.next_frame, input_bytes);
}
- if (input_bytes < globalBufferSize && seekTime == -1.)
+ if (input_bytes < globalBufferSize)
{
int len = input()->read((char *) input_buf + input_bytes,
globalBufferSize - input_bytes);
@@ -458,12 +459,10 @@ void DecoderMAD::run()
mad_stream_buffer(&stream, (unsigned char *) input_buf, input_bytes);
}
- seekTime = -1.;
-
mutex()->unlock();
// decode
- while (!done && !m_finish && !derror)
+ while (!done && !m_finish && !derror && seekTime == -1.)
{
if (mad_frame_decode(&frame, &stream) == -1)
{