Fixed VapourSynth input + some more code re-factoring.
This commit is contained in:
parent
e694ed1154
commit
675ef7cef5
@ -52,20 +52,6 @@
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define PROCESS_PENDING_LINES(PROC, HANDLER, ...) do \
|
||||
{ \
|
||||
while((PROC).bytesAvailable() > 0) \
|
||||
{ \
|
||||
QList<QByteArray> lines = (PROC).readLine().split('\r'); \
|
||||
while(!lines.isEmpty()) \
|
||||
{ \
|
||||
const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); \
|
||||
HANDLER(text, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Constructor & Destructor
|
||||
// ------------------------------------------------------------
|
||||
|
@ -69,6 +69,13 @@ 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);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Constructor & Destructor
|
||||
// ------------------------------------------------------------
|
||||
@ -76,6 +83,7 @@ while(0)
|
||||
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))
|
||||
{
|
||||
if(options->encType() != OptionsModel::EncType_X264)
|
||||
@ -89,6 +97,11 @@ X264Encoder::~X264Encoder(void)
|
||||
/*Nothing to do here*/
|
||||
}
|
||||
|
||||
const QString &X264Encoder::getName(void)
|
||||
{
|
||||
return m_encoderName;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Check Version
|
||||
// ------------------------------------------------------------
|
||||
|
@ -29,6 +29,8 @@ 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 void printVersion(const unsigned int &revision, const bool &modified);
|
||||
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
||||
|
||||
@ -42,5 +44,6 @@ protected:
|
||||
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
|
||||
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass);
|
||||
|
||||
const QString m_encoderName;
|
||||
const QString m_binaryFile;
|
||||
};
|
||||
|
@ -70,6 +70,13 @@ 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);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Constructor & Destructor
|
||||
// ------------------------------------------------------------
|
||||
@ -77,6 +84,7 @@ while(0)
|
||||
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))
|
||||
{
|
||||
if(options->encType() != OptionsModel::EncType_X265)
|
||||
@ -90,6 +98,11 @@ X265Encoder::~X265Encoder(void)
|
||||
/*Nothing to do here*/
|
||||
}
|
||||
|
||||
const QString &X265Encoder::getName(void)
|
||||
{
|
||||
return m_encoderName;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Check Version
|
||||
// ------------------------------------------------------------
|
||||
|
@ -29,6 +29,8 @@ 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 void printVersion(const unsigned int &revision, const bool &modified);
|
||||
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
||||
|
||||
@ -42,5 +44,6 @@ protected:
|
||||
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
|
||||
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass);
|
||||
|
||||
const QString m_encoderName;
|
||||
const QString m_binaryFile;
|
||||
};
|
||||
|
@ -30,24 +30,6 @@
|
||||
#include <QTextCodec>
|
||||
#include <QDir>
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Helper Macros
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#define PROCESS_PENDING_LINES(PROC, HANDLER, ...) do \
|
||||
{ \
|
||||
while((PROC).bytesAvailable() > 0) \
|
||||
{ \
|
||||
QList<QByteArray> lines = (PROC).readLine().split('\r'); \
|
||||
while(!lines.isEmpty()) \
|
||||
{ \
|
||||
const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); \
|
||||
HANDLER(text, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Constructor & Destructor
|
||||
// ------------------------------------------------------------
|
||||
|
@ -40,6 +40,7 @@ static const unsigned int VER_X264_AVS2YUV_VER = 242;
|
||||
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))
|
||||
{
|
||||
/*Nothing to do here*/
|
||||
@ -50,6 +51,11 @@ AvisynthSource::~AvisynthSource(void)
|
||||
/*Nothing to do here*/
|
||||
}
|
||||
|
||||
const QString &AvisynthSource::getName(void)
|
||||
{
|
||||
return m_sourceName;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Check Version
|
||||
// ------------------------------------------------------------
|
||||
|
@ -28,6 +28,8 @@ class AvisynthSource : public AbstractSource
|
||||
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 bool isSourceAvailable(void);
|
||||
virtual void printVersion(const unsigned int &revision, const bool &modified);
|
||||
@ -45,5 +47,6 @@ protected:
|
||||
virtual const QString &getBinaryPath() { return m_binaryFile; }
|
||||
virtual void buildCommandLine(QStringList &cmdLine);
|
||||
|
||||
const QString m_sourceName;
|
||||
const QString m_binaryFile;
|
||||
};
|
||||
|
@ -36,6 +36,7 @@ static const unsigned int VER_X264_VSPIPE_VER = 22;
|
||||
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))
|
||||
{
|
||||
/*Nothing to do here*/
|
||||
@ -46,13 +47,18 @@ VapoursynthSource::~VapoursynthSource(void)
|
||||
/*Nothing to do here*/
|
||||
}
|
||||
|
||||
const QString &VapoursynthSource::getName(void)
|
||||
{
|
||||
return m_sourceName;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Check Version
|
||||
// ------------------------------------------------------------
|
||||
|
||||
bool VapoursynthSource::isSourceAvailable()
|
||||
{
|
||||
if(!(m_sysinfo->hasVPSSupport() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(m_sysinfo->getVPSPath()).isFile()))
|
||||
if(!(m_sysinfo->hasVPSSupport() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(VPS_BINARY(m_sysinfo, m_preferences)).isFile()))
|
||||
{
|
||||
log(tr("\nVPY INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
||||
return false;
|
||||
@ -119,6 +125,8 @@ void VapoursynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QS
|
||||
patterns << new QRegExp("\\bFrames:\\s+(\\d+)\\b");
|
||||
patterns << new QRegExp("\\bWidth:\\s+(\\d+)\\b");
|
||||
patterns << new QRegExp("\\bHeight:\\s+(\\d+)\\b");
|
||||
patterns << new QRegExp("\\bFPS:\\s+(\\d+)\\b");
|
||||
patterns << new QRegExp("\\bFPS:\\s+(\\d+)/(\\d+)\\b");
|
||||
}
|
||||
|
||||
void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen)
|
||||
@ -143,6 +151,23 @@ void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, QLi
|
||||
unsigned int temp = patterns[2]->cap(1).toUInt(&ok);
|
||||
if(ok) fSizeH = temp;
|
||||
}
|
||||
if((offset = patterns[3]->lastIndexIn(line)) >= 0)
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned int temp = patterns[3]->cap(1).toUInt(&ok);
|
||||
if(ok) fpsNom = temp;
|
||||
}
|
||||
if((offset = patterns[4]->lastIndexIn(line)) >= 0)
|
||||
{
|
||||
bool ok1 = false, ok2 = false;
|
||||
unsigned int temp1 = patterns[4]->cap(1).toUInt(&ok1);
|
||||
unsigned int temp2 = patterns[4]->cap(2).toUInt(&ok2);
|
||||
if(ok1 && ok2)
|
||||
{
|
||||
fpsNom = temp1;
|
||||
fpsDen = temp2;
|
||||
}
|
||||
}
|
||||
|
||||
if(!line.isEmpty())
|
||||
{
|
||||
|
@ -29,6 +29,8 @@ 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 bool isSourceAvailable(void);
|
||||
virtual void printVersion(const unsigned int &revision, const bool &modified);
|
||||
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
||||
@ -45,5 +47,6 @@ protected:
|
||||
virtual const QString &getBinaryPath() { return m_binaryFile; }
|
||||
virtual void buildCommandLine(QStringList &cmdLine);
|
||||
|
||||
const QString m_sourceName;
|
||||
const QString m_binaryFile;
|
||||
};
|
||||
|
@ -258,22 +258,24 @@ void EncodeThread::encode(void)
|
||||
//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)));
|
||||
log(tr("Source file: %1").arg(QDir::toNativeSeparators(m_sourceFileName)));
|
||||
log(tr("Output file: %1").arg(QDir::toNativeSeparators(m_outputFileName)));
|
||||
log(tr("Source file : %1").arg(QDir::toNativeSeparators(m_sourceFileName)));
|
||||
log(tr("Output file : %1").arg(QDir::toNativeSeparators(m_outputFileName)));
|
||||
|
||||
//Print system info
|
||||
log(tr("\n--- SYSTEMINFO ---\n"));
|
||||
log(tr("Binary Path: %1").arg(QDir::toNativeSeparators(m_sysinfo->getAppPath())));
|
||||
log(tr("Avisynth OK: %1").arg(m_sysinfo->hasAVSSupport() ? tr("Yes") : tr("No")));
|
||||
log(tr("VapourSynth: %1").arg(m_sysinfo->hasVPSSupport() ? QDir::toNativeSeparators(m_sysinfo->getVPSPath()) : tr("N/A")));
|
||||
log(tr("Binary Path : %1").arg(QDir::toNativeSeparators(m_sysinfo->getAppPath())));
|
||||
log(tr("Avisynth : %1").arg(m_sysinfo->hasAVSSupport() ? tr("Yes") : tr("No")));
|
||||
log(tr("VapourSynth : %1").arg(m_sysinfo->hasVPSSupport() ? QDir::toNativeSeparators(m_sysinfo->getVPSPath()) : tr("N/A")));
|
||||
|
||||
//Print encoder settings
|
||||
log(tr("\n--- SETTINGS ---\n"));
|
||||
log(tr("RC Mode: %1").arg(OptionsModel::rcMode2String(m_options->rcMode())));
|
||||
log(tr("Preset: %1").arg(m_options->preset()));
|
||||
log(tr("Tuning: %1").arg(m_options->tune()));
|
||||
log(tr("Profile: %1").arg(m_options->profile()));
|
||||
log(tr("Custom: %1").arg(m_options->customEncParams().isEmpty() ? tr("(None)") : m_options->customEncParams()));
|
||||
log(tr("Encoder : %1").arg(m_encoder->getName()));
|
||||
log(tr("Source : %1").arg(m_pipedSource ? m_pipedSource->getName() : tr("Native")));
|
||||
log(tr("RC Mode : %1").arg(OptionsModel::rcMode2String(m_options->rcMode())));
|
||||
log(tr("Preset : %1").arg(m_options->preset()));
|
||||
log(tr("Tuning : %1").arg(m_options->tune()));
|
||||
log(tr("Profile : %1").arg(m_options->profile()));
|
||||
log(tr("Custom : %1").arg(m_options->customEncParams().isEmpty() ? tr("(None)") : m_options->customEncParams()));
|
||||
|
||||
bool ok = false;
|
||||
unsigned int frames = 0;
|
||||
|
@ -35,24 +35,6 @@
|
||||
|
||||
QMutex AbstractTool::s_mutexStartProcess;
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Helper Macros
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#define PROCESS_PENDING_LINES(PROC, HANDLER, ...) do \
|
||||
{ \
|
||||
while((PROC).bytesAvailable() > 0) \
|
||||
{ \
|
||||
QList<QByteArray> lines = (PROC).readLine().split('\r'); \
|
||||
while(!lines.isEmpty()) \
|
||||
{ \
|
||||
const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); \
|
||||
HANDLER(text, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Constructor & Destructor
|
||||
// ------------------------------------------------------------
|
||||
|
@ -33,6 +33,10 @@ class QProcess;
|
||||
class QSemaphore;
|
||||
enum JobStatus;
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Base Class
|
||||
// ------------------------------------------------------------
|
||||
|
||||
class AbstractTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -41,6 +45,8 @@ 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 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;
|
||||
@ -85,3 +91,21 @@ protected:
|
||||
|
||||
static QMutex s_mutexStartProcess;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Helper Macros
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#define PROCESS_PENDING_LINES(PROC, HANDLER, ...) do \
|
||||
{ \
|
||||
while((PROC).bytesAvailable() > 0) \
|
||||
{ \
|
||||
QList<QByteArray> lines = (PROC).readLine().split('\r'); \
|
||||
while(!lines.isEmpty()) \
|
||||
{ \
|
||||
const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); \
|
||||
HANDLER(text, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 3
|
||||
#define VER_X264_PATCH 3
|
||||
#define VER_X264_BUILD 804
|
||||
#define VER_X264_BUILD 805
|
||||
|
||||
#define VER_X264_PORTABLE_EDITION (0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user