From a31c9cc1bd476f89850dc329beb3161a69c4cfca Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sun, 2 Oct 2016 17:34:48 +0200 Subject: [PATCH] Removed some debug outputs + adapted for changes in MUtils library. --- src/encoder_abstract.cpp | 2 +- src/source_abstract.cpp | 4 ++-- src/source_abstract.h | 2 +- src/source_avisynth.cpp | 6 +++--- src/source_avisynth.h | 2 +- src/thread_avisynth.cpp | 9 ++++----- src/tool_abstract.cpp | 7 +++---- src/tool_abstract.h | 5 +++-- src/version.h | 2 +- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/encoder_abstract.cpp b/src/encoder_abstract.cpp index dbfff0c..0fd458d 100644 --- a/src/encoder_abstract.cpp +++ b/src/encoder_abstract.cpp @@ -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; } diff --git a/src/source_abstract.cpp b/src/source_abstract.cpp index 1ab973f..b8a862f 100644 --- a/src/source_abstract.cpp +++ b/src/source_abstract.cpp @@ -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; } diff --git a/src/source_abstract.h b/src/source_abstract.h index 4fcd144..c044595 100644 --- a/src/source_abstract.h +++ b/src/source_abstract.h @@ -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 diff --git a/src/source_avisynth.cpp b/src/source_avisynth.cpp index 99aa97b..554419a 100644 --- a/src/source_avisynth.cpp +++ b/src/source_avisynth.cpp @@ -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(); } }; diff --git a/src/source_avisynth.h b/src/source_avisynth.h index 14115d6..6697b8c 100644 --- a/src/source_avisynth.h +++ b/src/source_avisynth.h @@ -50,6 +50,6 @@ protected: virtual void checkSourceProperties_parseLine(const QString &line, QList &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); }; diff --git a/src/thread_avisynth.cpp b/src/thread_avisynth.cpp index 42f9485..13a6d4f 100644 --- a/src/thread_avisynth.cpp +++ b/src/thread_avisynth.cpp @@ -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()); diff --git a/src/tool_abstract.cpp b/src/tool_abstract.cpp index 7aba793..14c040a 100644 --- a/src/tool_abstract.cpp +++ b/src/tool_abstract.cpp @@ -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); diff --git a/src/tool_abstract.h b/src/tool_abstract.h index ad7f6df..ac4e35e 100644 --- a/src/tool_abstract.h +++ b/src/tool_abstract.h @@ -24,6 +24,7 @@ #include #include #include +#include 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 &patterns, QStringList &cmdLine) = 0; virtual void checkVersion_parseLine(const QString &line, QList &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; diff --git a/src/version.h b/src/version.h index 7f0581f..d713eba 100644 --- a/src/version.h +++ b/src/version.h @@ -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)