Updated Musepack decoder to output progress info. Also added code to parse the output.

This commit is contained in:
LoRd_MuldeR 2012-01-26 22:26:52 +01:00
parent 871866606d
commit dbd0c860e1
4 changed files with 16 additions and 5 deletions

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 17 #define VER_LAMEXP_PATCH 17
#define VER_LAMEXP_BUILD 885 #define VER_LAMEXP_BUILD 886
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -47,6 +47,7 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
QProcess process; QProcess process;
QStringList args; QStringList args;
args << "-v";
args << QDir::toNativeSeparators(sourceFile); args << QDir::toNativeSeparators(sourceFile);
args << QDir::toNativeSeparators(outputFile); args << QDir::toNativeSeparators(outputFile);
@ -57,9 +58,9 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
bool bTimeout = false; bool bTimeout = false;
bool bAborted = false; bool bAborted = false;
int prevProgress = -1;
//The Musepack Decoder doesn't actually send any status updates :-[ QRegExp regExp("Decoding progress: (\\d+)\\.(\\d+)%");
emit statusUpdated(20 + (QUuid::createUuid().data1 % 80));
while(process.state() != QProcess::NotRunning) while(process.state() != QProcess::NotRunning)
{ {
@ -83,7 +84,17 @@ bool MusepackDecoder::decode(const QString &sourceFile, const QString &outputFil
{ {
QByteArray line = process.readLine(); QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified(); 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); emit messageLogged(text);
} }

View File

@ -67,7 +67,7 @@ g_lamexp_tools[] =
{"b7c4a839282db1b22a4c12737191a15a028001801d5835df34010663430f9a33fdd5a83e", CPU_TYPE_ALL_ALL, "mac.exe", 410}, {"b7c4a839282db1b22a4c12737191a15a028001801d5835df34010663430f9a33fdd5a83e", CPU_TYPE_ALL_ALL, "mac.exe", 410},
{"ab3f6a8f2bc08011fdcea2e54a9b234ba67d304b5eea3fc0db653e603f938d0280fba0f0", CPU_TYPE_X86_ALL, "mediainfo.i386.exe", 753}, {"ab3f6a8f2bc08011fdcea2e54a9b234ba67d304b5eea3fc0db653e603f938d0280fba0f0", CPU_TYPE_X86_ALL, "mediainfo.i386.exe", 753},
{"c1d88d1b04f72118f21b5f574c4008fd0c99f3d6ed11cc9c8644b831971d1e1153cd63ea", CPU_TYPE_X64_ALL, "mediainfo.x64.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}, {"7fa1beb4161d603563089cadd601f68fb9f436f05d9477b6a604501b072f5a973dd45fbb", CPU_TYPE_ALL_ALL, "mpg123.exe", 1134},
{"0c781805dda931c529bd16069215f616a7a4c5e5c2dfb6b75fe85d52b20511830693e528", CPU_TYPE_ALL_ALL, "oggdec.exe", UINT_MAX}, {"0c781805dda931c529bd16069215f616a7a4c5e5c2dfb6b75fe85d52b20511830693e528", CPU_TYPE_ALL_ALL, "oggdec.exe", UINT_MAX},
{"0c019e13450dc664987e21f4e5489d182be7d6d0d81efbbaaf1c78693dfe3e38e0355b93", CPU_TYPE_X86_GEN, "oggenc2.i386.exe", 287603}, {"0c019e13450dc664987e21f4e5489d182be7d6d0d81efbbaaf1c78693dfe3e38e0355b93", CPU_TYPE_X86_GEN, "oggenc2.i386.exe", 287603},