OSDN Git Service

Updated Musepack decoder to output progress info. Also added code to parse the output.
authorlordmulder <mulder2@gmx.de>
Thu, 26 Jan 2012 21:26:52 +0000 (22:26 +0100)
committerlordmulder <mulder2@gmx.de>
Thu, 26 Jan 2012 21:26:52 +0000 (22:26 +0100)
res/tools/mpcdec.exe
src/Config.h
src/Decoder_Musepack.cpp
src/Tools.h

index 688d87c..5041c62 100644 (file)
Binary files a/res/tools/mpcdec.exe and b/res/tools/mpcdec.exe differ
index 50e7526..d018561 100644 (file)
@@ -30,7 +30,7 @@
 #define VER_LAMEXP_MINOR_LO                                    4
 #define VER_LAMEXP_TYPE                                                Alpha
 #define VER_LAMEXP_PATCH                                       17
-#define VER_LAMEXP_BUILD                                       885
+#define VER_LAMEXP_BUILD                                       886
 
 ///////////////////////////////////////////////////////////////////////////////
 // Tool versions (minimum expected versions!)
index 1b0d3b6..a316c4b 100644 (file)
@@ -47,6 +47,7 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
        QProcess process;
        QStringList args;
 
+       args << "-v";
        args << QDir::toNativeSeparators(sourceFile);
        args << QDir::toNativeSeparators(outputFile);
 
@@ -57,9 +58,9 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
 
        bool bTimeout = false;
        bool bAborted = false;
+       int prevProgress = -1;
 
-       //The Musepack Decoder doesn't actually send any status updates :-[
-       emit statusUpdated(20 + (QUuid::createUuid().data1 % 80));
+       QRegExp regExp("Decoding progress: (\\d+)\\.(\\d+)%");
 
        while(process.state() != QProcess::NotRunning)
        {
@@ -83,7 +84,17 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
                {
                        QByteArray line = process.readLine();
                        QString text = QString::fromUtf8(line.constData()).simplified();
-                       if(!text.isEmpty())
+                       if(regExp.lastIndexIn(text) >= 0)
+                       {
+                               bool ok = false;
+                               int progress = regExp.cap(1).toInt(&ok);
+                               if(ok && (progress > prevProgress))
+                               {
+                                       emit statusUpdated(progress);
+                                       prevProgress = qMin(progress + 2, 99);
+                               }
+                       }
+                       else if(!text.isEmpty())
                        {
                                emit messageLogged(text);
                        }
index 9677aaf..7e1ed0e 100644 (file)
@@ -67,7 +67,7 @@ g_lamexp_tools[] =
        {"b7c4a839282db1b22a4c12737191a15a028001801d5835df34010663430f9a33fdd5a83e", CPU_TYPE_ALL_ALL, "mac.exe", 410},
        {"ab3f6a8f2bc08011fdcea2e54a9b234ba67d304b5eea3fc0db653e603f938d0280fba0f0", CPU_TYPE_X86_ALL, "mediainfo.i386.exe", 753},
        {"c1d88d1b04f72118f21b5f574c4008fd0c99f3d6ed11cc9c8644b831971d1e1153cd63ea", CPU_TYPE_X64_ALL, "mediainfo.x64.exe",  753},
-       {"3b7285777a63f3405057b8498eceb0aec9cdff1f1f1c61769d286332102de5939f95a64f", CPU_TYPE_ALL_ALL, "mpcdec.exe", 475},
+       {"ed49bfeb5113e8eca4f2f5c5c9359f6edeecf457cff8511178902c7d792380eaa578d9bc", CPU_TYPE_ALL_ALL, "mpcdec.exe", 475},
        {"7fa1beb4161d603563089cadd601f68fb9f436f05d9477b6a604501b072f5a973dd45fbb", CPU_TYPE_ALL_ALL, "mpg123.exe", 1134},
        {"0c781805dda931c529bd16069215f616a7a4c5e5c2dfb6b75fe85d52b20511830693e528", CPU_TYPE_ALL_ALL, "oggdec.exe", UINT_MAX},
        {"0c019e13450dc664987e21f4e5489d182be7d6d0d81efbbaaf1c78693dfe3e38e0355b93", CPU_TYPE_X86_GEN, "oggenc2.i386.exe", 287603},