aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/vorbis/decoder_vorbis.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-03-07 22:43:26 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-03-07 22:43:26 +0000
commit0b46e2db06ec1bbfc3aee819787386ace9dad66c (patch)
tree109f4bbf3a7227262a280f00731f0767d331a811 /src/plugins/Input/vorbis/decoder_vorbis.cpp
parent5896c5ae40726637cbfc5605f5f659791ff569c7 (diff)
downloadqmmp-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/vorbis/decoder_vorbis.cpp')
-rw-r--r--src/plugins/Input/vorbis/decoder_vorbis.cpp16
1 files changed, 8 insertions, 8 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)