Refactored code to better manage the encoder binary paths: They are now handled by the individual EncoderInfo class. Also added 12-Bit x265 encoder binaries.

This commit is contained in:
LoRd_MuldeR 2015-08-02 19:16:37 +02:00
parent 439ec45621
commit d88c4ca553
24 changed files with 242 additions and 197 deletions

View File

@ -35,7 +35,7 @@ The minimum system requirements to run Simple x264/x265 Launcher are as follows:
* Windows XP with Service Pack 2 or any later Windows system – note that Windows XP is **not** recommended!
* 64-Bit editions of Windows are highly recommended, though 32-Bit editions will work as well
* The CPU must support at least the MMX and SSE instruction sets
* Avisynth input only available with [Avisynth](http://avisynth.nl/index.php/Main_Page#Official_builds) **2.5+** installed – note that Avisynth **2.6** is recommended these days!
* Avisynth input only available with [Avisynth](http://avisynth.nl/index.php/Main_Page#Official_builds) **2.6** installed – Avisynth **2.5.x** is *not* recommended!
* VapourSynth input only available with [VapourSynth](http://www.vapoursynth.com/) **r24+** installed – [Python](https://www.python.org/downloads/windows/) is a prerequisite for VapourSynth!
* YV16/YV24 color spaces require Avisynth 2.6 (see section 10)

View File

@ -30,60 +30,6 @@
//MUtils
#include <MUtils/Exception.h>
/* --- Encooders --- */
QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel::EncType &encType, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant)
{
QString baseName, arch, variant;
//Encoder Type
switch(encType)
{
case OptionsModel::EncType_X264: baseName = "x264"; break;
case OptionsModel::EncType_X265: baseName = "x265"; break;
}
//Architecture
switch(encArch)
{
case OptionsModel::EncArch_x32: arch = "x86"; break;
case OptionsModel::EncArch_x64: arch = "x64"; break;
}
//Encoder Variant
switch(encVariant)
{
case OptionsModel::EncVariant_LoBit:
switch(encType)
{
case OptionsModel::EncType_X264:
case OptionsModel::EncType_X265: variant = "8bit"; break;
}
break;
case OptionsModel::EncVariant_HiBit:
switch(encType)
{
case OptionsModel::EncType_X264: variant = "10bit"; break;
case OptionsModel::EncType_X265: variant = "16bit"; break;
}
break;
}
//Sanity check
if(baseName.isEmpty() || arch.isEmpty() || variant.isEmpty())
{
MUTILS_THROW("Failed to determine the encoder binarty path!");
}
//Return path
return QString("%1/toolset/%2/%3_%4_%2.exe").arg(sysinfo->getAppPath(), arch, baseName, variant);
}
QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options)
{
return ENC_BINARY(sysinfo, options->encType(), options->encArch(), options->encVariant());
}
/* --- Avisynth --- */
QString AVS_BINARY(const SysinfoModel *sysinfo, const bool& x64)

View File

@ -24,9 +24,6 @@
class SysinfoModel;
class PreferencesModel;
QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options);
QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel::EncType &encType, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant);
QString AVS_BINARY(const SysinfoModel *sysinfo, const bool &x64);
QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);

View File

