diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-01-19 16:59:13 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-01-19 16:59:13 +0000 |
| commit | de2710c20915d0b4c8484b6b0df265517b4f07cd (patch) | |
| tree | 6bef27c1dcd634607436efc7cad56c9a51d0cc0e /src | |
| parent | a69acdd27031d056f209740f5350964cb573feef (diff) | |
| download | qmmp-de2710c20915d0b4c8484b6b0df265517b4f07cd.tar.gz qmmp-de2710c20915d0b4c8484b6b0df265517b4f07cd.tar.bz2 qmmp-de2710c20915d0b4c8484b6b0df265517b4f07cd.zip | |
fixed seek functions again
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1512 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.cpp | 2 | ||||
| -rw-r--r-- | src/qmmp/qmmpaudioengine.cpp | 7 | ||||
| -rw-r--r-- | src/qmmp/recycler.cpp | 17 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp index 071fd469f..7ae79a580 100644 --- a/src/plugins/Input/mad/decoder_mad.cpp +++ b/src/plugins/Input/mad/decoder_mad.cpp @@ -364,7 +364,7 @@ void DecoderMAD::seek(qint64 pos) stream.sync = 0; m_input_bytes = 0; stream.next_frame = 0; - m_skip_frames = 3; + m_skip_frames = 2; } } diff --git a/src/qmmp/qmmpaudioengine.cpp b/src/qmmp/qmmpaudioengine.cpp index 75cc1ca83..d09f52c3e 100644 --- a/src/qmmp/qmmpaudioengine.cpp +++ b/src/qmmp/qmmpaudioengine.cpp @@ -368,9 +368,9 @@ void QmmpAudioEngine::run() m_decoder->seek(m_seekTime); m_seekTime = -1; m_output->recycler()->mutex()->lock (); - while(m_output->recycler()->used() > 1) - m_output->recycler()->done(); + m_output->recycler()->clear(); m_output->recycler()->mutex()->unlock (); + m_output_at = 0; } len = m_decoder->read((char *)(m_output_buf + m_output_at), @@ -484,8 +484,7 @@ void QmmpAudioEngine::flush(bool final) m_output->recycler()->mutex()->lock (); if(m_seekTime >= 0) { - while(m_output->recycler()->used() > 1) - m_output->recycler()->done(); + m_output->recycler()->clear(); m_output->recycler()->mutex()->unlock (); m_output_at = 0; break; diff --git a/src/qmmp/recycler.cpp b/src/qmmp/recycler.cpp index a47b4f9c9..beda5051b 100644 --- a/src/qmmp/recycler.cpp +++ b/src/qmmp/recycler.cpp @@ -7,8 +7,8 @@ #include "recycler.h" #include "buffer.h" -Recycler::Recycler ( unsigned int sz ) - : add_index ( 0 ), done_index ( 0 ), current_count ( 0 ) +Recycler::Recycler (unsigned int sz) + : add_index (0), done_index (0), current_count (0) { buffer_count = sz / QMMP_BLOCK_SIZE; if (buffer_count < 4) @@ -18,7 +18,7 @@ Recycler::Recycler ( unsigned int sz ) buffers = new Buffer*[buffer_count]; - for ( unsigned int i = 0; i < buffer_count; i ++ ) + for (unsigned int i = 0; i < buffer_count; i++) { buffers[i] = new Buffer; } @@ -27,7 +27,7 @@ Recycler::Recycler ( unsigned int sz ) Recycler::~Recycler() { - for ( unsigned int i = 0; i < buffer_count; i++ ) + for (unsigned int i = 0; i < buffer_count; i++) { delete buffers[i]; buffers[i] = 0; @@ -77,21 +77,22 @@ void Recycler::add() Buffer *Recycler::next() { - return empty() ? 0 : buffers[done_index]; + return !current_count ? 0 : buffers[done_index]; } void Recycler::done() { + if (!current_count) + return; done_index = ++done_index % buffer_count; - if (current_count) - current_count--; + current_count--; } void Recycler::clear() { - add_index = done_index = current_count = 0; + add_index = current_count = 0; } |
