Removed obsolete code from EncodeThread class.
This commit is contained in:
parent
155f66c061
commit
6279ee6b58
@ -432,515 +432,3 @@ QString EncodeThread::getPasslogFile(const QString &outputFile)
|
||||
|
||||
return passLogFile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ==========================================
|
||||
// DISABLED
|
||||
// ==========================================
|
||||
|
||||
/*
|
||||
unsigned int EncodeThread::checkVersionAvs2yuv(void)
|
||||
{
|
||||
if(!m_sysinfo->hasAVSSupport())
|
||||
{
|
||||
log(tr("\nAVS INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
|
||||
log("\nCreating process:");
|
||||
if(!startProcess(process, AVS_BINARY(m_sysinfo, m_preferences), QStringList()))
|
||||
{
|
||||
return false;;
|
||||
}
|
||||
|
||||
QRegExp regExpVersionMod("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive);
|
||||
QRegExp regExpVersionOld("\\bAvs2YUV (\\d+).(\\d+)\\b", Qt::CaseInsensitive);
|
||||
|
||||
bool bTimeout = false;
|
||||
bool bAborted = false;
|
||||
|
||||
unsigned int ver_maj = UINT_MAX;
|
||||
unsigned int ver_min = UINT_MAX;
|
||||
unsigned int ver_mod = 0;
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
if(m_abort)
|
||||
{
|
||||
process.kill();
|
||||
bAborted = true;
|
||||
break;
|
||||
}
|
||||
if(!process.waitForReadyRead())
|
||||
{
|
||||
if(process.state() == QProcess::Running)
|
||||
{
|
||||
process.kill();
|
||||
qWarning("Avs2YUV process timed out <-- killing!");
|
||||
log("\nPROCESS TIMEOUT !!!");
|
||||
bTimeout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(process.bytesAvailable() > 0)
|
||||
{
|
||||
QList<QByteArray> lines = process.readLine().split('\r');
|
||||
while(!lines.isEmpty())
|
||||
{
|
||||
QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified();
|
||||
int offset = -1;
|
||||
if((ver_maj == UINT_MAX) || (ver_min == UINT_MAX) || (ver_mod == UINT_MAX))
|
||||
{
|
||||
if(!text.isEmpty())
|
||||
{
|
||||
log(text);
|
||||
}
|
||||
}
|
||||
if((offset = regExpVersionMod.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok1 = false, ok2 = false, ok3 = false;
|
||||
unsigned int temp1 = regExpVersionMod.cap(1).toUInt(&ok1);
|
||||
unsigned int temp2 = regExpVersionMod.cap(2).toUInt(&ok2);
|
||||
unsigned int temp3 = regExpVersionMod.cap(3).toUInt(&ok3);
|
||||
if(ok1) ver_maj = temp1;
|
||||
if(ok2) ver_min = temp2;
|
||||
if(ok3) ver_mod = temp3;
|
||||
}
|
||||
else if((offset = regExpVersionOld.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok1 = false, ok2 = false;
|
||||
unsigned int temp1 = regExpVersionOld.cap(1).toUInt(&ok1);
|
||||
unsigned int temp2 = regExpVersionOld.cap(2).toUInt(&ok2);
|
||||
if(ok1) ver_maj = temp1;
|
||||
if(ok2) ver_min = temp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process.waitForFinished();
|
||||
if(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
|
||||
if(bTimeout || bAborted || ((process.exitCode() != EXIT_SUCCESS) && (process.exitCode() != 2)))
|
||||
{
|
||||
if(!(bTimeout || bAborted))
|
||||
{
|
||||
log(tr("\nPROCESS EXITED WITH ERROR CODE: %1").arg(QString::number(process.exitCode())));
|
||||
}
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
if((ver_maj == UINT_MAX) || (ver_min == UINT_MAX))
|
||||
{
|
||||
log(tr("\nFAILED TO DETERMINE AVS2YUV VERSION !!!"));
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
return (ver_maj * REV_MULT) + ((ver_min % REV_MULT) * 10) + (ver_mod % 10);
|
||||
}
|
||||
|
||||
bool EncodeThread::checkVersionVapoursynth(void)
|
||||
{
|
||||
//Is VapourSynth available at all?
|
||||
if((!m_sysinfo->hasVPSSupport()) || (!QFileInfo(VPS_BINARY(m_sysinfo, m_preferences)).isFile()))
|
||||
{
|
||||
log(tr("\nVPY INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
|
||||
log("\nCreating process:");
|
||||
if(!startProcess(process, VPS_BINARY(m_sysinfo, m_preferences), QStringList()))
|
||||
{
|
||||
return false;;
|
||||
}
|
||||
|
||||
QRegExp regExpSignature("\\bVSPipe\\s+usage\\b", Qt::CaseInsensitive);
|
||||
|
||||
bool bTimeout = false;
|
||||
bool bAborted = false;
|
||||
|
||||
bool vspipeSignature = false;
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
if(m_abort)
|
||||
{
|
||||
process.kill();
|
||||
bAborted = true;
|
||||
break;
|
||||
}
|
||||
if(!process.waitForReadyRead())
|
||||
{
|
||||
if(process.state() == QProcess::Running)
|
||||
{
|
||||
process.kill();
|
||||
qWarning("VSPipe process timed out <-- killing!");
|
||||
log("\nPROCESS TIMEOUT !!!");
|
||||
bTimeout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(process.bytesAvailable() > 0)
|
||||
{
|
||||
QList<QByteArray> lines = process.readLine().split('\r');
|
||||
while(!lines.isEmpty())
|
||||
{
|
||||
QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified();
|
||||
if(regExpSignature.lastIndexIn(text) >= 0)
|
||||
{
|
||||
vspipeSignature = true;
|
||||
}
|
||||
if(!text.isEmpty())
|
||||
{
|
||||
log(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process.waitForFinished();
|
||||
if(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
|
||||
if(bTimeout || bAborted || ((process.exitCode() != EXIT_SUCCESS) && (process.exitCode() != 1)))
|
||||
{
|
||||
if(!(bTimeout || bAborted))
|
||||
{
|
||||
log(tr("\nPROCESS EXITED WITH ERROR CODE: %1").arg(QString::number(process.exitCode())));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!vspipeSignature)
|
||||
{
|
||||
log(tr("\nFAILED TO DETECT VSPIPE SIGNATURE !!!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return vspipeSignature;
|
||||
}
|
||||
|
||||
bool EncodeThread::checkPropertiesAVS(unsigned int &frames)
|
||||
{
|
||||
QProcess process;
|
||||
QStringList cmdLine;
|
||||
|
||||
if(!m_options->customAvs2YUV().isEmpty())
|
||||
{
|
||||
cmdLine.append(splitParams(m_options->customAvs2YUV()));
|
||||
}
|
||||
|
||||
cmdLine << "-frames" << "1";
|
||||
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFileName, true)) << "NUL";
|
||||
|
||||
log("Creating process:");
|
||||
if(!startProcess(process, AVS_BINARY(m_sysinfo, m_preferences), cmdLine))
|
||||
{
|
||||
return false;;
|
||||
}
|
||||
|
||||
QRegExp regExpInt(": (\\d+)x(\\d+), (\\d+) fps, (\\d+) frames");
|
||||
QRegExp regExpFrc(": (\\d+)x(\\d+), (\\d+)/(\\d+) fps, (\\d+) frames");
|
||||
|
||||
QTextCodec *localCodec = QTextCodec::codecForName("System");
|
||||
|
||||
bool bTimeout = false;
|
||||
bool bAborted = false;
|
||||
|
||||
frames = 0;
|
||||
|
||||
unsigned int fpsNom = 0;
|
||||
unsigned int fpsDen = 0;
|
||||
unsigned int fSizeW = 0;
|
||||
unsigned int fSizeH = 0;
|
||||
|
||||
unsigned int waitCounter = 0;
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
if(m_abort)
|
||||
{
|
||||
process.kill();
|
||||
bAborted = true;
|
||||
break;
|
||||
}
|
||||
if(!process.waitForReadyRead(m_processTimeoutInterval))
|
||||
{
|
||||
if(process.state() == QProcess::Running)
|
||||
{
|
||||
if(++waitCounter > m_processTimeoutMaxCounter)
|
||||
{
|
||||
if(m_preferences->getAbortOnTimeout())
|
||||
{
|
||||
process.kill();
|
||||
qWarning("Avs2YUV process timed out <-- killing!");
|
||||
log("\nPROCESS TIMEOUT !!!");
|
||||
log("\nAvisynth has encountered a deadlock or your script takes EXTREMELY long to initialize!");
|
||||
bTimeout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(waitCounter == m_processTimeoutWarning)
|
||||
{
|
||||
unsigned int timeOut = (waitCounter * m_processTimeoutInterval) / 1000U;
|
||||
log(tr("Warning: Avisynth did not respond for %1 seconds, potential deadlock...").arg(QString::number(timeOut)));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
waitCounter = 0;
|
||||
|
||||
while(process.bytesAvailable() > 0)
|
||||
{
|
||||
QList<QByteArray> lines = process.readLine().split('\r');
|
||||
while(!lines.isEmpty())
|
||||
{
|
||||
QString text = localCodec->toUnicode(lines.takeFirst().constData()).simplified();
|
||||
int offset = -1;
|
||||
if((offset = regExpInt.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok1 = false, ok2 = false;
|
||||
bool ok3 = false, ok4 = false;
|
||||
unsigned int temp1 = regExpInt.cap(1).toUInt(&ok1);
|
||||
unsigned int temp2 = regExpInt.cap(2).toUInt(&ok2);
|
||||
unsigned int temp3 = regExpInt.cap(3).toUInt(&ok3);
|
||||
unsigned int temp4 = regExpInt.cap(4).toUInt(&ok4);
|
||||
if(ok1) fSizeW = temp1;
|
||||
if(ok2) fSizeH = temp2;
|
||||
if(ok3) fpsNom = temp3;
|
||||
if(ok4) frames = temp4;
|
||||
}
|
||||
else if((offset = regExpFrc.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok1 = false, ok2 = false;
|
||||
bool ok3 = false, ok4 = false, ok5 = false;
|
||||
unsigned int temp1 = regExpFrc.cap(1).toUInt(&ok1);
|
||||
unsigned int temp2 = regExpFrc.cap(2).toUInt(&ok2);
|
||||
unsigned int temp3 = regExpFrc.cap(3).toUInt(&ok3);
|
||||
unsigned int temp4 = regExpFrc.cap(4).toUInt(&ok4);
|
||||
unsigned int temp5 = regExpFrc.cap(5).toUInt(&ok5);
|
||||
if(ok1) fSizeW = temp1;
|
||||
if(ok2) fSizeH = temp2;
|
||||
if(ok3) fpsNom = temp3;
|
||||
if(ok4) fpsDen = temp4;
|
||||
if(ok5) frames = temp5;
|
||||
}
|
||||
if(!text.isEmpty())
|
||||
{
|
||||
log(text);
|
||||
}
|
||||
if(text.contains("failed to load avisynth.dll", Qt::CaseInsensitive))
|
||||
{
|
||||
log(tr("\nWarning: It seems that %1-Bit Avisynth is not currently installed !!!").arg(m_preferences->getUseAvisyth64Bit() ? "64" : "32"));
|
||||
}
|
||||
if(text.contains(QRegExp("couldn't convert input clip to (YV16|YV24)", Qt::CaseInsensitive)))
|
||||
{
|
||||
log(tr("\nWarning: YV16 (4:2:2) and YV24 (4:4:4) color-spaces only supported in Avisynth 2.6 !!!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process.waitForFinished();
|
||||
if(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
|
||||
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
|
||||
{
|
||||
if(!(bTimeout || bAborted))
|
||||
{
|
||||
const int exitCode = process.exitCode();
|
||||
log(tr("\nPROCESS EXITED WITH ERROR CODE: %1").arg(QString::number(exitCode)));
|
||||
if((exitCode < 0) || (exitCode >= 32))
|
||||
{
|
||||
log(tr("\nIMPORTANT: The Avs2YUV process terminated abnormally. This means Avisynth or one of your Avisynth-Plugin's just crashed."));
|
||||
log(tr("IMPORTANT: Please fix your Avisynth script and try again! If you use Avisynth-MT, try using a *stable* Avisynth instead!"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(frames == 0)
|
||||
{
|
||||
log(tr("\nFAILED TO DETERMINE AVS PROPERTIES !!!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
log("");
|
||||
|
||||
if((fSizeW > 0) && (fSizeH > 0))
|
||||
{
|
||||
log(tr("Resolution: %1x%2").arg(QString::number(fSizeW), QString::number(fSizeH)));
|
||||
}
|
||||
if((fpsNom > 0) && (fpsDen > 0))
|
||||
{
|
||||
log(tr("Frame Rate: %1/%2").arg(QString::number(fpsNom), QString::number(fpsDen)));
|
||||
}
|
||||
if((fpsNom > 0) && (fpsDen == 0))
|
||||
{
|
||||
log(tr("Frame Rate: %1").arg(QString::number(fpsNom)));
|
||||
}
|
||||
if(frames > 0)
|
||||
{
|
||||
log(tr("No. Frames: %1").arg(QString::number(frames)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EncodeThread::checkPropertiesVPS(unsigned int &frames)
|
||||
{
|
||||
QProcess process;
|
||||
QStringList cmdLine;
|
||||
|
||||
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFileName, true));
|
||||
cmdLine << "-" << "-info";
|
||||
|
||||
log("Creating process:");
|
||||
if(!startProcess(process, VPS_BINARY(m_sysinfo, m_preferences), cmdLine))
|
||||
{
|
||||
return false;;
|
||||
}
|
||||
|
||||
QRegExp regExpFrm("\\bFrames:\\s+(\\d+)\\b");
|
||||
QRegExp regExpSzW("\\bWidth:\\s+(\\d+)\\b");
|
||||
QRegExp regExpSzH("\\bHeight:\\s+(\\d+)\\b");
|
||||
|
||||
QTextCodec *localCodec = QTextCodec::codecForName("System");
|
||||
|
||||
bool bTimeout = false;
|
||||
bool bAborted = false;
|
||||
|
||||
frames = 0;
|
||||
|
||||
unsigned int fSizeW = 0;
|
||||
unsigned int fSizeH = 0;
|
||||
|
||||
unsigned int waitCounter = 0;
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
if(m_abort)
|
||||
{
|
||||
process.kill();
|
||||
bAborted = true;
|
||||
break;
|
||||
}
|
||||
if(!process.waitForReadyRead(m_processTimeoutInterval))
|
||||
{
|
||||
if(process.state() == QProcess::Running)
|
||||
{
|
||||
if(++waitCounter > m_processTimeoutMaxCounter)
|
||||
{
|
||||
if(m_preferences->getAbortOnTimeout())
|
||||
{
|
||||
process.kill();
|
||||
qWarning("VSPipe process timed out <-- killing!");
|
||||
log("\nPROCESS TIMEOUT !!!");
|
||||
log("\nVapoursynth has encountered a deadlock or your script takes EXTREMELY long to initialize!");
|
||||
bTimeout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(waitCounter == m_processTimeoutWarning)
|
||||
{
|
||||
unsigned int timeOut = (waitCounter * m_processTimeoutInterval) / 1000U;
|
||||
log(tr("Warning: nVapoursynth did not respond for %1 seconds, potential deadlock...").arg(QString::number(timeOut)));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
waitCounter = 0;
|
||||
|
||||
while(process.bytesAvailable() > 0)
|
||||
{
|
||||
QList<QByteArray> lines = process.readLine().split('\r');
|
||||
while(!lines.isEmpty())
|
||||
{
|
||||
QString text = localCodec->toUnicode(lines.takeFirst().constData()).simplified();
|
||||
int offset = -1;
|
||||
if((offset = regExpFrm.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned int temp = regExpFrm.cap(1).toUInt(&ok);
|
||||
if(ok) frames = temp;
|
||||
}
|
||||
if((offset = regExpSzW.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned int temp = regExpSzW.cap(1).toUInt(&ok);
|
||||
if(ok) fSizeW = temp;
|
||||
}
|
||||
if((offset = regExpSzH.lastIndexIn(text)) >= 0)
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned int temp = regExpSzH.cap(1).toUInt(&ok);
|
||||
if(ok) fSizeH = temp;
|
||||
}
|
||||
if(!text.isEmpty())
|
||||
{
|
||||
log(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process.waitForFinished();
|
||||
if(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
|
||||
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
|
||||
{
|
||||
if(!(bTimeout || bAborted))
|
||||
{
|
||||
const int exitCode = process.exitCode();
|
||||
log(tr("\nPROCESS EXITED WITH ERROR CODE: %1").arg(QString::number(exitCode)));
|
||||
if((exitCode < 0) || (exitCode >= 32))
|
||||
{
|
||||
log(tr("\nIMPORTANT: The Vapoursynth process terminated abnormally. This means Vapoursynth or one of your Vapoursynth-Plugin's just crashed."));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(frames == 0)
|
||||
{
|
||||
log(tr("\nFAILED TO DETERMINE VPY PROPERTIES !!!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
log("");
|
||||
|
||||
if((fSizeW > 0) && (fSizeH > 0))
|
||||
{
|
||||
log(tr("Resolution: %1x%2").arg(QString::number(fSizeW), QString::number(fSizeH)));
|
||||
}
|
||||
if(frames > 0)
|
||||
{
|
||||
log(tr("No. Frames: %1").arg(QString::number(frames)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user