@ -95,7 +95,7 @@ bool AbstractEncoder::runEncodingPass(AbstractSource* pipedSource, const QString
buildCommandLine(cmdLine_Encode, (pipedSource != NULL), frames, m_indexFile, pass, passLogFile);
log("Creating encoder process:");
if(!startProcess(processEncode, ENC_BINARY(m_sysinfo, m_options), cmdLine_Encode))
if(!startProcess(processEncode, getBinaryPath(), cmdLine_Encode))
{
return false;
}

View File

@ -22,6 +22,7 @@
#pragma once
#include "tool_abstract.h"
#include "model_options.h"
class QRegExp;
template<class T> class QList;
@ -30,12 +31,13 @@ class AbstractSource;
class AbstractEncoderInfo
{
public:
virtual QString getVariantId(const int &variant) const = 0;
virtual QFlags<OptionsModel::EncVariant> getVariants(void) const = 0;
virtual QStringList getProfiles(const int &variant) const = 0;
virtual QStringList getTunings(void) const = 0;
virtual QStringList supportedOutputFormats(void) const = 0;
virtual bool isRCModeSupported(const int 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;
};
class AbstractEncoder : public AbstractTool

View File

@ -27,6 +27,7 @@
#include "model_status.h"
#include "binaries.h"
#include "mediainfo.h"
#include "model_sysinfo.h"
//MUtils
#include <MUtils/Exception.h>
@ -37,8 +38,8 @@
#include <QRegExp>
//x264 version info
static const unsigned int VERSION_X264_MINIMUM_REV = 2533;
static const unsigned int VERSION_X264_CURRENT_API = 146;
static const unsigned int VERSION_X264_MINIMUM_REV = 2555;
static const unsigned int VERSION_X264_CURRENT_API = 148;
// ------------------------------------------------------------
// Helper Macros
@ -82,13 +83,6 @@ while(0)
} \
while(0)
static QString MAKE_NAME(const char *baseName, const OptionsModel *options)
{
const QString arch = (options->encArch() == OptionsModel::EncArch_x64) ? "x64" : "x86";
const QString vari = (options->encVariant() == OptionsModel::EncVariant_HiBit ) ? "10-Bit" : "8-Bit";
return QString("%1, %2, %3").arg(QString::fromLatin1(baseName), arch, vari);
}
// ------------------------------------------------------------
// Encoder Info
// ------------------------------------------------------------
@ -96,17 +90,12 @@ static QString MAKE_NAME(const char *baseName, const OptionsModel *options)
class X264EncoderInfo : public AbstractEncoderInfo
{
public:
virtual QString getVariantId(const int &variant) const
virtual QFlags<OptionsModel::EncVariant> getVariants(void) const
{
switch(variant)
{
case OptionsModel::EncVariant_LoBit:
return QString::fromLatin1("8-Bit");
case OptionsModel::EncVariant_HiBit:
return QString::fromLatin1("10-Bit");
default:
return QString::fromLatin1("N/A");
}
QFlags<OptionsModel::EncVariant> variants;
variants |= OptionsModel::EncVariant_8Bit;
variants |= OptionsModel::EncVariant_10Bit;
return variants;
}
virtual QStringList getTunings(void) const
@ -124,11 +113,11 @@ public:
{
QStringList profiles;
if(variant == OptionsModel::EncVariant_LoBit)
if(variant == OptionsModel::EncVariant_8Bit)
{
profiles << "Baseline" << "Main" << "High";
}
if((variant == OptionsModel::EncVariant_LoBit) || (variant == OptionsModel::EncVariant_HiBit))
if((variant == OptionsModel::EncVariant_8Bit) || (variant == OptionsModel::EncVariant_10Bit))
{
profiles << "High10" << "High422" << "High444";
}
@ -169,6 +158,24 @@ public:
return false;
}
}
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const
{
QString arch, variant;
switch(encArch)
{
case OptionsModel::EncArch_x86_32: arch = "x86"; break;
case OptionsModel::EncArch_x86_64: arch = "x64"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
switch(encVariant)
{
case OptionsModel::EncVariant_8Bit: variant = "8bit"; break;
case OptionsModel::EncVariant_10Bit: variant = "10bit"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
return QString("%1/toolset/%2/x264_%3_%2.exe").arg(sysinfo->getAppPath(), arch, variant);
}
};
static const X264EncoderInfo s_x264EncoderInfo;
@ -184,9 +191,7 @@ const AbstractEncoderInfo &X264Encoder::getEncoderInfo(void)
X264Encoder::X264Encoder(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)
:
AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile),
m_encoderName(MAKE_NAME("x264 (H.264/AVC)", m_options)),
m_binaryFile(ENC_BINARY(sysinfo, options))
AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile)
{
if(options->encType() != OptionsModel::EncType_X264)
{
@ -199,9 +204,22 @@ X264Encoder::~X264Encoder(void)
/*Nothing to do here*/
}
const QString &X264Encoder::getName(void)
QString X264Encoder::getName(void) const
{
return m_encoderName;
QString arch, variant;
switch(m_options->encArch())
{
case OptionsModel::EncArch_x86_32: arch = "x86"; break;
case OptionsModel::EncArch_x86_64: arch = "x64"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
switch(m_options->encVariant())
{
case OptionsModel::EncVariant_8Bit: variant = "8-Bit"; break;
case OptionsModel::EncVariant_10Bit: variant = "10-Bit"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
return QString("x264 (H.264/AVC), %1, %2").arg(arch, variant);
}
// ------------------------------------------------------------

View File

@ -29,7 +29,7 @@ public:
X264Encoder(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);
virtual ~X264Encoder(void);
virtual const QString &getName(void);
virtual QString getName(void) const;
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
@ -37,7 +37,7 @@ public:
static const AbstractEncoderInfo& getEncoderInfo(void);
protected:
virtual const QString &getBinaryPath() { return m_binaryFile; }
virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
@ -46,6 +46,4 @@ protected:
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass, double &last_progress, double &size_estimate);
const QString m_encoderName;
const QString m_binaryFile;
};

View File

@ -27,6 +27,7 @@
#include "model_status.h"
#include "binaries.h"
#include "mediainfo.h"
#include "model_sysinfo.h"
//MUtils
#include <MUtils/Exception.h>
@ -37,8 +38,8 @@
#include <QRegExp>
//x265 version info
static const unsigned int VERSION_X265_MINIMUM_VER = 16;
static const unsigned int VERSION_X265_MINIMUM_REV = 239;
static const unsigned int VERSION_X265_MINIMUM_VER = 17;
static const unsigned int VERSION_X265_MINIMUM_REV = 382;
// ------------------------------------------------------------
// Helper Macros
@ -82,13 +83,6 @@ while(0)
} \
while(0)
static QString MAKE_NAME(const char *baseName, const OptionsModel *options)
{
const QString arch = (options->encArch() == OptionsModel::EncArch_x64) ? "x64" : "x86";
const QString vari = (options->encVariant() == OptionsModel::EncVariant_HiBit ) ? "16-Bit" : "8-Bit";
return QString("%1, %2, %3").arg(QString::fromLatin1(baseName), arch, vari);
}
// ------------------------------------------------------------
// Encoder Info
// ------------------------------------------------------------
@ -96,17 +90,13 @@ static QString MAKE_NAME(const char *baseName, const OptionsModel *options)
class X265EncoderInfo : public AbstractEncoderInfo
{
public:
virtual QString getVariantId(const int &variant) const
virtual QFlags<OptionsModel::EncVariant> getVariants(void) const
{
switch(variant)
{
case OptionsModel::EncVariant_LoBit:
return QString::fromLatin1("8-Bit");
case OptionsModel::EncVariant_HiBit:
return QString::fromLatin1("16-Bit");
default:
return QString::fromLatin1("N/A");
}
QFlags<OptionsModel::EncVariant> variants;
variants |= OptionsModel::EncVariant_8Bit;
variants |= OptionsModel::EncVariant_10Bit;
variants |= OptionsModel::EncVariant_12Bit;
return variants;
}
virtual QStringList getTunings(void) const
@ -118,7 +108,20 @@ public:
virtual QStringList getProfiles(const int &variant) const
{
return QStringList();
QStringList profiles;
switch(variant)
{
case OptionsModel::EncVariant_8Bit:
profiles << "main" << "main-intra" << "mainstillpicture" << "main444-8" << "main444-intra" << "main444-stillpicture";
break;
case OptionsModel::EncVariant_10Bit:
profiles << "main10" << "main10-intra" << "main422-10" << "main422-10-intra" << "main444-10" << "main444-10-intra";
break;
case OptionsModel::EncVariant_12Bit:
profiles << "main12" << "main12-intra" << "main422-12" << "main422-12-intra" << "main444-12" << "main444-12-intra";
break;
}
return profiles;
}
virtual QStringList supportedOutputFormats(void) const
@ -152,6 +155,25 @@ public:
return false;
}
}
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const
{
QString arch, variant;
switch(encArch)
{
case OptionsModel::EncArch_x86_32: arch = "x86"; break;
case OptionsModel::EncArch_x86_64: arch = "x64"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
switch(encVariant)
{
case OptionsModel::EncVariant_8Bit: variant = "8bit"; break;
case OptionsModel::EncVariant_10Bit: variant = "10bit"; break;
case OptionsModel::EncVariant_12Bit: variant = "12bit"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
return QString("%1/toolset/%2/x265_%3_%2.exe").arg(sysinfo->getAppPath(), arch, variant);
}
};
static const X265EncoderInfo s_x265EncoderInfo;
@ -167,9 +189,7 @@ const AbstractEncoderInfo &X265Encoder::getEncoderInfo(void)
X265Encoder::X265Encoder(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)
:
AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile),
m_encoderName(MAKE_NAME("x265 (H.265/HEVC)", m_options)),
m_binaryFile(ENC_BINARY(sysinfo, options))
AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile)
{
if(options->encType() != OptionsModel::EncType_X265)
{
@ -182,9 +202,23 @@ X265Encoder::~X265Encoder(void)
/*Nothing to do here*/
}
const QString &X265Encoder::getName(void)
QString X265Encoder::getName(void) const
{
return m_encoderName;
QString arch, variant;
switch(m_options->encArch())
{
case OptionsModel::EncArch_x86_32: arch = "x86"; break;
case OptionsModel::EncArch_x86_64: arch = "x64"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
switch(m_options->encVariant())
{
case OptionsModel::EncVariant_8Bit: variant = "8-Bit"; break;
case OptionsModel::EncVariant_10Bit: variant = "10-Bit"; break;
case OptionsModel::EncVariant_12Bit: variant = "12-Bit"; break;
default: MUTILS_THROW("Unknown encoder arch!");
}
return QString("x265 (H.265/HEVC), %1, %2").arg(arch, variant);
}
// ------------------------------------------------------------
@ -303,11 +337,11 @@ void X265Encoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, co
}
}
if(m_options->profile().compare("auto", Qt::CaseInsensitive) != 0)
if(!m_options->profile().simplified().isEmpty())
{
if((m_options->encType() == OptionsModel::EncType_X264) && (m_options->encVariant() == OptionsModel::EncVariant_LoBit))
if(m_options->profile().simplified().compare(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED), Qt::CaseInsensitive) != 0)
{
cmdLine << "--profile" << m_options->profile().toLower();
cmdLine << "--profile" << m_options->profile().simplified().toLower();
}
}

