OSDN Git Service

Handle two more plurals correctly.
[lamexp/LameXP.git] / src / Decoder_Avisynth.cpp
index 9a6d4f8..174ecf8 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -46,6 +46,8 @@ bool AvisynthDecoder::decode(const QString &sourceFile, const QString &outputFil
        QProcess process;
        QStringList args;
 
+       process.setWorkingDirectory(QFileInfo(outputFile).absolutePath());
+
        args << QDir::toNativeSeparators(sourceFile);
        args << QDir::toNativeSeparators(outputFile);
 
@@ -57,7 +59,7 @@ bool AvisynthDecoder::decode(const QString &sourceFile, const QString &outputFil
        bool bTimeout = false;
        bool bAborted = false;
 
-       QRegExp regExp("please wait: (\\d+)/(\\d+) \\[(\\d+)%\\]");
+       QRegExp regExp("(\\d+)/(\\d+) \\[(\\d+)%\\]");
 
        while(process.state() != QProcess::NotRunning)
        {
@@ -68,7 +70,7 @@ bool AvisynthDecoder::decode(const QString &sourceFile, const QString &outputFil
                        emit messageLogged("\nABORTED BY USER !!!");
                        break;
                }
-               process.waitForReadyRead();
+               process.waitForReadyRead(m_processTimeoutInterval);
                if(!process.bytesAvailable() && process.state() == QProcess::Running)
                {
                        process.kill();
@@ -104,7 +106,7 @@ bool AvisynthDecoder::decode(const QString &sourceFile, const QString &outputFil
        emit statusUpdated(100);
        emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
 
-       if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0)
+       if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
        {
                return false;
        }