diff options
Diffstat (limited to 'src/plugins/Input/vorbis')
| -rw-r--r-- | src/plugins/Input/vorbis/decoder_vorbis.cpp | 16 | ||||
| -rw-r--r-- | src/plugins/Input/vorbis/decoder_vorbis.h | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/Input/vorbis/decoder_vorbis.cpp b/src/plugins/Input/vorbis/decoder_vorbis.cpp index 901e10f86..34b9c10dd 100644 --- a/src/plugins/Input/vorbis/decoder_vorbis.cpp +++ b/src/plugins/Input/vorbis/decoder_vorbis.cpp @@ -90,7 +90,7 @@ DecoderVorbis::DecoderVorbis(QObject *parent, DecoderFactory *d, QIODevice *i, O freq = 0; bitrate = 0; seekTime = -1.0; - totalTime = 0.0; + m_totalTime = 0.0; chan = 0; output_size = 0; } @@ -159,7 +159,7 @@ bool DecoderVorbis::initialize() stat = chan = 0; output_size = 0; seekTime = -1.0; - totalTime = 0.0; + m_totalTime = 0.0; if (! input()) { qDebug("DecoderVorbis: cannot initialize. No input"); @@ -200,8 +200,8 @@ bool DecoderVorbis::initialize() bitrate = ov_bitrate(&oggfile, -1) / 1000; chan = 0; - totalTime = long(ov_time_total(&oggfile, 0)); - totalTime = totalTime < 0 ? 0 : totalTime; + m_totalTime = ov_time_total(&oggfile, -1) * 1000; + m_totalTime = qMax(qint64(0), m_totalTime); vorbis_info *ogginfo = ov_info(&oggfile, -1); if (ogginfo) @@ -217,12 +217,12 @@ bool DecoderVorbis::initialize() } -qint64 DecoderVorbis::lengthInSeconds() +qint64 DecoderVorbis::totalTime() { if (! inited) return 0; - return totalTime; + return m_totalTime; } @@ -314,10 +314,10 @@ void DecoderVorbis::run() if (seekTime >= 0.0) { - ov_time_seek(&oggfile, double(seekTime)); + ov_time_seek(&oggfile, (double) seekTime/1000); seekTime = -1.0; - output_size = long(ov_time_tell(&oggfile)) * long(freq * chan * 2); + output_size = ov_time_tell(&oggfile) * freq * chan * 2; } len = -1; while (len < 0) diff --git a/src/plugins/Input/vorbis/decoder_vorbis.h b/src/plugins/Input/vorbis/decoder_vorbis.h index f9609cac7..ec1158f31 100644 --- a/src/plugins/Input/vorbis/decoder_vorbis.h +++ b/src/plugins/Input/vorbis/decoder_vorbis.h @@ -20,7 +20,7 @@ public: // Standard Decoder API bool initialize(); - qint64 lengthInSeconds(); + qint64 totalTime(); void seek(qint64); void stop(); @@ -55,8 +55,8 @@ private: bool done, m_finish; long len, freq, bitrate; int chan; - unsigned long output_size; - qint64 totalTime, seekTime; + qint64 output_size; + qint64 m_totalTime, seekTime; }; |
