#include <QLibrary>
#include <QEventLoop>
#include <QTimer>
-#include <QMutexLocker>
#include <QApplication>
-#include <QProcess>
#include <QDir>
//Internal
connect(&thread, SIGNAL(terminated()), &loop, SLOT(quit()));
thread.start();
- QTimer::singleShot(15000, &loop, SLOT(quit()));
+ QTimer::singleShot(30000, &loop, SLOT(quit()));
qDebug("Avisynth thread has been created, please wait...");
loop.exec(QEventLoop::ExcludeUserInputEvents);
{
qDebug("Avisynth %s-Bit support is being tested.", x64 ? "64" : "32");
- QProcess process;
- QStringList output;
-
//Look for "portable" Avisynth version
static const char *const ARCH_DIR[] = { "x64", "x86" };
const QLatin1String archSuffix = QLatin1String(ARCH_DIR[x64 ? 1 : 0]);
}
}
- //Setup process object
- 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());
- if(!process.waitForStarted())
+ //Get extra paths
+ QStringList avisynthExtraPaths;
+ if (!basePath.isEmpty())
{
- qWarning("Failed to launch AVS_CHECK.EXE -> %s", process.errorString().toUtf8().constData());
- return false;
+ avisynthExtraPaths << QString("%1/%2").arg(basePath, archSuffix);
}
- //Wait for process to finish
- while(process.state() != QProcess::NotRunning)
- {
- if(process.waitForReadyRead(12000))
- {
- while(process.canReadLine())
- {
- output << QString::fromUtf8(process.readLine()).simplified();
- }
- continue;
- }
- if(process.state() != QProcess::NotRunning)
- {
- qWarning("AVS_CHECK.EXE process encountered a deadlock -> aborting now!");
- break;
- }
- }
-
- //Make sure VSPIPE.EXE has terminated!
- process.waitForFinished(2500);
- if(process.state() != QProcess::NotRunning)
- {
- qWarning("AVS_CHECK.EXE process still running, going to kill it!");
- process.kill();
- process.waitForFinished(-1);
- }
-
- //Read pending lines
- while(process.canReadLine())
- {
- output << QString::fromUtf8(process.readLine()).simplified();
- }
-
- //Check exit code
- if(process.exitCode() != 0)
- {
- qWarning("AVS_CHECK.EXE failed with code 0x%08X -> disable Avisynth support!", process.exitCode());
- return false;
- }
+ //Setup process object
+ const QStringList output = runProcess(AVS_CHECK_BINARY(sysinfo, x64), QStringList(), &avisynthExtraPaths);
//Init regular expressions
QRegExp avsLogo("Avisynth\\s+Checker\\s+(x86|x64)");
#pragma once
-#include <QThread>
+#include "thread_startup.h"
+
#include <QMutex>
-class QLibrary;
class SysinfoModel;
class QFile;
-class AvisynthCheckThread : public QThread
+class AvisynthCheckThread : public StarupThread
{
Q_OBJECT
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Simple x264 Launcher
+// Copyright (C) 2004-2019 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// http://www.gnu.org/licenses/gpl-2.0.txt
+///////////////////////////////////////////////////////////////////////////////
+
+#include "thread_startup.h"
+
+//MUtils
+#include <MUtils/Global.h>
+
+//Qt
+#include <QDir>
+#include <QElapsedTimer>
+#include <QProcess>
+
+QStringList StarupThread::runProcess(const QString &exePath, const QStringList &arguments, const QStringList *const extraPaths)
+{
+ QProcess process;
+
+ //Get file name
+ const QString fileName = QFileInfo(exePath).fileName().toUpper();
+
+ //Setup process object
+ MUtils::init_process(process, QDir::tempPath(), true, extraPaths);
+
+ //Try to start process
+ process.start(exePath, arguments);
+ if (!process.waitForStarted())
+ {
+ qWarning("Failed to launch %s -> %s", MUTILS_UTF8(fileName), MUTILS_UTF8(process.errorString()));
+ return QStringList();
+ }
+
+ //Start the timer
+ QElapsedTimer timer;
+ timer.start();
+
+ //Wait until process has finished
+ QStringList processOutput;
+ while (process.state() != QProcess::NotRunning)
+ {
+ process.waitForReadyRead(1250);
+ while (process.canReadLine())
+ {
+ const QString line = QString::fromUtf8(process.readLine()).simplified();
+ if (!line.isEmpty())
+ {
+ processOutput << line;
+ }
+ }
+ if (timer.hasExpired(15000))
+ {
+ qWarning("%s process encountered a deadlock -> aborting now!", MUTILS_UTF8(fileName));
+ break;
+ }
+ }
+
+ //Make sure process has terminated!
+ process.waitForFinished(1250);
+ if (process.state() != QProcess::NotRunning)
+ {
+ qWarning("%s process still running, going to kill it!", MUTILS_UTF8(fileName));
+ process.kill();
+ process.waitForFinished(-1);
+ }
+
+ //Read pending lines
+ while (process.bytesAvailable() > 0)
+ {
+ const QString line = QString::fromUtf8(process.readLine()).simplified();
+ if (!line.isEmpty())
+ {
+ processOutput << line;
+ }
+ }
+
+ //Check exit code
+ if (process.exitCode() != 0)
+ {
+ qWarning("%s failed with code 0x%08X -> discarding all output!", MUTILS_UTF8(fileName), process.exitCode());
+ return QStringList();
+ }
+
+ return processOutput;
+}
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Simple x264 Launcher
+// Copyright (C) 2004-2019 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// http://www.gnu.org/licenses/gpl-2.0.txt
+///////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+//Qt
+#include <QThread>
+#include <QStringList>
+
+class StarupThread : public QThread
+{
+ Q_OBJECT
+
+protected:
+ static QStringList runProcess(const QString &exePath, const QStringList &args, const QStringList *const extraPaths = NULL);
+};
#include <QLibrary>
#include <QEventLoop>
#include <QTimer>
-#include <QMutexLocker>
#include <QApplication>
#include <QDir>
-#include <QProcess>
//Internal
#include "global.h"
connect(&thread, SIGNAL(terminated()), &loop, SLOT(quit()));
thread.start();
- QTimer::singleShot(15000, &loop, SLOT(quit()));
+ QTimer::singleShot(30000, &loop, SLOT(quit()));
qDebug("VapourSynth thread has been created, please wait...");
loop.exec(QEventLoop::ExcludeUserInputEvents);
bool VapourSynthCheckThread::checkVapourSynth(const QString &vspipePath)
{
- QProcess process;
- QStringList output;
-
- //Setup process object
- process.setWorkingDirectory(QDir::tempPath());
- process.setProcessChannelMode(QProcess::MergedChannels);
- process.setReadChannel(QProcess::StandardOutput);
-
- //Try to start VSPIPE.EXE
- process.start(vspipePath, QStringList() << "--version");
- if(!process.waitForStarted())
- {
- qWarning("Failed to launch VSPIPE.EXE -> %s", process.errorString().toUtf8().constData());
- return false;
- }
-
- //Wait for process to finish
- while(process.state() != QProcess::NotRunning)
- {
- if(process.waitForReadyRead(12000))
- {
- while(process.canReadLine())
- {
- output << QString::fromUtf8(process.readLine()).simplified();
- }
- continue;
- }
- if(process.state() != QProcess::NotRunning)
- {
- qWarning("VSPIPE.EXE process encountered a deadlock -> aborting now!");
- break;
- }
- }
-
- //Make sure VSPIPE.EXE has terminated!
- process.waitForFinished(2500);
- if(process.state() != QProcess::NotRunning)
- {
- qWarning("VSPIPE.EXE process still running, going to kill it!");
- process.kill();
- process.waitForFinished(-1);
- }
-
- //Read pending lines
- while(process.canReadLine())
- {
- output << QString::fromUtf8(process.readLine()).simplified();
- }
-
- //Check exit code
- if(process.exitCode() != 0)
- {
- qWarning("VSPIPE.EXE failed with code 0x%08X -> disable Vapousynth support!", process.exitCode());
- return false;
- }
+ //Try to run VSPIPE.EXE
+ const QStringList output = runProcess(vspipePath, QStringList() << "--version");
//Init regular expressions
QRegExp vpsLogo("VapourSynth\\s+Video\\s+Processing\\s+Library");
#pragma once
+#include "thread_startup.h"
+
//Qt
-#include <QThread>
#include <QMutex>
-class QLibrary;
class QFile;
class SysinfoModel;
-class VapourSynthCheckThread : public QThread
+class VapourSynthCheckThread : public StarupThread
{
Q_OBJECT
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 9
#define VER_X264_PATCH 0
-#define VER_X264_BUILD 1146
+#define VER_X264_BUILD 1154
#define VER_X264_PORTABLE_EDITION (0)
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ImportGroup Label="PropertySheets" />
+ <PropertyGroup Label="UserMacros">
+ <XPDeprecationWarning>false</XPDeprecationWarning>
+ </PropertyGroup>
+ <PropertyGroup />
+ <ItemDefinitionGroup />
+ <ItemGroup>
+ <BuildMacro Include="XPDeprecationWarning">
+ <Value>$(XPDeprecationWarning)</Value>
+ </BuildMacro>
+ </ItemGroup>
+</Project>
\ No newline at end of file
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="x264_launcher.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="x264_launcher.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\UIC_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\UIC_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
- <None Include="ReadMe.txt" />
<CustomBuild Include="res\resources.qrc">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<ClInclude Include="src\model_clipInfo.h" />
<ClInclude Include="src\source_factory.h" />
<ClInclude Include="src\string_validator.h" />
+ <CustomBuild Include="src\thread_startup.h">
+ <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
+ <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
+ <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
+ <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
+ </CustomBuild>
<ClInclude Include="tmp\x264_launcher\UIC_win_about.h" />
<ClInclude Include="tmp\x264_launcher\UIC_win_addJob.h" />
<ClInclude Include="tmp\x264_launcher\UIC_win_editor.h" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\thread_ipc_recv.cpp" />
<ClCompile Include="src\thread_ipc_send.cpp" />
+ <ClCompile Include="src\thread_startup.cpp" />
<ClCompile Include="src\thread_vapoursynth.cpp" />
<ClCompile Include="src\tool_abstract.cpp" />
<ClCompile Include="src\win_about.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_encode.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_recv.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_send.cpp" />
+ <ClCompile Include="tmp\x264_launcher\MOC_thread_startup.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_thread_vapoursynth.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_tool_abstract.cpp" />
<ClCompile Include="tmp\x264_launcher\MOC_win_about.cpp" />
</Filter>
</ItemGroup>
<ItemGroup>
- <None Include="ReadMe.txt" />
<None Include="res\icons\movie.ico">
<Filter>Resource Files</Filter>
</None>
<ClInclude Include="src\encoder_nvencc.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\thread_startup.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp">
<ClCompile Include="src\encoder_nvencc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\thread_startup.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tmp\x264_launcher\MOC_thread_startup.cpp">
+ <Filter>Generated Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\win_main.h">
REM ///////////////////////////////////////////////////////////////////////////
REM // Compress
REM ///////////////////////////////////////////////////////////////////////////
-"%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\x264_launcher.exe"
-"%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\MUtils32-1.dll"
-"%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\Qt*.dll"
+:: "%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\x264_launcher.exe"
+:: "%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\MUtils32-1.dll"
+:: "%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\Qt*.dll"
REM ///////////////////////////////////////////////////////////////////////////
REM // Attributes