View File

@ -29,7 +29,7 @@ public:
X265Encoder(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);
virtual ~X265Encoder(void);
virtual const QString &getName(void);
virtual QString getName(void) const;
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
@ -37,7 +37,7 @@ public:
static const AbstractEncoderInfo& getEncoderInfo(void);
protected:
virtual const QString &getBinaryPath() { return m_binaryFile; }
virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
@ -45,7 +45,4 @@ protected:
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass, double &last_progress, double &size_estimate);
const QString m_encoderName;
const QString m_binaryFile;
};

View File

@ -57,8 +57,8 @@ const char *const OptionsModel::PROFILE_UNRESTRICTED = "<Unrestricted>";
OptionsModel::OptionsModel(const SysinfoModel *sysinfo)
{
m_encoderType = EncType_X264;
m_encoderArch = sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) ? EncArch_x64 : EncArch_x32;
m_encoderVariant = EncVariant_LoBit;
m_encoderArch = sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) ? EncArch_x86_64 : EncArch_x86_32;
m_encoderVariant = EncVariant_8Bit;
m_rcMode = RCMode_CRF;
m_bitrate = 1200;
m_quantizer = 22;
@ -272,8 +272,8 @@ void OptionsModel::fixTemplate(QSettings &settingsFile)
if(!(settingsFile.contains(KEY_ENCODER_TYPE) || settingsFile.contains(KEY_ENCODER_ARCH) || settingsFile.contains(KEY_ENCODER_VARIANT)))
{
settingsFile.setValue(KEY_ENCODER_TYPE, OptionsModel::EncType_X264);
settingsFile.setValue(KEY_ENCODER_ARCH, OptionsModel::EncArch_x32);
settingsFile.setValue(KEY_ENCODER_VARIANT, OptionsModel::EncVariant_LoBit);
settingsFile.setValue(KEY_ENCODER_ARCH, OptionsModel::EncArch_x86_32);
settingsFile.setValue(KEY_ENCODER_VARIANT, OptionsModel::EncVariant_8Bit);
}
static const char *legacyKey[] = { "custom_params", "custom_params_x264", NULL };

