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/cue/cueparser.cpp | 18 ++++++++++-------- src/plugins/Input/cue/cueparser.h | 6 +++--- src/plugins/Input/cue/decoder_cue.cpp | 2 +- src/plugins/Input/cue/decoder_cue.h | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/plugins/Input/cue') diff --git a/src/plugins/Input/cue/cueparser.cpp b/src/plugins/Input/cue/cueparser.cpp index 78d2fc8ad..68d3cb9e2 100644 --- a/src/plugins/Input/cue/cueparser.cpp +++ b/src/plugins/Input/cue/cueparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -102,9 +102,8 @@ CUEParser::CUEParser(const QString &fileName) for (int i = 0; i < m_infoList.size() - 1; ++i) m_infoList[i].setLength(m_infoList[i+1].length() - m_infoList[i].length()); //calculate last item length - QList f_list; - f_list = Decoder::createPlayList(m_filePath, FALSE); - qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length(); + QList f_list = Decoder::createPlayList(m_filePath, FALSE); + qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length() * 1000; if (l > m_infoList.last().length()) m_infoList.last().setLength(l - m_infoList.last().length()); else @@ -133,6 +132,7 @@ QList CUEParser::createPlayList() foreach(FileInfo info, m_infoList) { list << new FileInfo(info); + list.last()->setLength(list.last()->length()/1000); } return list; } @@ -191,10 +191,12 @@ QStringList CUEParser::splitLine(const QString &line) return list; } -int CUEParser::getLength(const QString &str) +qint64 CUEParser::getLength(const QString &str) { QStringList list = str.split(":"); - if (list.size() < 2) - return 0; - return list.at(0).toInt()*60 + list.at(1).toInt(); + if (list.size() == 2) + return (qint64)list.at(0).toInt()*60000 + list.at(1).toInt()*1000; + else if (list.size() == 3) + return (qint64)list.at(0).toInt()*60000 + list.at(1).toInt()*1000 + list.at(1).toInt()*1000/75; + return 0; } diff --git a/src/plugins/Input/cue/cueparser.h b/src/plugins/Input/cue/cueparser.h index 694415111..654b9212d 100644 --- a/src/plugins/Input/cue/cueparser.h +++ b/src/plugins/Input/cue/cueparser.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -47,9 +47,9 @@ public: private: QString m_filePath; QList m_infoList; - QList m_offsets; + QList m_offsets; QStringList splitLine(const QString &line); - int getLength(const QString &str); + qint64 getLength(const QString &str); }; diff --git a/src/plugins/Input/cue/decoder_cue.cpp b/src/plugins/Input/cue/decoder_cue.cpp index a660d3cc0..fd965bd0e 100644 --- a/src/plugins/Input/cue/decoder_cue.cpp +++ b/src/plugins/Input/cue/decoder_cue.cpp @@ -121,7 +121,7 @@ bool DecoderCUE::initialize() return TRUE; } -qint64 DecoderCUE::lengthInSeconds() +qint64 DecoderCUE::totalTime() { return m_decoder ? m_length : 0; } diff --git a/src/plugins/Input/cue/decoder_cue.h b/src/plugins/Input/cue/decoder_cue.h index 35ab8496e..14c32eeae 100644 --- a/src/plugins/Input/cue/decoder_cue.h +++ b/src/plugins/Input/cue/decoder_cue.h @@ -37,7 +37,7 @@ public: // Standard Decoder API bool initialize(); - qint64 lengthInSeconds(); + qint64 totalTime(); void seek(qint64); void stop(); void pause(); -- cgit v1.2.3-13-gbd6f