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/sndfile | |
| 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/sndfile')
| -rw-r--r-- | src/plugins/Input/sndfile/decoder_sndfile.cpp | 8 | ||||
| -rw-r--r-- | src/plugins/Input/sndfile/decoder_sndfile.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/Input/sndfile/decoder_sndfile.cpp b/src/plugins/Input/sndfile/decoder_sndfile.cpp index 4568a2fd9..9152913fe 100644 --- a/src/plugins/Input/sndfile/decoder_sndfile.cpp +++ b/src/plugins/Input/sndfile/decoder_sndfile.cpp @@ -133,9 +133,9 @@ bool DecoderSndFile::initialize() m_freq = snd_info.samplerate; m_chan = snd_info.channels; - m_totalTime = (double) snd_info.frames / m_freq; + m_totalTime = snd_info.frames * 1000 / m_freq; - m_bitrate = QFileInfo(m_path).size () * 8.0 / m_totalTime / 1000.0 + 0.5; + m_bitrate = QFileInfo(m_path).size () * 8.0 / m_totalTime + 0.5; configure(m_freq, m_chan, 16); m_buf = new short[bks / sizeof(short)]; @@ -146,7 +146,7 @@ bool DecoderSndFile::initialize() } -qint64 DecoderSndFile::lengthInSeconds() +qint64 DecoderSndFile::totalTime() { if (! m_inited) return 0; @@ -196,7 +196,7 @@ void DecoderSndFile::run() if (m_seekTime >= 0) { - m_output_size = sf_seek(m_sndfile, m_freq*m_seekTime, SEEK_SET); + m_output_size = sf_seek(m_sndfile, m_freq*m_seekTime/1000, SEEK_SET); m_seekTime = -1.0; } diff --git a/src/plugins/Input/sndfile/decoder_sndfile.h b/src/plugins/Input/sndfile/decoder_sndfile.h index e221065f2..c62544193 100644 --- a/src/plugins/Input/sndfile/decoder_sndfile.h +++ b/src/plugins/Input/sndfile/decoder_sndfile.h @@ -35,7 +35,7 @@ public: // Standard Decoder API bool initialize(); - qint64 lengthInSeconds(); + qint64 totalTime(); void seek(qint64); void stop(); |
