From 0fa2a16e135c556b3f5839ad3f7086006b8e3f3d Mon Sep 17 00:00:00 2001 From: lordmulder Date: Mon, 24 Feb 2014 14:57:30 +0100 Subject: [PATCH] Refactored encoder version detection into encoder-specific classes. --- src/encoder_abstract.cpp | 57 +++++++-------- src/encoder_abstract.h | 11 ++- src/encoder_x264.cpp | 98 ++++++++++++++++++++++++++ src/encoder_x264.h | 38 ++++++++++ src/encoder_x265.cpp | 84 ++++++++++++++++++++++ src/encoder_x265.h | 38 ++++++++++ src/global.cpp | 15 +--- src/thread_encode.cpp | 69 ++++++++++-------- src/thread_encode.h | 5 +- src/tool_abstract.cpp | 7 +- src/tool_abstract.h | 12 ++-- src/version.h | 4 +- x264_launcher_MSVC2013.vcxproj | 4 ++ x264_launcher_MSVC2013.vcxproj.filters | 12 ++++ 14 files changed, 363 insertions(+), 91 deletions(-) create mode 100644 src/encoder_x264.cpp create mode 100644 src/encoder_x264.h create mode 100644 src/encoder_x265.cpp create mode 100644 src/encoder_x265.h diff --git a/src/encoder_abstract.cpp b/src/encoder_abstract.cpp index 3c88e40..3e5ba2d 100644 --- a/src/encoder_abstract.cpp +++ b/src/encoder_abstract.cpp @@ -29,6 +29,18 @@ #include +AbstractEncoder::AbstractEncoder(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort) +: + AbstractTool(jobId, jobObject, options, sysinfo, preferences, abort) +{ + /*Nothing to do here*/ +} + +AbstractEncoder::~AbstractEncoder(void) +{ + /*Nothing to do here*/ +} + unsigned int AbstractEncoder::checkVersion(bool &modified) { if(m_preferences->getSkipVersionTest()) @@ -38,22 +50,16 @@ unsigned int AbstractEncoder::checkVersion(bool &modified) } QProcess process; - QStringList cmdLine = QStringList() << "--version"; + QList patterns; + QStringList cmdLine; + + //Init encoder-specific values + checkVersion_init(patterns, cmdLine); log("Creating process:"); if(!startProcess(process, ENC_BINARY(m_sysinfo, m_options), cmdLine)) { - return false;; - } - - QRegExp regExpVersion("", Qt::CaseInsensitive); - QRegExp regExpVersionMod("\\bx264 (\\d)\\.(\\d+)\\.(\\d+)", Qt::CaseInsensitive); - - switch(m_options->encType()) - { - case OptionsModel::EncType_X264: regExpVersion.setPattern("\\bx264\\s(\\d)\\.(\\d+)\\.(\\d+)\\s([a-f0-9]{7})"); - case OptionsModel::EncType_X265: regExpVersion.setPattern("\\bHEVC\\s+encoder\\s+version\\s+0\\.(\\d+)\\+(\\d+)-[a-f0-9]+\\b"); - default: throw "Invalid encoder type!"; + return false; } bool bTimeout = false; @@ -87,25 +93,8 @@ unsigned int AbstractEncoder::checkVersion(bool &modified) QList lines = process.readLine().split('\r'); while(!lines.isEmpty()) { - QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); - int offset = -1; - if((offset = regExpVersion.lastIndexIn(text)) >= 0) - { - bool ok1 = false, ok2 = false; - unsigned int temp1 = regExpVersion.cap(2).toUInt(&ok1); - unsigned int temp2 = regExpVersion.cap(3).toUInt(&ok2); - if(ok1) coreVers = temp1; - if(ok2) revision = temp2; - } - else if((offset = regExpVersionMod.lastIndexIn(text)) >= 0) - { - bool ok1 = false, ok2 = false; - unsigned int temp1 = regExpVersionMod.cap(2).toUInt(&ok1); - unsigned int temp2 = regExpVersionMod.cap(3).toUInt(&ok2); - if(ok1) coreVers = temp1; - if(ok2) revision = temp2; - modified = true; - } + const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); + checkVersion_parseLine(text, patterns, coreVers, revision, modified); if(!text.isEmpty()) { log(text); @@ -121,6 +110,12 @@ unsigned int AbstractEncoder::checkVersion(bool &modified) process.waitForFinished(-1); } + while(!patterns.isEmpty()) + { + QRegExp *pattern = patterns.takeFirst(); + X264_DELETE(pattern); + } + if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS) { if(!(bTimeout || bAborted)) diff --git a/src/encoder_abstract.h b/src/encoder_abstract.h index 3bf8838..550dd0b 100644 --- a/src/encoder_abstract.h +++ b/src/encoder_abstract.h @@ -26,14 +26,19 @@ class QRegExp; template class QList; -class AbstractEncoder : AbstractTool +class AbstractEncoder : public AbstractTool { public: static const unsigned int REV_MULT = 10000; + AbstractEncoder(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort); + virtual ~AbstractEncoder(void); + virtual unsigned int checkVersion(bool &modified); + virtual bool isVersionSupported(const unsigned int &revision, const bool &modified) = 0; + virtual void printVersion(const unsigned int &revision, const bool &modified) = 0; protected: - virtual void checkVersion_init(QList *patterns) = 0; - virtual void checkVersion_parseLine(QRegExp *pattern, unsigned int &coreVers, unsigned int &revision, bool &modified) = 0; + virtual void checkVersion_init(QList &patterns, QStringList &cmdLine) = 0; + virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified) = 0; }; diff --git a/src/encoder_x264.cpp b/src/encoder_x264.cpp new file mode 100644 index 0000000..41619c3 --- /dev/null +++ b/src/encoder_x264.cpp @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2014 LoRd_MuldeR +// +// 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 "encoder_x264.h" + +#include "model_options.h" + +#include +#include + +//x264 version info +static const unsigned int X264_VERSION_X264_MINIMUM_REV = 2380; +static const unsigned int X264_VERSION_X264_CURRENT_API = 142; + +X264Encoder::X264Encoder(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort) +: + AbstractEncoder(jobId, jobObject, options, sysinfo, preferences, abort) +{ + if(options->encType() != OptionsModel::EncType_X264) + { + throw "Invalid encoder type!"; + } + +} + +X264Encoder::~X264Encoder(void) +{ + /*Nothing to do here*/ +} + +void X264Encoder::checkVersion_init(QList &patterns, QStringList &cmdLine) +{ + cmdLine << "--version"; + patterns << new QRegExp("\\bx264\\s(\\d)\\.(\\d+)\\.(\\d+)\\s([a-f0-9]{7})", Qt::CaseInsensitive); + patterns << new QRegExp("\\bx264 (\\d)\\.(\\d+)\\.(\\d+)", Qt::CaseInsensitive); +} + +void X264Encoder::checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified) +{ + int offset = -1; + if((offset = patterns[0]->lastIndexIn(line)) >= 0) + { + bool ok1 = false, ok2 = false; + unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1); + unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2); + if(ok1) coreVers = temp1; + if(ok2) revision = temp2; + } + else if((offset = patterns[1]->lastIndexIn(line)) >= 0) + { + bool ok1 = false, ok2 = false; + unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1); + unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2); + if(ok1) coreVers = temp1; + if(ok2) revision = temp2; + modified = true; + } +} + +void X264Encoder::printVersion(const unsigned int &revision, const bool &modified) +{ + log(tr("\nx264 revision: %1 (core #%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)).append(modified ? tr(" - with custom patches!") : QString())); +} + +bool X264Encoder::isVersionSupported(const unsigned int &revision, const bool &modified) +{ + if((revision % REV_MULT) < X264_VERSION_X264_MINIMUM_REV) + { + log(tr("\nERROR: Your revision of x264 is too old! (Minimum required revision is %1)").arg(QString::number(X264_VERSION_X264_MINIMUM_REV))); + return false; + } + + if((revision / REV_MULT) != X264_VERSION_X264_CURRENT_API) + { + log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!")); + log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(X264_VERSION_X264_CURRENT_API))); + } + + return true; +} diff --git a/src/encoder_x264.h b/src/encoder_x264.h new file mode 100644 index 0000000..bd1aa7f --- /dev/null +++ b/src/encoder_x264.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2014 LoRd_MuldeR +// +// 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 + +#include "encoder_abstract.h" + +class X264Encoder : public AbstractEncoder +{ +public: + X264Encoder(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort); + virtual ~X264Encoder(void); + + virtual void printVersion(const unsigned int &revision, const bool &modified); + virtual bool isVersionSupported(const unsigned int &revision, const bool &modified); + +protected: + virtual void checkVersion_init(QList &patterns, QStringList &cmdLine); + virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified); +}; diff --git a/src/encoder_x265.cpp b/src/encoder_x265.cpp new file mode 100644 index 0000000..52b40fa --- /dev/null +++ b/src/encoder_x265.cpp @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2014 LoRd_MuldeR +// +// 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 "encoder_x265.h" + +#include "model_options.h" + +#include +#include + +//x265 version info +static const unsigned int X265_VERSION_X264_MINIMUM_VER = 7; +static const unsigned int X265_VERSION_X264_MINIMUM_REV = 167; + +X265Encoder::X265Encoder(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort) +: + AbstractEncoder(jobId, jobObject, options, sysinfo, preferences, abort) +{ + if(options->encType() != OptionsModel::EncType_X265) + { + throw "Invalid encoder type!"; + } +} + +X265Encoder::~X265Encoder(void) +{ + /*Nothing to do here*/ +} + +void X265Encoder::checkVersion_init(QList &patterns, QStringList &cmdLine) +{ + cmdLine << "--version"; + patterns << new QRegExp("\\bHEVC\\s+encoder\\s+version\\s+0\\.(\\d+)\\+(\\d+)-[a-f0-9]+\\b", Qt::CaseInsensitive); +} + +void X265Encoder::checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified) +{ + int offset = -1; + if((offset = patterns[0]->lastIndexIn(line)) >= 0) + { + bool ok1 = false, ok2 = false; + unsigned int temp1 = patterns[0]->cap(1).toUInt(&ok1); + unsigned int temp2 = patterns[0]->cap(2).toUInt(&ok2); + if(ok1) coreVers = temp1; + if(ok2) revision = temp2; + } +} + +void X265Encoder::printVersion(const unsigned int &revision, const bool &modified) +{ + log(tr("\nx265 version: 0.%1+%2").arg(QString::number(revision / REV_MULT), QString::number(revision % REV_MULT))); +} + +bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &modified) +{ + const unsigned int ver = (revision / REV_MULT); + const unsigned int rev = (revision % REV_MULT); + + if((ver < X265_VERSION_X264_MINIMUM_VER) || (rev < X265_VERSION_X264_MINIMUM_REV)) + { + log(tr("\nERROR: Your version of x265 is too old! (Minimum required revision is 0.%1+%2)").arg(QString::number(X265_VERSION_X264_MINIMUM_VER), QString::number(X265_VERSION_X264_MINIMUM_REV))); + return false; + } + + return true; +} diff --git a/src/encoder_x265.h b/src/encoder_x265.h new file mode 100644 index 0000000..a70a7cd --- /dev/null +++ b/src/encoder_x265.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2014 LoRd_MuldeR +// +// 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 + +#include "encoder_abstract.h" + +class X265Encoder : public AbstractEncoder +{ +public: + X265Encoder(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort); + virtual ~X265Encoder(void); + + virtual void printVersion(const unsigned int &revision, const bool &modified); + virtual bool isVersionSupported(const unsigned int &revision, const bool &modified); + +protected: + virtual void checkVersion_init(QList &patterns, QStringList &cmdLine); + virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified); +}; diff --git a/src/global.cpp b/src/global.cpp index 185d07e..b096219 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -112,8 +112,6 @@ static const struct unsigned int ver_build; const char* ver_date; const char* ver_time; - unsigned int ver_x264_minimum_rev; - unsigned int ver_x264_current_api; unsigned int ver_x264_avs2yuv_ver; } g_x264_version = @@ -124,8 +122,6 @@ g_x264_version = (VER_X264_BUILD), __DATE__, __TIME__, - (VER_X264_MINIMUM_REV), - (VER_X264_CURRENT_API), (VER_X264_AVS2YUV_VER) }; @@ -763,16 +759,7 @@ const char *x264_version_arch(void) return g_x264_version_arch; } -unsigned int x264_version_x264_minimum_rev(void) -{ - return g_x264_version.ver_x264_minimum_rev; -} - -unsigned int x264_version_x264_current_api(void) -{ - return g_x264_version.ver_x264_current_api; -} - +//FIXME: Remove x264_version_x264_avs2yuv_ver! unsigned int x264_version_x264_avs2yuv_ver(void) { return g_x264_version.ver_x264_avs2yuv_ver; diff --git a/src/thread_encode.cpp b/src/thread_encode.cpp index 5b0c3a8..3e9eeac 100644 --- a/src/thread_encode.cpp +++ b/src/thread_encode.cpp @@ -25,6 +25,8 @@ #include "model_options.h" #include "model_preferences.h" #include "model_sysinfo.h" +#include "encoder_x264.h" +#include "encoder_x265.h" #include "job_object.h" #include "binaries.h" @@ -141,12 +143,27 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF { m_abort = false; m_pause = false; + + //Create encoder object + switch(options->encType()) + { + case OptionsModel::EncType_X264: + m_encoder = new X264Encoder(&m_jobId, m_jobObject, m_options, m_sysinfo, m_preferences, &m_abort); + break; + case OptionsModel::EncType_X265: + m_encoder = new X265Encoder(&m_jobId, m_jobObject, m_options, m_sysinfo, m_preferences, &m_abort); + break; + default: + throw "Unknown encoder type encountered!"; + } + } EncodeThread::~EncodeThread(void) { - X264_DELETE(m_options); + X264_DELETE(m_encoder); X264_DELETE(m_jobObject); + X264_DELETE(m_options); } /////////////////////////////////////////////////////////////////////////////// @@ -223,6 +240,10 @@ void EncodeThread::encode(void) { QDateTime startTime = QDateTime::currentDateTime(); + // ----------------------------------------------------------------------------------- + // Print Information + // ----------------------------------------------------------------------------------- + //Print some basic info log(tr("Simple x264 Launcher (Build #%1), built %2\n").arg(QString::number(x264_version_build()), x264_version_date().toString(Qt::ISODate))); log(tr("Job started at %1, %2.\n").arg(QDate::currentDate().toString(Qt::ISODate), QTime::currentTime().toString( Qt::ISODate))); @@ -250,12 +271,16 @@ void EncodeThread::encode(void) const int inputType = getInputType(QFileInfo(m_sourceFileName).suffix()); const QString indexFile = QString("%1/x264_%2.ffindex").arg(QDir::tempPath(), stringToHash(m_sourceFileName)); - //Checking x264 version + // ----------------------------------------------------------------------------------- + // Check Versions + // ----------------------------------------------------------------------------------- + log(tr("\n--- CHECK VERSION ---\n")); - unsigned int encoderRevision = UINT_MAX; + + //Check encoder version bool encoderModified = false; - ok = ((encoderRevision = checkVersionEncoder(encoderModified)) != UINT_MAX); - CHECK_STATUS(m_abort, ok); + unsigned int encoderRevision = m_encoder->checkVersion(encoderModified); + CHECK_STATUS(m_abort, (ok = (encoderRevision != UINT_MAX))); //Checking avs2yuv version unsigned int revision_avs2yuv = UINT_MAX; @@ -269,34 +294,17 @@ void EncodeThread::encode(void) CHECK_STATUS(m_abort, ok); //Print versions - switch(m_options->encType()) - { - case OptionsModel::EncType_X264: log(tr("\nx264 revision: %1 (core #%2)").arg(QString::number(encoderRevision % REV_MULT), QString::number(encoderRevision / REV_MULT)).append(encoderModified ? tr(" - with custom patches!") : QString())); break; - case OptionsModel::EncType_X265: log(tr("\nx265 version: 0.%1+%2").arg(QString::number(encoderRevision / REV_MULT), QString::number(encoderRevision % REV_MULT))); break; - } + m_encoder->printVersion(encoderRevision, encoderModified); if(revision_avs2yuv != UINT_MAX) { log(tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision_avs2yuv / REV_MULT), QString::number((revision_avs2yuv % REV_MULT) / 10),QString::number((revision_avs2yuv % REV_MULT) % 10))); } //Is encoder version suppoprted? - if(m_options->encType() == OptionsModel::EncType_X264) + if(!m_encoder->isVersionSupported(encoderRevision, encoderModified)) { - if((encoderRevision % REV_MULT) < x264_version_x264_minimum_rev()) - { - log(tr("\nERROR: Your revision of x264 is too old! (Minimum required revision is %2)").arg(QString::number(x264_version_x264_minimum_rev()))); - setStatus(JobStatus_Failed); - return; - } - if((encoderRevision / REV_MULT) != x264_version_x264_current_api()) - { - log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!")); - log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(x264_version_x264_current_api()))); - } - } - else if(m_options->encType() == OptionsModel::EncType_X264) - { - /*TODO*/ + setStatus(JobStatus_Failed); + return; } //Is Avs2YUV version supported? @@ -308,6 +316,10 @@ void EncodeThread::encode(void) return; } + // ----------------------------------------------------------------------------------- + // Detect Source Info + // ----------------------------------------------------------------------------------- + //Detect source info if(inputType != INPUT_NATIVE) { @@ -717,11 +729,6 @@ QStringList EncodeThread::buildCommandLine(const bool &usePipe, const unsigned i return cmdLine; } -unsigned int EncodeThread::checkVersionEncoder(bool &modified) -{ - -} - unsigned int EncodeThread::checkVersionAvs2yuv(void) { if(!m_sysinfo->hasAVSSupport()) diff --git a/src/thread_encode.h b/src/thread_encode.h index e67bc4b..f1f7b3c 100644 --- a/src/thread_encode.h +++ b/src/thread_encode.h @@ -34,6 +34,7 @@ class PreferencesModel; class OptionsModel; class QProcess; class JobObject; +class AbstractEncoder; class EncodeThread : public QThread { @@ -102,6 +103,9 @@ protected: JobStatus m_status; unsigned int m_progress; + //Encoder and Source objects + AbstractEncoder *m_encoder; + //Entry point virtual void run(void); virtual void checkedRun(void); @@ -110,7 +114,6 @@ protected: void encode(void); bool runEncodingPass(const int &inputType, const unsigned int &frames, const QString &indexFile, const int &pass = 0, const QString &passLogFile = QString()); QStringList buildCommandLine(const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass = 0, const QString &passLogFile = QString()); - unsigned int checkVersionEncoder(bool &modified); unsigned int checkVersionAvs2yuv(void); bool checkVersionVapoursynth(void); bool checkPropertiesAVS(unsigned int &frames); diff --git a/src/tool_abstract.cpp b/src/tool_abstract.cpp index d7bee94..8fd78f7 100644 --- a/src/tool_abstract.cpp +++ b/src/tool_abstract.cpp @@ -34,13 +34,14 @@ QMutex AbstractTool::s_mutexStartProcess; -AbstractTool::AbstractTool(volatile bool *abort, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobObject *jobObject) +AbstractTool::AbstractTool(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort) : - m_abort(abort), + m_jobId(jobId), + m_jobObject(jobObject), m_options(options), m_sysinfo(sysinfo), m_preferences(preferences), - m_jobObject(jobObject) + m_abort(abort) { /*nothing to do here*/ } diff --git a/src/tool_abstract.h b/src/tool_abstract.h index cb8743b..cdcb857 100644 --- a/src/tool_abstract.h +++ b/src/tool_abstract.h @@ -22,6 +22,7 @@ #pragma once #include +#include #include class OptionsModel; @@ -35,22 +36,23 @@ class AbstractTool : QObject Q_OBJECT public: - AbstractTool(volatile bool *abort, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobObject *jobObject); + AbstractTool(const QUuid *jobId, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, volatile bool *abort); virtual ~AbstractTool(void) {/*NOP*/} signals: - void messageLogged(const QString &text); + void messageLogged(const QUuid &jobId, const QString &text); protected: - void log(const QString &text) { emit messageLogged(text); } + inline void log(const QString &text) { emit messageLogged((*m_jobId), text); } bool startProcess(QProcess &process, const QString &program, const QStringList &args, bool mergeChannels = true); static QString commandline2string(const QString &program, const QStringList &arguments); + const QUuid *const m_jobId; + JobObject *const m_jobObject; const OptionsModel *const m_options; const SysinfoModel *const m_sysinfo; const PreferencesModel *const m_preferences; - JobObject *const m_jobObject; - volatile bool *const m_abort; + static QMutex s_mutexStartProcess; }; diff --git a/src/version.h b/src/version.h index d2f31ee..e40e2f9 100644 --- a/src/version.h +++ b/src/version.h @@ -26,10 +26,8 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 3 #define VER_X264_PATCH 2 -#define VER_X264_BUILD 780 +#define VER_X264_BUILD 782 -#define VER_X264_MINIMUM_REV 2380 -#define VER_X264_CURRENT_API 142 #define VER_X264_AVS2YUV_VER 242 #define VER_X264_PORTABLE_EDITION (0) diff --git a/x264_launcher_MSVC2013.vcxproj b/x264_launcher_MSVC2013.vcxproj index 7a6df44..82e9ea9 100644 --- a/x264_launcher_MSVC2013.vcxproj +++ b/x264_launcher_MSVC2013.vcxproj @@ -297,6 +297,8 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats" + + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" @@ -372,6 +374,8 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats" + + diff --git a/x264_launcher_MSVC2013.vcxproj.filters b/x264_launcher_MSVC2013.vcxproj.filters index 5d3ecc0..bdeeecb 100644 --- a/x264_launcher_MSVC2013.vcxproj.filters +++ b/x264_launcher_MSVC2013.vcxproj.filters @@ -90,6 +90,12 @@ Header Files + + Header Files + + + Header Files + @@ -215,6 +221,12 @@ Source Files + + Source Files + + + Source Files +