View File

@ -39,18 +39,28 @@ public:
{
EncType_X264 = 0,
EncType_X265 = 1,
EncType_MIN = EncType_X264,
EncType_MAX = EncType_X265,
};
enum EncArch
{
EncArch_x32 = 0,
EncArch_x64 = 1
EncArch_x86_32 = 0,
EncArch_x86_64 = 1,
EncArch_MIN = EncArch_x86_32,
EncArch_MAX = EncArch_x86_64
};
enum EncVariant
{
EncVariant_LoBit = 0, // 8-Bit
EncVariant_HiBit = 1, //10-Bit (x264) or 16-Bit (x265)
EncVariant_8Bit = 1,
EncVariant_10Bit = 2,
EncVariant_12Bit = 4,
EncVariant_MIN = EncVariant_8Bit,
EncVariant_MAX = EncVariant_12Bit
};
enum RCMode
@ -59,6 +69,9 @@ public:
RCMode_CQ = 1,
RCMode_2Pass = 2,
RCMode_ABR = 3,
RCMode_MIN = RCMode_CRF,
RCMode_MAX = RCMode_ABR,
};
static const char *const TUNING_UNSPECIFIED;
@ -79,8 +92,8 @@ public:
//Setter
void setEncType(EncType type) { m_encoderType = qBound(EncType_X264, type, EncType_X265); }
void setEncArch(EncArch arch) { m_encoderArch = qBound(EncArch_x32, arch, EncArch_x64); }
void setEncVariant(EncVariant variant) { m_encoderVariant = qBound(EncVariant_LoBit, variant, EncVariant_HiBit); }
void setEncArch(EncArch arch) { m_encoderArch = qBound(EncArch_x86_32, arch, EncArch_x86_64); }
void setEncVariant(EncVariant variant) { m_encoderVariant = qBound(EncVariant_8Bit, variant, EncVariant_12Bit); }
void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
void setBitrate(unsigned int bitrate) { m_bitrate = qBound(10U, bitrate, 800000U); }
void setQuantizer(double quantizer) { m_quantizer = qBound(0.0, quantizer, 52.0); }

