aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/flac/decoder_flac.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/flac/decoder_flac.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/flac/decoder_flac.cpp')
-rw-r--r--src/plugins/Input/flac/decoder_flac.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/Input/flac/decoder_flac.cpp b/src/plugins/Input/flac/decoder_flac.cpp
index ec6cb6755..c3f8b223c 100644
--- a/src/plugins/Input/flac/decoder_flac.cpp
+++ b/src/plugins/Input/flac/decoder_flac.cpp
@@ -239,7 +239,7 @@ static void flac_callback_metadata (const FLAC__StreamDecoder *,
metadata->data.stream_info.bits_per_sample;
dflac->data()->channels = metadata->data.stream_info.channels;
dflac->data()->sample_rate = metadata->data.stream_info.sample_rate;
- dflac->data()->length = dflac->data()->total_samples / dflac->data()->sample_rate;
+ dflac->data()->length = dflac->data()->total_samples * 1000 / dflac->data()->sample_rate;
}
}
@@ -273,7 +273,7 @@ DecoderFLAC::DecoderFLAC(QObject *parent, DecoderFactory *d, QIODevice *i, Outpu
freq = 0;
bitrate = 0;
seekTime = -1.0;
- totalTime = 0.0;
+ m_totalTime = 0.0;
chan = 0;
output_size = 0;
m_data = 0;
@@ -359,7 +359,7 @@ bool DecoderFLAC::initialize()
stat = chan = 0;
output_size = 0;
seekTime = -1.0;
- totalTime = 0.0;
+ m_totalTime = 0.0;
if (!data()->input)
{
@@ -461,30 +461,30 @@ bool DecoderFLAC::initialize()
configure(data()->sample_rate, data()->channels, 32);
else
configure(data()->sample_rate, data()->channels, data()->bits_per_sample);
- totalTime = data()->length;
+ m_totalTime = data()->length;
inited = TRUE;
if (m_offset)
seekTime = m_offset;
if (m_length)
- totalTime = m_length;
+ m_totalTime = m_length;
qDebug("DecoderFLAC: initialize succes");
return TRUE;
}
-qint64 DecoderFLAC::lengthInSeconds()
+qint64 DecoderFLAC::totalTime()
{
if (! inited)
return 0;
- return totalTime;
+ return m_totalTime;
}
void DecoderFLAC::seek(qint64 pos)
{
- if (totalTime > 0)
+ if (m_totalTime > 0)
seekTime = pos + m_offset;
}