Removed some debug outputs + adapted for changes in MUtils library.

This commit is contained in:
LoRd_MuldeR 2016-10-02 17:34:48 +02:00
parent 419cc7c2db
commit a31c9cc1bd
9 changed files with 19 additions and 20 deletions

View File

@ -80,7 +80,7 @@ bool AbstractEncoder::runEncodingPass(AbstractSource* pipedSource, const QString
buildCommandLine(cmdLine_Encode, (pipedSource != NULL), clipInfo, m_indexFile, pass, passLogFile);
log("Creating encoder process:");
if(!startProcess(processEncode, getBinaryPath(), cmdLine_Encode, true, getExtraPath()))
if(!startProcess(processEncode, getBinaryPath(), cmdLine_Encode, true, &getExtraPaths()))
{
return false;
}

View File

@ -67,7 +67,7 @@ bool AbstractSource::checkSourceProperties(ClipInfo &clipInfo)
checkSourceProperties_init(patterns, cmdLine);
log("Creating process:");
if(!startProcess(process, getBinaryPath(), cmdLine, true, getExtraPath()))
if(!startProcess(process, getBinaryPath(), cmdLine, true, &getExtraPaths()))
{
return false;;
}
@ -191,7 +191,7 @@ bool AbstractSource::createProcess(QProcess &processEncode, QProcess&processInpu
buildCommandLine(cmdLine_Input);
log("Creating input process:");
if(!startProcess(processInput, getBinaryPath(), cmdLine_Input, false, getExtraPath()))
if(!startProcess(processInput, getBinaryPath(), cmdLine_Input, false, &getExtraPaths()))
{
return false;
}

View File

@ -33,7 +33,7 @@ class AbstractSourceInfo
{
public:
virtual QString getBinaryPath(const SysinfoModel *const sysinfo, const bool& x64) const = 0;
virtual QString getExtraPath(const SysinfoModel *const sysinfo, const bool& x64) const { return QString(); }
virtual QStringList getExtraPaths(const SysinfoModel *const sysinfo, const bool& x64) const { return QStringList(); }
};
class AbstractSource : public AbstractTool

View File

@ -44,15 +44,15 @@ public:
return QString("%1/toolset/%2/avs2yuv_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
}
virtual QString getExtraPath(const SysinfoModel *const sysinfo, const bool& x64) const
virtual QStringList getExtraPaths(const SysinfoModel *const sysinfo, const bool& x64) const
{
const QString avsPath = sysinfo->getAVSPath();
if (!avsPath.isEmpty())
{
return QString("%1/%2").arg(avsPath, x64 ? QLatin1String("x64") : QLatin1String("x86"));
return QStringList() << QString("%1/%2").arg(avsPath, x64 ? QLatin1String("x64") : QLatin1String("x86"));
}
return QString();
return QStringList();
}
};

View File

@ -50,6 +50,6 @@ protected:
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, ClipInfo &clipInfo);
virtual QString getBinaryPath(void) const { return getSourceInfo().getBinaryPath(m_sysinfo, m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && (m_preferences->getPrefer64BitSource() || (!m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X86)))); }
virtual QString getExtraPath(void) const { return getSourceInfo().getExtraPath(m_sysinfo, m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && (m_preferences->getPrefer64BitSource() || (!m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X86)))); }
virtual QStringList getExtraPath(void) const { return getSourceInfo().getExtraPaths(m_sysinfo, m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && (m_preferences->getPrefer64BitSource() || (!m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X86)))); }
virtual void buildCommandLine(QStringList &cmdLine);
};

View File

@ -227,27 +227,26 @@ bool AvisynthCheckThread::checkAvisynth(QString &basePath, const SysinfoModel *c
QProcess process;
QStringList output;
QString extraPath;
//Look for "portable" Avisynth version
static const char *const ARCH_DIR[] = { "x64", "x86" };
const QLatin1String archSuffix = QLatin1String(ARCH_DIR[x64 ? 1 : 0]);
if (ENABLE_PORTABLE_AVS)
{
const QString avsPortableDir = QString("%1/extra/Avisynth").arg(QCoreApplication::applicationDirPath());
if (VALID_DIR(avsPortableDir))
{
const QString archDir = x64 ? QLatin1String("x64") : QLatin1String("x86");
QFileInfo avsDllFile(QString("%1/%2/avisynth.dll").arg(avsPortableDir, archDir)), devilDllFile(QString("%1/%2/devil.dll").arg(avsPortableDir, archDir));
QFileInfo avsDllFile(QString("%1/%2/avisynth.dll").arg(avsPortableDir, archSuffix)), devilDllFile(QString("%1/%2/devil.dll").arg(avsPortableDir, archSuffix));
if (avsDllFile.exists() && devilDllFile.exists() && avsDllFile.isFile() && devilDllFile.isFile())
{
qWarning("Adding portable Avisynth to PATH environment variable: %s", MUTILS_UTF8(avsPortableDir));
basePath = avsPortableDir;
extraPath = QString("%1/%2").arg(avsPortableDir, archDir);
}
}
}
//Setup process object
MUtils::init_process(process, QDir::tempPath(), true, extraPath);
MUtils::init_process(process, QDir::tempPath(), true, basePath.isEmpty() ? NULL : &(QStringList() << QString("%1/%2").arg(basePath, archSuffix)));
//Try to start VSPIPE.EXE
process.start(AVS_CHECK_BINARY(sysinfo, x64), QStringList());

View File

@ -94,7 +94,7 @@ unsigned int AbstractTool::checkVersion(bool &modified)
checkVersion_init(patterns, cmdLine);
log("Creating process:");
if(!startProcess(process, getBinaryPath(), cmdLine, true, getExtraPath()))
if(!startProcess(process, getBinaryPath(), cmdLine, true, &getExtraPaths()))
{
return false;
}
@ -173,13 +173,12 @@ bool AbstractTool::checkVersion_succeeded(const int &exitCode)
// Process Creation
// ------------------------------------------------------------
bool AbstractTool::startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels, const QString &extraPath)
bool AbstractTool::startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels, const QStringList *const extraPaths)
{
QMutexLocker lock(&s_mutexStartProcess);
log(commandline2string(program, args) + "\n");
log("EXTRAPATH: '" + extraPath + "'\n");
MUtils::init_process(process, QDir::tempPath(), true, extraPath);
MUtils::init_process(process, QDir::tempPath(), true, extraPaths);
if(!mergeChannels)
{
process.setProcessChannelMode(QProcess::SeparateChannels);

View File

@ -24,6 +24,7 @@
#include <QObject>
#include <QUuid>
#include <QMutex>
#include <QStringList>
class OptionsModel;
class SysinfoModel;
@ -63,7 +64,7 @@ protected:
static const unsigned int m_processTimeoutWarning = 24;
virtual QString getBinaryPath(void) const = 0;
virtual QString getExtraPath(void) const { return QString(); }
virtual QStringList getExtraPaths(void) const { return QStringList(); }
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified) = 0;
@ -74,7 +75,7 @@ protected:
void setProgress(unsigned int newProgress) { emit progressChanged(newProgress); }
void setDetails(const QString &text) { emit detailsChanged(text); }
bool startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels = true, const QString &extraPath = QString());
bool startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels = true, const QStringList *const extraPath = NULL);
JobObject *const m_jobObject;
const OptionsModel *const m_options;

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 7
#define VER_X264_PATCH 5
#define VER_X264_BUILD 1052
#define VER_X264_BUILD 1053
#define VER_X264_PORTABLE_EDITION (0)