From 0b46e2db06ec1bbfc3aee819787386ace9dad66c Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 7 Mar 2009 22:43:26 +0000 Subject: improved seeking accuracy git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@827 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/mpc/decoder_mpc.cpp | 16 ++++++---------- src/plugins/Input/mpc/decoder_mpc.h | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src/plugins/Input/mpc') diff --git a/src/plugins/Input/mpc/decoder_mpc.cpp b/src/plugins/Input/mpc/decoder_mpc.cpp index 9b3679dd3..d8d739c1c 100644 --- a/src/plugins/Input/mpc/decoder_mpc.cpp +++ b/src/plugins/Input/mpc/decoder_mpc.cpp @@ -112,14 +112,10 @@ DecoderMPC::DecoderMPC(QObject *parent, DecoderFactory *d, QIODevice *i, Output freq = 0; bitrate = 0; seekTime = -1.0; - totalTime = 0.0; + m_totalTime = 0.0; chan = 0; output_size = 0; m_data = 0; - - - - } @@ -191,7 +187,7 @@ bool DecoderMPC::initialize() chan = 0; output_size = 0; seekTime = -1.0; - totalTime = 0.0; + m_totalTime = 0.0; if (!input()) @@ -242,19 +238,19 @@ bool DecoderMPC::initialize() qWarning("DecoderMPC: cannot get info."); return FALSE; } - totalTime = mpc_streaminfo_get_length(&data()->info); + m_totalTime = mpc_streaminfo_get_length(&data()->info) * 1000; inited = TRUE; qDebug("DecoderMPC: initialize succes"); return TRUE; } -qint64 DecoderMPC::lengthInSeconds() +qint64 DecoderMPC::totalTime() { if (! inited) return 0; - return totalTime; + return m_totalTime; } @@ -292,7 +288,7 @@ void DecoderMPC::run() if (seekTime >= 0.0) { - mpc_decoder_seek_seconds(&data()->decoder, seekTime); + mpc_decoder_seek_seconds(&data()->decoder, seekTime/1000); seekTime = -1.0; } MPC_SAMPLE_FORMAT buffer[MPC_DECODER_BUFFER_LENGTH]; diff --git a/src/plugins/Input/mpc/decoder_mpc.h b/src/plugins/Input/mpc/decoder_mpc.h index 733fcd8ca..052f634c8 100644 --- a/src/plugins/Input/mpc/decoder_mpc.h +++ b/src/plugins/Input/mpc/decoder_mpc.h @@ -40,7 +40,7 @@ public: // Standard Decoder API bool initialize(); - qint64 lengthInSeconds(); + qint64 totalTime(); void seek(qint64); void stop(); @@ -68,8 +68,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; }; -- cgit v1.2.3-13-gbd6f