View File

@ -51,7 +51,7 @@ AvisynthSource::~AvisynthSource(void)
/*Nothing to do here*/
}
const QString &AvisynthSource::getName(void)
QString AvisynthSource::getName(void) const
{
return m_sourceName;
}

View File

@ -29,7 +29,7 @@ public:
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);
virtual ~AvisynthSource(void);
virtual const QString &getName(void);
virtual QString getName(void) const;
virtual bool isSourceAvailable(void);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
@ -44,7 +44,8 @@ protected:
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
virtual const QString &getBinaryPath() { return m_binaryFile; }
virtual QString getBinaryPath() const { return m_binaryFile; }
virtual void buildCommandLine(QStringList &cmdLine);
const QString m_sourceName;

View File

@ -48,7 +48,7 @@ VapoursynthSource::~VapoursynthSource(void)
/*Nothing to do here*/
}
const QString &VapoursynthSource::getName(void)
QString VapoursynthSource::getName(void) const
{
return m_sourceName;
}

View File

@ -29,7 +29,7 @@ public:
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);
virtual ~VapoursynthSource(void);
virtual const QString &getName(void);
virtual QString getName(void) const;
virtual bool isSourceAvailable(void);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
@ -44,7 +44,7 @@ protected:
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
virtual const QString &getBinaryPath() { return m_binaryFile; }
virtual QString getBinaryPath() const { return m_binaryFile; }
virtual void buildCommandLine(QStringList &cmdLine);
const QString m_sourceName;

View File

