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/decoder_mad.cpp | |
| 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/decoder_mad.cpp')
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.cpp | 18 |
1 files changed, 9 insertions, 9 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); |
