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/wavpack/cueparser.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/plugins/Input/wavpack/cueparser.cpp') diff --git a/src/plugins/Input/wavpack/cueparser.cpp b/src/plugins/Input/wavpack/cueparser.cpp index e68499cf1..081912dba 100644 --- a/src/plugins/Input/wavpack/cueparser.cpp +++ b/src/plugins/Input/wavpack/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 * @@ -88,7 +88,7 @@ CUEParser::CUEParser(const QByteArray &array, const QString &fileName) m_infoList[i].setLength(m_infoList[i+1].length() - m_infoList[i].length()); //calculate last item length QList f_list = Decoder::createPlayList(m_filePath, FALSE); - qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length(); + 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 @@ -100,7 +100,7 @@ CUEParser::CUEParser(const QByteArray &array, const QString &fileName) m_infoList[i].setMetaData(Qmmp::GENRE, genre); m_infoList[i].setMetaData(Qmmp::YEAR, date); m_infoList[i].setMetaData(Qmmp::COMMENT, comment); - if(!m_infoList[i].metaData().count(Qmmp::ARTIST) && !artist.isEmpty()) + if (!m_infoList[i].metaData().count(Qmmp::ARTIST) && !artist.isEmpty()) m_infoList[i].setMetaData(Qmmp::ARTIST, artist); } } @@ -116,6 +116,7 @@ QList CUEParser::createPlayList() foreach(FileInfo info, m_infoList) { list << new FileInfo(info); + list.last()->setLength(list.last()->length()/1000); } return list; } @@ -174,10 +175,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; } -- cgit v1.2.3-13-gbd6f