@ -34,6 +34,7 @@
#include "model_sysinfo.h"
#include "win_updater.h"
#include "binaries.h"
#include "encoder_factory.h"
//MUtils
#include <MUtils/Global.h>
@ -45,6 +46,7 @@ QScopedPointer<QFile> BinariesCheckThread::m_binPath[MAX_BINARIES];
//Whatever
#define NEXT(X) ((*reinterpret_cast<int*>(&(X)))++)
#define SHFL(X) ((*reinterpret_cast<int*>(&(X))) <<= 1)
//-------------------------------------
// External API
@ -141,17 +143,25 @@ void BinariesCheckThread::checkBinaries3(volatile bool &success, const SysinfoMo
//Create list of all required binary files
QStringList binFiles;
for(OptionsModel::EncArch arch = OptionsModel::EncArch_x32; arch <= OptionsModel::EncArch_x64; NEXT(arch))
{
for(OptionsModel::EncType encdr = OptionsModel::EncType_X264; encdr <= OptionsModel::EncType_X265; NEXT(encdr))
{
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_LoBit; varnt <= OptionsModel::EncVariant_HiBit; NEXT(varnt))
const AbstractEncoderInfo &encInfo = EncoderFactory::getEncoderInfo(encdr);
const QFlags<OptionsModel::EncVariant> variants = encInfo.getVariants();
for(OptionsModel::EncArch arch = OptionsModel::EncArch_x86_32; arch <= OptionsModel::EncArch_x86_64; NEXT(arch))
{
binFiles << ENC_BINARY(sysinfo, encdr, arch, varnt);
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_MIN; varnt <= OptionsModel::EncVariant_MAX; SHFL(varnt))
{
if(variants.testFlag(varnt))
{
binFiles << encInfo.getBinaryPath(sysinfo, arch, varnt);
}
}
binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x64);
binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x64);
}
}
for(OptionsModel::EncArch arch = OptionsModel::EncArch_x86_32; arch <= OptionsModel::EncArch_x86_64; NEXT(arch))
{
binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
}
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
{
@ -173,7 +183,7 @@ void BinariesCheckThread::checkBinaries3(volatile bool &success, const SysinfoMo
if(!MUtils::OS::is_executable_file(file->fileName()))
{
success = false;
qWarning("Required tool does NOT seem to be a valid Win32/Win64 binary:\n%s\n", MUTILS_UTF8(file->fileName()));
qWarning("Required tool does NOT look like a valid Win32/Win64 binary:\n%s\n", MUTILS_UTF8(file->fileName()));
return;
}
if(currentFile < MAX_BINARIES)

View File

@ -50,7 +50,7 @@ private:
volatile bool m_success;
const SysinfoModel *const m_sysinfo;
static const size_t MAX_BINARIES = 16;
static const size_t MAX_BINARIES = 32;
static QMutex m_binLock;
static QScopedPointer<QFile> m_binPath[MAX_BINARIES];

View File

@ -45,7 +45,7 @@ public:
AbstractTool(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause);
virtual ~AbstractTool(void) {/*NOP*/}
virtual const QString &getName(void) = 0;
virtual QString getName(void) const = 0;
virtual unsigned int checkVersion(bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified) = 0;
@ -64,7 +64,7 @@ protected:
static const unsigned int m_processTimeoutMaxCounter = 120;
static const unsigned int m_processTimeoutWarning = 24;
virtual const QString &getBinaryPath(void) = 0;
virtual QString getBinaryPath(void) const = 0;
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;

View File

@ -24,9 +24,9 @@
#endif
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 5
#define VER_X264_PATCH 1
#define VER_X264_BUILD 951
#define VER_X264_MINOR 6
#define VER_X264_PATCH 0
#define VER_X264_BUILD 958
#define VER_X264_PORTABLE_EDITION (0)

View File

@ -35,6 +35,7 @@
//MUtils
#include <MUtils/Global.h>
#include <MUtils/Exception.h>
//Qt
#include <QDate>
@ -56,6 +57,7 @@
#define ARRAY_SIZE(ARRAY) (sizeof((ARRAY))/sizeof((ARRAY[0])))
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
#define SHFL(X) ((*reinterpret_cast<int*>(&(X))) <<= 1)
#define REMOVE_USAFED_ITEM \
{ \
@ -87,6 +89,18 @@
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*)
///////////////////////////////////////////////////////////////////////////////
@ -453,8 +467,23 @@ void AddJobDialog::encoderIndexChanged(int index)
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
//Update encoder variants
ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_LoBit, encoderInfo.getVariantId(OptionsModel::EncVariant_LoBit));
ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_HiBit, encoderInfo.getVariantId(OptionsModel::EncVariant_HiBit));
const QFlags<OptionsModel::EncVariant> variants = encoderInfo.getVariants();
ui->cbxEncoderVariant->clear();
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_MIN; varnt <= OptionsModel::EncVariant_MAX; SHFL(varnt))
{
if(variants.testFlag(varnt))
{
QString varntText;
switch(varnt)
{
case OptionsModel::EncVariant_8Bit: varntText = tr("8-Bit"); break;
case OptionsModel::EncVariant_10Bit: varntText = tr("10-Bit"); break;
case OptionsModel::EncVariant_12Bit: varntText = tr("12-Bit"); break;
default: MUTILS_THROW("Bad encoder variant!");
}
ui->cbxEncoderVariant->addItem(varntText, QVariant(varnt));
}
}
//Update tunings
QStringList tunings = encoderInfo.getTunings();
@ -505,10 +534,10 @@ void AddJobDialog::modeIndexChanged(int index)
void AddJobDialog::accept(void)
{
//Check 64-Bit support
if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x64) && (!m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)))
if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x86_64) && (!m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)))
{
QMessageBox::warning(this, tr("64-Bit unsupported!"), tr("<nobr>Sorry, this computer does <b>not</b> support 64-Bit encoders!</nobr>"));
ui->cbxEncoderArch->setCurrentIndex(OptionsModel::EncArch_x32);
ui->cbxEncoderArch->setCurrentIndex(OptionsModel::EncArch_x86_32);
return;
}
@ -986,8 +1015,8 @@ void AddJobDialog::restoreOptions(const OptionsModel *options)
ui->cbxEncoderType ->setCurrentIndex(options->encType());
ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
ui->cbxEncoderVariant ->setCurrentIndex(options->encVariant());
ui->cbxRateControlMode->setCurrentIndex(options->rcMode());
setIndexByData(ui->cbxEncoderVariant, options->encVariant());
ui->cbxRateControlMode -> setCurrentIndex(options->rcMode());
ui->spinQuantizer->setValue(options->quantizer());
ui->spinBitrate ->setValue(options->bitrate());
@ -1007,7 +1036,7 @@ void AddJobDialog::saveOptions(OptionsModel *options)
{
options->setEncType(static_cast<OptionsModel::EncType>(ui->cbxEncoderType->currentIndex()));
options->setEncArch(static_cast<OptionsModel::EncArch>(ui->cbxEncoderArch->currentIndex()));
options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->currentIndex()));
options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->itemData(ui->cbxEncoderVariant->currentIndex()).toInt()));
options->setRCMode(static_cast<OptionsModel::RCMode>(ui->cbxRateControlMode->currentIndex()));
options->setQuantizer(ui->spinQuantizer->value());
@ -1206,3 +1235,5 @@ QString AddJobDialog::getInputFilterLst(void)
filters << QString("All files (*.*)");
return filters.join(";;");
}

