diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-07 22:43:26 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-07 22:43:26 +0000 |
| commit | 0b46e2db06ec1bbfc3aee819787386ace9dad66c (patch) | |
| tree | 109f4bbf3a7227262a280f00731f0767d331a811 /src/plugins/Input/mad | |
| parent | 5896c5ae40726637cbfc5605f5f659791ff569c7 (diff) | |
| download | qmmp-0b46e2db06ec1bbfc3aee819787386ace9dad66c.tar.gz qmmp-0b46e2db06ec1bbfc3aee819787386ace9dad66c.tar.bz2 qmmp-0b46e2db06ec1bbfc3aee819787386ace9dad66c.zip | |
improved seeking accuracy
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@827 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/mad')
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.cpp | 18 | ||||
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.h | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp index b4ff243ae..2bda8322b 100644 --- a/src/plugins/Input/mad/decoder_mad.cpp +++ b/src/plugins/Input/mad/decoder_mad.cpp @@ -31,7 +31,7 @@ DecoderMAD::DecoderMAD(QObject *parent, DecoderFactory *d, QIODevice *i, Output derror = false; eof = false; useeq = false; - totalTime = 0.; + m_totalTime = 0.; seekTime = -1.; channels = 0; bks = 0; @@ -77,7 +77,7 @@ bool DecoderMAD::initialize() m_finish = false; derror = false; eof = false; - totalTime = 0.; + m_totalTime = 0.; seekTime = -1.; channels = 0; bitrate = 0; @@ -153,7 +153,7 @@ void DecoderMAD::deinit() derror = false; eof = false; useeq = false; - totalTime = 0.; + m_totalTime = 0.; seekTime = -1.; channels = 0; bks = 0; @@ -327,8 +327,8 @@ bool DecoderMAD::findHeader() duration = header.duration; } - totalTime = mad_timer_count(duration, MAD_UNITS_SECONDS); - qDebug ("DecoderMAD: Total time: %ld", long(totalTime)); + m_totalTime = mad_timer_count(duration, MAD_UNITS_MILLISECONDS); + qDebug ("DecoderMAD: Total time: %ld", long(m_totalTime)); freq = header.samplerate; channels = MAD_NCHANNELS(&header); bitrate = header.bitrate / 1000; @@ -338,11 +338,11 @@ bool DecoderMAD::findHeader() return TRUE; } -qint64 DecoderMAD::lengthInSeconds() +qint64 DecoderMAD::totalTime() { if (! inited) return 0.; - return totalTime; + return m_totalTime; } void DecoderMAD::seek(qint64 pos) @@ -410,9 +410,9 @@ void DecoderMAD::run() { mutex()->lock(); - if (seekTime >= 0.0 && totalTime > 0) + if (seekTime >= 0.0 && m_totalTime > 0) { - long seek_pos = long(seekTime * input()->size() / totalTime); + long seek_pos = long(seekTime * input()->size() / m_totalTime); input()->seek(seek_pos); output_size = long(seekTime) * long(freq * channels * 16 / 2); mad_frame_mute(&frame); diff --git a/src/plugins/Input/mad/decoder_mad.h b/src/plugins/Input/mad/decoder_mad.h index 5e1b72877..6fb6f2a40 100644 --- a/src/plugins/Input/mad/decoder_mad.h +++ b/src/plugins/Input/mad/decoder_mad.h @@ -27,7 +27,7 @@ public: // standard decoder API bool initialize(); - qint64 lengthInSeconds(); + qint64 totalTime(); void seek(qint64); void stop(); @@ -45,7 +45,7 @@ private: bool findXingHeader(struct mad_bitptr, unsigned int); uint findID3v2(uchar *data, ulong size); bool inited, user_stop, done, m_finish, derror, eof, useeq; - qint64 totalTime, seekTime; + qint64 m_totalTime, seekTime; int channels; unsigned long bitrate; long freq, len; |
