diff --git a/gui/win_addJob.ui b/gui/win_addJob.ui
index a3111d7..0fc0e3c 100644
--- a/gui/win_addJob.ui
+++ b/gui/win_addJob.ui
@@ -253,16 +253,6 @@
-1
- -
-
- x264 (AVC)
-
-
- -
-
- x265 (HEVC)
-
-
@@ -303,16 +293,6 @@
-1
- -
-
- 32-Bit (x86)
-
-
- -
-
- 64-Bit (x86_64)
-
-
@@ -353,16 +333,6 @@
-1
- -
-
- 8-Bit
-
-
- -
-
- 10-Bit
-
-
@@ -425,26 +395,6 @@
-1
- -
-
- CRF
-
-
- -
-
- CQ
-
-
- -
-
- 2-Pass
-
-
- -
-
- ABR
-
-
@@ -618,56 +568,6 @@
-1
- -
-
- Ultrafast
-
-
- -
-
- Superfast
-
-
- -
-
- Veryfast
-
-
- -
-
- Faster
-
-
- -
-
- Fast
-
-
- -
-
- Medium
-
-
- -
-
- Slow
-
-
- -
-
- Slower
-
-
- -
-
- Veryslow
-
-
- -
-
- Placebo
-
-
diff --git a/src/binaries.cpp b/src/binaries.cpp
deleted file mode 100644
index ce8b3cc..0000000
--- a/src/binaries.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Simple x264 Launcher
-// Copyright (C) 2004-2015 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 "binaries.h"
-
-//Internal
-#include "global.h"
-#include "model_sysinfo.h"
-#include "model_preferences.h"
-#include "model_options.h"
-
-//MUtils
-#include
-
-/* --- Avisynth --- */
-
-QString AVS_BINARY(const SysinfoModel *sysinfo, const bool& x64)
-{
- return QString("%1/toolset/%2/avs2yuv_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
-}
-
-QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences)
-{
- const bool avs32 = sysinfo->getAvisynth(SysinfoModel::Avisynth_X86);
- const bool avs64 = sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64);
- return AVS_BINARY(sysinfo, (avs32 && avs64) ? preferences->getPrefer64BitSource() : avs64);
-}
-
-/* --- VapurSynth --- */
-
-QString VPS_BINARY(const SysinfoModel *sysinfo, const bool& x64)
-{
- return QString("%1/core%2/vspipe.exe").arg(sysinfo->getVPSPath(), (x64 ? "64" : "32"));
-}
-
-QString VPS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences)
-{
- const bool vps32 = sysinfo->getVapourSynth(SysinfoModel::VapourSynth_X86);
- const bool vps64 = sysinfo->getVapourSynth(SysinfoModel::VapourSynth_X64) && sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64);
- return VPS_BINARY(sysinfo, (vps32 && vps64) ? preferences->getPrefer64BitSource() : vps64);
-}
-
-/* --- AVS Checker--- */
-
-QString CHK_BINARY(const SysinfoModel *sysinfo, const bool& x64)
-{
- return QString("%1/toolset/%2/avs_check_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
-}
diff --git a/src/encoder_abstract.cpp b/src/encoder_abstract.cpp
index d2c001a..e835efb 100644
--- a/src/encoder_abstract.cpp
+++ b/src/encoder_abstract.cpp
@@ -28,7 +28,6 @@
#include "model_sysinfo.h"
#include "model_status.h"
#include "source_abstract.h"
-#include "binaries.h"
//MUtils
#include
diff --git a/src/encoder_abstract.h b/src/encoder_abstract.h
index e59ac58..594388c 100644
--- a/src/encoder_abstract.h
+++ b/src/encoder_abstract.h
@@ -32,10 +32,11 @@ class AbstractEncoderInfo
{
public:
virtual QFlags getVariants(void) const = 0;
- virtual QStringList getProfiles(const int &variant) const = 0;
+ virtual QStringList getProfiles(const OptionsModel::EncVariant &variant) const = 0;
virtual QStringList getTunings(void) const = 0;
+ virtual QStringList getPresets(void) const = 0;
virtual QStringList supportedOutputFormats(void) const = 0;
- virtual bool isRCModeSupported(const int rcMode) const = 0;
+ virtual bool isRCModeSupported(const OptionsModel::RCMode &rcMode) const = 0;
virtual bool isInputTypeSupported(const int format) const = 0;
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const = 0;
};
diff --git a/src/encoder_factory.cpp b/src/encoder_factory.cpp
index c99aee2..5d0d52e 100644
--- a/src/encoder_factory.cpp
+++ b/src/encoder_factory.cpp
@@ -49,7 +49,7 @@ AbstractEncoder *EncoderFactory::createEncoder(JobObject *jobObject, const Optio
return encoder;
}
-const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const int &encoderType)
+const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const OptionsModel::EncType &encoderType)
{
switch(encoderType)
{
diff --git a/src/encoder_factory.h b/src/encoder_factory.h
index bda5472..3f165bc 100644
--- a/src/encoder_factory.h
+++ b/src/encoder_factory.h
@@ -27,7 +27,7 @@ class EncoderFactory
{
public:
static AbstractEncoder *createEncoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile);
- static const AbstractEncoderInfo& getEncoderInfo(const int &encoderType);
+ static const AbstractEncoderInfo& getEncoderInfo(const OptionsModel::EncType &encoderType);
private:
EncoderFactory(void) {/*Disabled*/}
diff --git a/src/encoder_x264.cpp b/src/encoder_x264.cpp
index 5983638..f0a6d8b 100644
--- a/src/encoder_x264.cpp
+++ b/src/encoder_x264.cpp
@@ -25,7 +25,6 @@
#include "global.h"
#include "model_options.h"
#include "model_status.h"
-#include "binaries.h"
#include "mediainfo.h"
#include "model_sysinfo.h"
@@ -101,7 +100,6 @@ public:
virtual QStringList getTunings(void) const
{
QStringList tunings;
-
tunings << "Film" << "Animation" << "Grain";
tunings << "StillImage" << "PSNR" << "SSIM";
tunings << "FastDecode" << "ZeroLatency" << "Touhou";
@@ -109,7 +107,15 @@ public:
return tunings;
}
- virtual QStringList getProfiles(const int &variant) const
+ virtual QStringList getPresets(void) const
+ {
+ QStringList presets;
+ presets << "ultrafast" << "superfast" << "veryfast" << "faster" << "fast";
+ presets << "medium" << "slow" << "slower" << "veryslow" << "placebo";
+ return presets;
+ }
+
+ virtual QStringList getProfiles(const OptionsModel::EncVariant &variant) const
{
QStringList profiles;
@@ -132,7 +138,7 @@ public:
return extLst;
}
- virtual bool isRCModeSupported(const int rcMode) const
+ virtual bool isRCModeSupported(const OptionsModel::RCMode &rcMode) const
{
switch(rcMode)
{
diff --git a/src/encoder_x265.cpp b/src/encoder_x265.cpp
index 2851843..3f9842d 100644
--- a/src/encoder_x265.cpp
+++ b/src/encoder_x265.cpp
@@ -25,7 +25,6 @@
#include "global.h"
#include "model_options.h"
#include "model_status.h"
-#include "binaries.h"
#include "mediainfo.h"
#include "model_sysinfo.h"
@@ -106,7 +105,15 @@ public:
return tunings;
}
- virtual QStringList getProfiles(const int &variant) const
+ virtual QStringList getPresets(void) const
+ {
+ QStringList presets;
+ presets << "ultrafast" << "superfast" << "veryfast" << "faster" << "fast";
+ presets << "medium" << "slow" << "slower" << "veryslow" << "placebo";
+ return presets;
+ }
+
+ virtual QStringList getProfiles(const OptionsModel::EncVariant &variant) const
{
QStringList profiles;
switch(variant)
@@ -131,7 +138,7 @@ public:
return extLst;
}
- virtual bool isRCModeSupported(const int rcMode) const
+ virtual bool isRCModeSupported(const OptionsModel::RCMode &rcMode) const
{
switch(rcMode)
{
diff --git a/src/source_abstract.cpp b/src/source_abstract.cpp
index 02396fe..dc6abf3 100644
--- a/src/source_abstract.cpp
+++ b/src/source_abstract.cpp
@@ -29,6 +29,7 @@
//MUtils
#include
+#include
//Qt
#include
@@ -201,3 +202,12 @@ bool AbstractSource::createProcess(QProcess &processEncode, QProcess&processInpu
return true;
}
+
+// ------------------------------------------------------------
+// Source Info
+// ------------------------------------------------------------
+
+const AbstractSourceInfo& AbstractSource::getSourceInfo(void)
+{
+ MUTILS_THROW("[getSourceInfo] This function must be overwritten in sub-classes!");
+}
diff --git a/src/source_abstract.h b/src/source_abstract.h
index 7564a90..978e7d8 100644
--- a/src/source_abstract.h
+++ b/src/source_abstract.h
@@ -22,11 +22,18 @@
#pragma once
#include "tool_abstract.h"
+#include "model_options.h"
class QRegExp;
template class QList;
class QProcess;
+class AbstractSourceInfo
+{
+public:
+ virtual QString getBinaryPath(const SysinfoModel *sysinfo, const bool& x64) const = 0;
+};
+
class AbstractSource : public AbstractTool
{
public:
@@ -38,6 +45,8 @@ public:
virtual bool createProcess(QProcess &processEncode, QProcess&processInput);
virtual void flushProcess(QProcess &processInput) = 0;
+ static const AbstractSourceInfo& getSourceInfo(void);
+
protected:
virtual void checkSourceProperties_init(QList &patterns, QStringList &cmdLine) = 0;
virtual void checkSourceProperties_parseLine(const QString &line, QList &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen) = 0;
diff --git a/src/source_avisynth.cpp b/src/source_avisynth.cpp
index aaebee2..5bcd6ed 100644
--- a/src/source_avisynth.cpp
+++ b/src/source_avisynth.cpp
@@ -24,24 +24,39 @@
#include "source_avisynth.h"
#include "global.h"
-#include "model_sysinfo.h"
-#include "model_preferences.h"
-#include "binaries.h"
#include
#include
static const unsigned int VER_X264_AVS2YUV_VER = 243;
+// ------------------------------------------------------------
+// Encoder Info
+// ------------------------------------------------------------
+
+class AvisynthSourceInfo : public AbstractSourceInfo
+{
+public:
+ virtual QString getBinaryPath(const SysinfoModel *sysinfo, const bool& x64) const
+ {
+ return QString("%1/toolset/%2/avs2yuv_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
+ }
+};
+
+static const AvisynthSourceInfo s_avisynthEncoderInfo;
+
+const AbstractSourceInfo &AvisynthSource::getSourceInfo(void)
+{
+ return s_avisynthEncoderInfo;
+}
+
// ------------------------------------------------------------
// Constructor & Destructor
// ------------------------------------------------------------
AvisynthSource::AvisynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
:
- AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile),
- m_sourceName("Avisynth (avs)"),
- m_binaryFile(AVS_BINARY(m_sysinfo, m_preferences))
+ AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile)
{
/*Nothing to do here*/
}
@@ -53,7 +68,7 @@ AvisynthSource::~AvisynthSource(void)
QString AvisynthSource::getName(void) const
{
- return m_sourceName;
+ return tr("Avisynth (avs)");
}
// ------------------------------------------------------------
diff --git a/src/source_avisynth.h b/src/source_avisynth.h
index b5a2809..e336eb6 100644
--- a/src/source_avisynth.h
+++ b/src/source_avisynth.h
@@ -22,6 +22,8 @@
#pragma once
#include "source_abstract.h"
+#include "model_sysinfo.h"
+#include "model_preferences.h"
class AvisynthSource : public AbstractSource
{
@@ -37,6 +39,8 @@ public:
virtual void flushProcess(QProcess &processInput);
+ static const AbstractSourceInfo& getSourceInfo(void);
+
protected:
virtual void checkVersion_init(QList &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified);
@@ -45,9 +49,6 @@ protected:
virtual void checkSourceProperties_init(QList &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
- virtual QString getBinaryPath() const { return m_binaryFile; }
+ virtual QString getBinaryPath() const { return getSourceInfo().getBinaryPath(m_sysinfo, (m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_preferences->getPrefer64BitSource())); }
virtual void buildCommandLine(QStringList &cmdLine);
-
- const QString m_sourceName;
- const QString m_binaryFile;
};
diff --git a/src/source_factory.cpp b/src/source_factory.cpp
new file mode 100644
index 0000000..c0d3b4d
--- /dev/null
+++ b/src/source_factory.cpp
@@ -0,0 +1,54 @@
+///////////////////////////////////////////////////////////////////////////////
+// Simple x264 Launcher
+// Copyright (C) 2004-2015 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 "source_factory.h"
+
+//Internal
+#include "source_avisynth.h"
+#include "source_vapoursynth.h"
+
+//MUtils
+#include
+
+AbstractSource *SourceFactory::createSource(const SourceType &type, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
+{
+ AbstractSource *source = NULL;
+ switch(type)
+ {
+ case SourceType_AVS: source = new AvisynthSource (jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile); break;
+ case SourceType_VPS: source = new VapoursynthSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile); break;
+ default: MUTILS_THROW("Invalid source type!");
+ }
+ return source;
+}
+
+const AbstractSourceInfo& SourceFactory::getSourceInfo(const SourceType &type)
+{
+ const AbstractSourceInfo *sourceInfo = NULL;
+ switch(type)
+ {
+ case SourceType_AVS: sourceInfo = &AvisynthSource ::getSourceInfo(); break;
+ case SourceType_VPS: sourceInfo = &VapoursynthSource::getSourceInfo(); break;
+ default: MUTILS_THROW("Invalid source type!");
+ }
+ return (*sourceInfo);
+}
+
diff --git a/src/binaries.h b/src/source_factory.h
similarity index 61%
rename from src/binaries.h
rename to src/source_factory.h
index 3a48037..de8f223 100644
--- a/src/binaries.h
+++ b/src/source_factory.h
@@ -19,15 +19,25 @@
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
-#include "model_options.h"
+#pragma once
-class SysinfoModel;
-class PreferencesModel;
+#include "source_abstract.h"
-QString AVS_BINARY(const SysinfoModel *sysinfo, const bool &x64);
-QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);
+class SourceFactory
+{
+public:
+ enum SourceType
+ {
+ SourceType_AVS = 0,
+ SourceType_VPS = 1,
-QString VPS_BINARY(const SysinfoModel *sysinfo, const bool& x64);
-QString VPS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);
+ SourceType_MIN = SourceType_AVS,
+ SourceType_MAX = SourceType_VPS
+ };
-QString CHK_BINARY(const SysinfoModel *sysinfo, const bool &x64);
+ static AbstractSource *createSource(const SourceType &type, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile);
+ static const AbstractSourceInfo& getSourceInfo(const SourceType &type);
+
+private:
+ SourceFactory(void) {/*Disabled*/}
+};
diff --git a/src/source_vapoursynth.cpp b/src/source_vapoursynth.cpp
index 52b2eba..f49224c 100644
--- a/src/source_vapoursynth.cpp
+++ b/src/source_vapoursynth.cpp
@@ -24,9 +24,6 @@
#include "source_vapoursynth.h"
#include "global.h"
-#include "model_sysinfo.h"
-#include "model_preferences.h"
-#include "binaries.h"
#include
#include
@@ -34,11 +31,33 @@
static const unsigned int VER_X264_VSPIPE_API = 3;
static const unsigned int VER_X264_VSPIPE_VER = 24;
+// ------------------------------------------------------------
+// Encoder Info
+// ------------------------------------------------------------
+
+class VapoursyntSourceInfo : public AbstractSourceInfo
+{
+public:
+ virtual QString getBinaryPath(const SysinfoModel *sysinfo, const bool& x64) const
+ {
+ return QString("%1/core%2/vspipe.exe").arg(sysinfo->getVPSPath(), (x64 ? "64" : "32"));
+ }
+};
+
+static const VapoursyntSourceInfo s_vapoursynthEncoderInfo;
+
+const AbstractSourceInfo &VapoursynthSource::getSourceInfo(void)
+{
+ return s_vapoursynthEncoderInfo;
+}
+
+// ------------------------------------------------------------
+// Constructor & Destructor
+// ------------------------------------------------------------
+
VapoursynthSource::VapoursynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
:
- AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile),
- m_sourceName("VapourSynth (vpy)"),
- m_binaryFile(VPS_BINARY(m_sysinfo, m_preferences))
+ AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile)
{
/*Nothing to do here*/
}
@@ -50,7 +69,7 @@ VapoursynthSource::~VapoursynthSource(void)
QString VapoursynthSource::getName(void) const
{
- return m_sourceName;
+ return tr("VapourSynth (vpy)");
}
// ------------------------------------------------------------
@@ -59,7 +78,7 @@ QString VapoursynthSource::getName(void) const
bool VapoursynthSource::isSourceAvailable()
{
- if(!(m_sysinfo->hasVapourSynth() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(VPS_BINARY(m_sysinfo, m_preferences)).isFile()))
+ if(!(m_sysinfo->hasVapourSynth() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(getBinaryPath()).isFile()))
{
log(tr("\nVPY INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
return false;
diff --git a/src/source_vapoursynth.h b/src/source_vapoursynth.h
index caf7216..0d6f05a 100644
--- a/src/source_vapoursynth.h
+++ b/src/source_vapoursynth.h
@@ -22,6 +22,8 @@
#pragma once
#include "source_abstract.h"
+#include "model_sysinfo.h"
+#include "model_preferences.h"
class VapoursynthSource : public AbstractSource
{
@@ -37,6 +39,8 @@ public:
virtual void flushProcess(QProcess &processInput);
+ static const AbstractSourceInfo& getSourceInfo(void);
+
protected:
virtual void checkVersion_init(QList &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified);
@@ -44,9 +48,6 @@ protected:
virtual void checkSourceProperties_init(QList &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
- virtual QString getBinaryPath() const { return m_binaryFile; }
+ virtual QString getBinaryPath() const { return getSourceInfo().getBinaryPath(m_sysinfo, (m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_preferences->getPrefer64BitSource())); }
virtual void buildCommandLine(QStringList &cmdLine);
-
- const QString m_sourceName;
- const QString m_binaryFile;
};
diff --git a/src/thread_avisynth.cpp b/src/thread_avisynth.cpp
index 4e70256..b4c583d 100644
--- a/src/thread_avisynth.cpp
+++ b/src/thread_avisynth.cpp
@@ -32,7 +32,6 @@
//Internal
#include "global.h"
#include "model_sysinfo.h"
-#include "binaries.h"
//MUtils
#include
@@ -42,8 +41,15 @@
QMutex AvisynthCheckThread::m_avsLock;
QScopedPointer AvisynthCheckThread::m_avsDllPath[2];
+//Helper
#define BOOLIFY(X) ((X) ? '1' : '0')
+//Utility function
+QString AVS_CHECK_BINARY(const SysinfoModel *sysinfo, const bool& x64)
+{
+ return QString("%1/toolset/%2/avs_check_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
+}
+
class Wow64RedirectionDisabler
{
public:
@@ -221,7 +227,7 @@ bool AvisynthCheckThread::checkAvisynth(const SysinfoModel *const sysinfo, QFile
process.setReadChannel(QProcess::StandardOutput);
//Try to start VSPIPE.EXE
- process.start(CHK_BINARY(sysinfo, x64), QStringList());
+ process.start(AVS_CHECK_BINARY(sysinfo, x64), QStringList());
if(!process.waitForStarted())
{
qWarning("Failed to launch AVS_CHECK.EXE -> %s", process.errorString().toUtf8().constData());
diff --git a/src/thread_binaries.cpp b/src/thread_binaries.cpp
index cc26b49..ac7a3c1 100644
--- a/src/thread_binaries.cpp
+++ b/src/thread_binaries.cpp
@@ -33,8 +33,8 @@
#include "global.h"
#include "model_sysinfo.h"
#include "win_updater.h"
-#include "binaries.h"
#include "encoder_factory.h"
+#include "source_factory.h"
//MUtils
#include
@@ -48,6 +48,9 @@ QScopedPointer BinariesCheckThread::m_binPath[MAX_BINARIES];
#define NEXT(X) ((*reinterpret_cast(&(X)))++)
#define SHFL(X) ((*reinterpret_cast(&(X))) <<= 1)
+//External
+QString AVS_CHECK_BINARY(const SysinfoModel *sysinfo, const bool& x64);
+
//-------------------------------------
// External API
//-------------------------------------
@@ -158,10 +161,10 @@ void BinariesCheckThread::checkBinaries3(volatile bool &success, const SysinfoMo
}
}
}
- for(OptionsModel::EncArch arch = OptionsModel::EncArch_x86_32; arch <= OptionsModel::EncArch_x86_64; NEXT(arch))
+ for(int i = 0; i < 2; i++)
{
- binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
- binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
+ binFiles << SourceFactory::getSourceInfo(SourceFactory::SourceType_AVS).getBinaryPath(sysinfo, bool(i));
+ binFiles << AVS_CHECK_BINARY(sysinfo, bool(i));
}
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
{
diff --git a/src/thread_encode.cpp b/src/thread_encode.cpp
index afec867..a18e442 100644
--- a/src/thread_encode.cpp
+++ b/src/thread_encode.cpp
@@ -27,15 +27,13 @@
#include "model_preferences.h"
#include "model_sysinfo.h"
#include "job_object.h"
-#include "binaries.h"
#include "mediainfo.h"
//Encoders
#include "encoder_factory.h"
//Source
-#include "source_avisynth.h"
-#include "source_vapoursynth.h"
+#include "source_factory.h"
//MUtils
#include
@@ -139,13 +137,13 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF
case MediaInfo::FILETYPE_AVISYNTH:
if(m_sysinfo->hasAvisynth())
{
- m_pipedSource = new AvisynthSource (m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
+ m_pipedSource = SourceFactory::createSource(SourceFactory::SourceType_AVS, m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
}
break;
case MediaInfo::FILETYPE_VAPOURSYNTH:
if(m_sysinfo->hasVapourSynth())
{
- m_pipedSource = new VapoursynthSource(m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
+ m_pipedSource = SourceFactory::createSource(SourceFactory::SourceType_VPS, m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
}
break;
}
diff --git a/src/tool_abstract.cpp b/src/tool_abstract.cpp
index f2bbd88..f2f67b9 100644
--- a/src/tool_abstract.cpp
+++ b/src/tool_abstract.cpp
@@ -26,7 +26,6 @@
#include "model_options.h"
#include "model_preferences.h"
#include "model_sysinfo.h"
-#include "binaries.h"
#include "job_object.h"
//MUtils
diff --git a/src/version.h b/src/version.h
index 91dcf2a..5b6a322 100644
--- a/src/version.h
+++ b/src/version.h
@@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 6
#define VER_X264_PATCH 0
-#define VER_X264_BUILD 958
+#define VER_X264_BUILD 962
#define VER_X264_PORTABLE_EDITION (0)
diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp
index 2bc54ee..b0e391b 100644
--- a/src/win_addJob.cpp
+++ b/src/win_addJob.cpp
@@ -89,18 +89,6 @@
WIDGET->addAction(_action); \
}
-static void setIndexByData(QComboBox *const box, const int &data)
-{
- for(int i = 0; i < box->count(); i++)
- {
- if(box->itemData(i).toInt() == data)
- {
- box->setCurrentIndex(i);
- break;
- }
- }
-}
-
Q_DECLARE_METATYPE(const void*)
///////////////////////////////////////////////////////////////////////////////
@@ -270,6 +258,20 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
setMinimumSize(size());
setMaximumHeight(height());
+ //Init encoder combobox
+ ui->cbxEncoderType->addItem(tr("x264 (AVC)"), OptionsModel::EncType_X264);
+ ui->cbxEncoderType->addItem(tr("x265 (HEVC)"), OptionsModel::EncType_X265);
+
+ //Init arch combobox
+ ui->cbxEncoderArch->addItem(tr("32-Bit"), OptionsModel::EncArch_x86_32);
+ ui->cbxEncoderArch->addItem(tr("64-Bit"), OptionsModel::EncArch_x86_64);
+
+ //Init rc-mode combobox
+ ui->cbxRateControlMode->addItem(tr("CRF"), OptionsModel::RCMode_CRF);
+ ui->cbxRateControlMode->addItem(tr("CQ"), OptionsModel::RCMode_CQ);
+ ui->cbxRateControlMode->addItem(tr("2-Pass"), OptionsModel::RCMode_2Pass);
+ ui->cbxRateControlMode->addItem(tr("ABR"), OptionsModel::RCMode_ABR);
+
//Init combobox items
ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
@@ -464,7 +466,8 @@ void AddJobDialog::dropEvent(QDropEvent *event)
void AddJobDialog::encoderIndexChanged(int index)
{
- const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
+ const OptionsModel::EncType encType = static_cast(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
+ const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Update encoder variants
const QFlags variants = encoderInfo.getVariants();
@@ -485,8 +488,23 @@ void AddJobDialog::encoderIndexChanged(int index)
}
}
+ //Update presets
+ const QStringList presets = encoderInfo.getPresets();
+ if(presets.empty())
+ {
+ ui->cbxPreset->setEnabled(false);
+ ui->cbxPreset->setCurrentIndex(0);
+ }
+ else
+ {
+ ui->cbxPreset->setEnabled(true);
+ ui->cbxPreset->clear();
+ ui->cbxPreset->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
+ ui->cbxPreset->addItems(presets);
+ }
+
//Update tunings
- QStringList tunings = encoderInfo.getTunings();
+ const QStringList tunings = encoderInfo.getTunings();
if(tunings.empty())
{
ui->cbxTuning->setEnabled(false);
@@ -505,10 +523,11 @@ void AddJobDialog::encoderIndexChanged(int index)
void AddJobDialog::variantIndexChanged(int index)
{
- const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
+ const OptionsModel::EncType encType = static_cast(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
+ const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Update encoder profiles
- QStringList profiles = encoderInfo.getProfiles(index);
+ const QStringList profiles = encoderInfo.getProfiles(static_cast(ui->cbxEncoderVariant->itemData(index).toInt()));
if(profiles.empty())
{
ui->cbxProfile->setEnabled(false);
@@ -562,15 +581,16 @@ void AddJobDialog::accept(void)
}
//Get encoder info
- const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
+ const OptionsModel::EncType encType = static_cast(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
+ const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Is selected RC mode supported?
- if(!encoderInfo.isRCModeSupported(ui->cbxRateControlMode->currentIndex()))
+ if(!encoderInfo.isRCModeSupported(static_cast(ui->cbxRateControlMode->currentIndex())))
{
QMessageBox::warning(this, tr("Bad RC Mode!"), tr("The selected RC mode is not supported by the selected encoder!"));
for(int i = 0; i < ui->cbxRateControlMode->count(); i++)
{
- if(encoderInfo.isRCModeSupported(i))
+ if(encoderInfo.isRCModeSupported(static_cast(i)))
{
ui->cbxRateControlMode->setCurrentIndex(i);
break;
@@ -991,7 +1011,7 @@ void AddJobDialog::loadTemplateList(void)
}
}
-void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
+void AddJobDialog::updateComboBox(QComboBox *const cbox, const QString &text)
{
int index = 0;
if(QAbstractItemModel *model = cbox->model())
@@ -1008,15 +1028,32 @@ void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
cbox->setCurrentIndex(index);
}
+void AddJobDialog::updateComboBox(QComboBox *const cbox, const int &data)
+{
+ int index = 0;
+ if(QAbstractItemModel *model = cbox->model())
+ {
+ for(int i = 0; i < cbox->model()->rowCount(); i++)
+ {
+ if(model->itemData(model->index(i, 0, QModelIndex())).value(Qt::UserRole).toInt() == index)
+ {
+ index = i;
+ break;
+ }
+ }
+ }
+ cbox->setCurrentIndex(index);
+}
+
void AddJobDialog::restoreOptions(const OptionsModel *options)
{
//Ignore config changes while restoring template!
m_monitorConfigChanges = false;
- ui->cbxEncoderType ->setCurrentIndex(options->encType());
- ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
- setIndexByData(ui->cbxEncoderVariant, options->encVariant());
- ui->cbxRateControlMode -> setCurrentIndex(options->rcMode());
+ updateComboBox(ui->cbxEncoderType, options->encType());
+ updateComboBox(ui->cbxEncoderArch, options->encArch());
+ updateComboBox(ui->cbxEncoderVariant, options->encVariant());
+ updateComboBox(ui->cbxRateControlMode, options->rcMode());
ui->spinQuantizer->setValue(options->quantizer());
ui->spinBitrate ->setValue(options->bitrate());
@@ -1028,16 +1065,19 @@ void AddJobDialog::restoreOptions(const OptionsModel *options)
ui->editCustomX264Params ->setText(options->customEncParams());
ui->editCustomAvs2YUVParams->setText(options->customAvs2YUV());
+ //Force UI update
+ encoderIndexChanged(ui->cbxEncoderType->currentIndex());
+
//Make sure we will monitor config changes again!
m_monitorConfigChanges = true;
}
void AddJobDialog::saveOptions(OptionsModel *options)
{
- options->setEncType(static_cast(ui->cbxEncoderType->currentIndex()));
- options->setEncArch(static_cast(ui->cbxEncoderArch->currentIndex()));
- options->setEncVariant(static_cast(ui->cbxEncoderVariant->itemData(ui->cbxEncoderVariant->currentIndex()).toInt()));
- options->setRCMode(static_cast(ui->cbxRateControlMode->currentIndex()));
+ options->setEncType (static_cast (ui->cbxEncoderType ->itemData(ui->cbxEncoderType ->currentIndex()).toInt()));
+ options->setEncArch (static_cast (ui->cbxEncoderArch ->itemData(ui->cbxEncoderArch ->currentIndex()).toInt()));
+ options->setEncVariant(static_cast(ui->cbxEncoderVariant ->itemData(ui->cbxEncoderVariant ->currentIndex()).toInt()));
+ options->setRCMode (static_cast (ui->cbxRateControlMode->itemData(ui->cbxRateControlMode->currentIndex()).toInt()));
options->setQuantizer(ui->spinQuantizer->value());
options->setBitrate(ui->spinBitrate->value());
@@ -1094,7 +1134,8 @@ QString AddJobDialog::currentOutputPath(const bool bWithName)
int AddJobDialog::currentOutputIndx(void)
{
- if(ui->cbxEncoderType->currentIndex() == OptionsModel::EncType_X265)
+ const OptionsModel::EncType encType = static_cast(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
+ if(encType == OptionsModel::EncType_X265)
{
return ARRAY_SIZE(X264_FILE_TYPE_FILTERS) - 1;
}
diff --git a/src/win_addJob.h b/src/win_addJob.h
index 0bb1b05..1ad4a13 100644
--- a/src/win_addJob.h
+++ b/src/win_addJob.h
@@ -97,7 +97,8 @@ private:
void loadTemplateList(void);
void restoreOptions(const OptionsModel *options);
void saveOptions(OptionsModel *options);
- void updateComboBox(QComboBox *cbox, const QString &text);
+ void updateComboBox(QComboBox *const cbox, const QString &text);
+ void updateComboBox(QComboBox *const cbox, const int &data);
QString currentSourcePath(const bool bWithName = false);
QString currentOutputPath(const bool bWithName = false);
diff --git a/src/win_help.cpp b/src/win_help.cpp
index 8a49034..4dce732 100644
--- a/src/win_help.cpp
+++ b/src/win_help.cpp
@@ -25,8 +25,10 @@
//Internal
#include "global.h"
#include "model_options.h"
-#include "binaries.h"
+#include "model_sysinfo.h"
+#include "model_preferences.h"
#include "encoder_factory.h"
+#include "source_factory.h"
//MUtils
#include
@@ -91,7 +93,7 @@ void HelpDialog::showEvent(QShowEvent *event)
}
else
{
- m_process->start(AVS_BINARY(m_sysinfo, m_preferences), QStringList());
+ m_process->start(SourceFactory::getSourceInfo(SourceFactory::SourceType_AVS).getBinaryPath(m_sysinfo, m_preferences->getPrefer64BitSource() && m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)), QStringList());
}
if(!m_process->waitForStarted())
diff --git a/src/win_main.cpp b/src/win_main.cpp
index 935b9b3..e9ae9fb 100644
--- a/src/win_main.cpp
+++ b/src/win_main.cpp
@@ -42,7 +42,6 @@
#include "win_about.h"
#include "win_preferences.h"
#include "win_updater.h"
-#include "binaries.h"
#include "resource.h"
//MUtils
diff --git a/x264_launcher_MSVC2013.vcxproj b/x264_launcher_MSVC2013.vcxproj
index 7ce05ad..079f08e 100644
--- a/x264_launcher_MSVC2013.vcxproj
+++ b/x264_launcher_MSVC2013.vcxproj
@@ -285,6 +285,7 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)
$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)
+
@@ -349,7 +350,6 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)
-
@@ -426,7 +426,6 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
-
@@ -441,6 +440,7 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
+
diff --git a/x264_launcher_MSVC2013.vcxproj.filters b/x264_launcher_MSVC2013.vcxproj.filters
index 4c020d1..2aa795a 100644
--- a/x264_launcher_MSVC2013.vcxproj.filters
+++ b/x264_launcher_MSVC2013.vcxproj.filters
@@ -63,9 +63,6 @@
Header Files
-
- Header Files
-
Header Files
@@ -111,6 +108,9 @@
Generated Files
+
+ Header Files
+
@@ -164,9 +164,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -266,6 +263,9 @@
Generated Files
+
+ Source Files
+