View File

@ -26,6 +26,7 @@
#include "global.h"
#include "model_options.h"
#include "binaries.h"
#include "encoder_factory.h"
//MUtils
#include <MUtils/Sound.h>
@ -86,7 +87,7 @@ void HelpDialog::showEvent(QShowEvent *event)
if(!m_avs2yuv)
{
m_process->start(ENC_BINARY(m_sysinfo, m_options), QStringList() << "--version");
m_process->start(EncoderFactory::getEncoderInfo(m_options->encType()).getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()), QStringList() << "--version");
}
else
{
@ -135,7 +136,7 @@ void HelpDialog::finished(void)
m_startAgain = false;
if(!m_avs2yuv)
{
m_process->start(ENC_BINARY(m_sysinfo, m_options), QStringList() << "--fullhelp");
m_process->start(EncoderFactory::getEncoderInfo(m_options->encType()).getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()), QStringList() << "--fullhelp");
ui->plainTextEdit->appendPlainText("\n--------\n");
if(!m_process->waitForStarted())

View File

@ -787,8 +787,8 @@ void MainWindow::init(void)
qDebug("[Validating binaries]");
if(!BinariesCheckThread::check(m_sysinfo.data()))
{
QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least one required tool is missing or is not a valid Win32/Win64 binary.<br>Please re-install the program in order to fix the problem!</nobr>").replace("-", "&minus;"));
qFatal("At least one required tool is missing or is not a valid Win32/Win64 binary!");
QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least one tool is missing or is not a valid Win32/Win64 binary.<br>Please re-install the program in order to fix the problem!</nobr>").replace("-", "&minus;"));
qFatal("At least one tool is missing or is not a valid Win32/Win64 binary!");
}
qDebug(" ");

View File

@ -65,7 +65,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>QtCored4.lib;QtGuid4.lib;Winmm.lib;Psapi.lib;SensAPI.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>x264_entry_point</EntryPointSymbol>
</Link>
@ -87,13 +87,13 @@ copy /Y "$(SolutionDir)res\toolset\common\*.exe" "$(TargetDir)\toolset\common\"
copy /Y "$(SolutionDir)res\toolset\common\*.gpg" "$(TargetDir)\toolset\common\"
for %%i in (QtCored4, QtGuid4, QtSvgd4, QtXmld4) do (
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\bin\%%i.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\bin\%%i.pdb" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\bin\%%i.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\bin\%%i.pdb" "$(TargetDir)"
)
for %%i in (qicod4, qsvgd4, qjpegd4, qtiffd4, qgifd4) do (
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\plugins\imageformats\%%i.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\plugins\imageformats\%%i.pdb" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\plugins\imageformats\%%i.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\plugins\imageformats\%%i.pdb" "$(TargetDir)\imageformats"
)
copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\$(Platform)\*.dll" "$(TargetDir)"
@ -135,7 +135,7 @@ copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\$(Platform)\*.ma
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>QtCore4.lib;QtGui4.lib;Winmm.lib;dwmapi.lib;Psapi.lib;SensAPI.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
@ -170,15 +170,15 @@ copy /Y "$(SolutionDir)res\toolset\x64\*.exe" "$(TargetDir)\toolset\x64\"
copy /Y "$(SolutionDir)res\toolset\common\*.exe" "$(TargetDir)\toolset\common\"
copy /Y "$(SolutionDir)res\toolset\common\*.gpg" "$(TargetDir)\toolset\common\"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtCore4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtGui4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtSvg4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtXml4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qico4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qsvg4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qjpeg4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qtiff4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtCore4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtGui4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtSvg4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtXml4.dll" "$(TargetDir)"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qico4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qsvg4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qjpeg4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qtiff4.dll" "$(TargetDir)\imageformats"
copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
</Command>
<Message>Copy Toolset</Message>
</PostBuildEvent>

View File

@ -6,6 +6,7 @@ set "MSVC_PATH=C:\Program Files\Microsoft Visual Studio 12.0\VC"
set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
set "UPX3_PATH=C:\Program Files\UPX"
set "PDOC_PATH=C:\Program Files\Pandoc"
set "TOOLS_VER=120"
REM ###############################################
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
@ -99,17 +100,13 @@ copy "%~dp0\*.txt" "%PACK_PATH%"
REM ///////////////////////////////////////////////////////////////////////////
REM // Copy dependencies
REM ///////////////////////////////////////////////////////////////////////////
for %%i in (100, 110, 120) do (
if exist "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\*.dll" (
copy "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\msvc?%%i.dll" "%PACK_PATH%"
)
)
copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtCore4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtGui4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtXml4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtXml4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
copy "%MSVC_PATH%\redist\x86\Microsoft.VC%TOOLS_VER%.CRT\*.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtCore4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtGui4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
del "%PACK_PATH%\imageformats\*d4.dll" 2> NUL
REM ///////////////////////////////////////////////////////////////////////////