Fixed Avisynth version detection as well as detecting the source properties.
This commit is contained in:
parent
87fbc8a8b4
commit
1decd835d9
@ -33,7 +33,7 @@ public:
|
|||||||
AbstractEncoder(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 *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 ~AbstractEncoder(void);
|
virtual ~AbstractEncoder(void);
|
||||||
|
|
||||||
bool runEncodingPass(AbstractSource* pipedSource, const QString outputFile, const unsigned int &frames, const int &pass = 0, const QString &passLogFile = QString());
|
virtual bool runEncodingPass(AbstractSource* pipedSource, const QString outputFile, const unsigned int &frames, const int &pass = 0, const QString &passLogFile = QString());
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile) = 0;
|
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile) = 0;
|
||||||
|
@ -103,28 +103,40 @@ void X264Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdL
|
|||||||
void X264Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
|
void X264Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
|
||||||
{
|
{
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
|
|
||||||
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok1 = false, ok2 = false;
|
||||||
unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1);
|
unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1);
|
||||||
unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2);
|
unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2);
|
||||||
if(ok1) coreVers = temp1;
|
if(ok1 && ok2)
|
||||||
if(ok2) revision = temp2;
|
{
|
||||||
|
coreVers = temp1;
|
||||||
|
revision = temp2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok1 = false, ok2 = false;
|
||||||
unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1);
|
unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1);
|
||||||
unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2);
|
unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2);
|
||||||
if(ok1) coreVers = temp1;
|
if(ok1 && ok2)
|
||||||
if(ok2) revision = temp2;
|
{
|
||||||
|
coreVers = temp1;
|
||||||
|
revision = temp2;
|
||||||
|
}
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!line.isEmpty())
|
||||||
|
{
|
||||||
|
log(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void X264Encoder::printVersion(const unsigned int &revision, const bool &modified)
|
void X264Encoder::printVersion(const unsigned int &revision, const bool &modified)
|
||||||
{
|
{
|
||||||
log(tr("\nx264 revision: %1 (core #%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)).append(modified ? tr(" - with custom patches!") : QString()));
|
log(tr("\nx264 revision: %1 (core #%2)\n").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)).append(modified ? tr(" - with custom patches!") : QString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool X264Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)
|
bool X264Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)
|
||||||
@ -234,8 +246,6 @@ void X264Encoder::runEncodingPass_init(QList<QRegExp*> &patterns)
|
|||||||
|
|
||||||
void X264Encoder::runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass)
|
void X264Encoder::runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass)
|
||||||
{
|
{
|
||||||
log(tr("PARSE: \"%1\"").arg(line));
|
|
||||||
|
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
|
|||||||
|
|
||||||
void X265Encoder::printVersion(const unsigned int &revision, const bool &modified)
|
void X265Encoder::printVersion(const unsigned int &revision, const bool &modified)
|
||||||
{
|
{
|
||||||
log(tr("\nx265 version: 0.%1+%2").arg(QString::number(revision / REV_MULT), QString::number(revision % REV_MULT)));
|
log(tr("\nx265 version: 0.%1+%2\n").arg(QString::number(revision / REV_MULT), QString::number(revision % REV_MULT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)
|
bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)
|
||||||
|
@ -30,6 +30,28 @@
|
|||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QDir>
|
#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
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
AbstractSource::AbstractSource(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::AbstractSource(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)
|
||||||
:
|
:
|
||||||
AbstractTool(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause),
|
AbstractTool(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause),
|
||||||
@ -43,6 +65,10 @@ AbstractSource::~AbstractSource(void)
|
|||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Check Source Properties
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
bool AbstractSource::checkSourceProperties(unsigned int &frames)
|
bool AbstractSource::checkSourceProperties(unsigned int &frames)
|
||||||
{
|
{
|
||||||
QStringList cmdLine;
|
QStringList cmdLine;
|
||||||
@ -73,7 +99,7 @@ bool AbstractSource::checkSourceProperties(unsigned int &frames)
|
|||||||
|
|
||||||
while(process.state() != QProcess::NotRunning)
|
while(process.state() != QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
if(m_abort)
|
if(*m_abort)
|
||||||
{
|
{
|
||||||
process.kill();
|
process.kill();
|
||||||
bAborted = true;
|
bAborted = true;
|
||||||
@ -105,15 +131,12 @@ bool AbstractSource::checkSourceProperties(unsigned int &frames)
|
|||||||
}
|
}
|
||||||
|
|
||||||
waitCounter = 0;
|
waitCounter = 0;
|
||||||
|
PROCESS_PENDING_LINES(process, checkSourceProperties_parseLine, patterns, frames, fSizeW, fSizeH, fpsNom, fpsDen);
|
||||||
|
}
|
||||||
|
|
||||||
while(process.bytesAvailable() > 0)
|
if(!(bTimeout || bAborted))
|
||||||
{
|
{
|
||||||
QList<QByteArray> lines = process.readLine().split('\r');
|
PROCESS_PENDING_LINES(process, checkSourceProperties_parseLine, patterns, frames, fSizeW, fSizeH, fpsNom, fpsDen);
|
||||||
while(!lines.isEmpty())
|
|
||||||
{
|
|
||||||
QString text = localCodec->toUnicode(lines.takeFirst().constData()).simplified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
@ -166,6 +189,10 @@ bool AbstractSource::checkSourceProperties(unsigned int &frames)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Source Processing
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
bool AbstractSource::createProcess(QProcess &processEncode, QProcess&processInput)
|
bool AbstractSource::createProcess(QProcess &processEncode, QProcess&processInput)
|
||||||
{
|
{
|
||||||
processInput.setStandardOutputProcess(&processEncode);
|
processInput.setStandardOutputProcess(&processEncode);
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
|
|
||||||
static const unsigned int VER_X264_AVS2YUV_VER = 242;
|
static const unsigned int VER_X264_AVS2YUV_VER = 242;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// 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)
|
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),
|
AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile),
|
||||||
@ -46,6 +50,10 @@ AvisynthSource::~AvisynthSource(void)
|
|||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Check Version
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
bool AvisynthSource::isSourceAvailable()
|
bool AvisynthSource::isSourceAvailable()
|
||||||
{
|
{
|
||||||
if(!(m_sysinfo->hasAVSSupport()))
|
if(!(m_sysinfo->hasAVSSupport()))
|
||||||
@ -58,7 +66,6 @@ bool AvisynthSource::isSourceAvailable()
|
|||||||
|
|
||||||
void AvisynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
void AvisynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << "--version";
|
|
||||||
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)\\b", Qt::CaseInsensitive);
|
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)\\b", Qt::CaseInsensitive);
|
||||||
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive);
|
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
@ -66,25 +73,38 @@ void AvisynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &c
|
|||||||
void AvisynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
|
void AvisynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
|
||||||
{
|
{
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
|
|
||||||
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok1 = false, ok2 = false;
|
||||||
unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1);
|
unsigned int temp1 = patterns[0]->cap(1).toUInt(&ok1);
|
||||||
unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2);
|
unsigned int temp2 = patterns[0]->cap(2).toUInt(&ok2);
|
||||||
if(ok1) coreVers = temp1;
|
if(ok1 && ok2)
|
||||||
if(ok2) revision = temp2;
|
{
|
||||||
|
coreVers = temp1;
|
||||||
|
revision = temp2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok1 = false, ok2 = false, ok3 = false;
|
||||||
unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1);
|
unsigned int temp1 = patterns[1]->cap(1).toUInt(&ok1);
|
||||||
unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2);
|
unsigned int temp2 = patterns[1]->cap(2).toUInt(&ok2);
|
||||||
if(ok1) coreVers = temp1;
|
unsigned int temp3 = patterns[1]->cap(3).toUInt(&ok3);
|
||||||
if(ok2) revision = temp2;
|
if(ok1 && ok2 && ok3)
|
||||||
|
{
|
||||||
|
coreVers = temp1;
|
||||||
|
revision = (temp2 * 10) + (temp3 % 10);
|
||||||
|
}
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AvisynthSource::checkVersion_succeeded(const int &exitCode)
|
||||||
|
{
|
||||||
|
return (exitCode == EXIT_SUCCESS) || (exitCode == 2);
|
||||||
|
}
|
||||||
|
|
||||||
void AvisynthSource::printVersion(const unsigned int &revision, const bool &modified)
|
void AvisynthSource::printVersion(const unsigned int &revision, const bool &modified)
|
||||||
{
|
{
|
||||||
log(tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision / REV_MULT), QString::number((revision % REV_MULT) / 10),QString::number((revision % REV_MULT) % 10)));
|
log(tr("Avs2YUV version: %1.%2.%3").arg(QString::number(revision / REV_MULT), QString::number((revision % REV_MULT) / 10),QString::number((revision % REV_MULT) % 10)));
|
||||||
@ -92,15 +112,19 @@ void AvisynthSource::printVersion(const unsigned int &revision, const bool &modi
|
|||||||
|
|
||||||
bool AvisynthSource::isVersionSupported(const unsigned int &revision, const bool &modified)
|
bool AvisynthSource::isVersionSupported(const unsigned int &revision, const bool &modified)
|
||||||
{
|
{
|
||||||
if((revision != UINT_MAX) && ((revision % REV_MULT) != VER_X264_AVS2YUV_VER))
|
if((revision != UINT_MAX) && ((revision % REV_MULT) < VER_X264_AVS2YUV_VER))
|
||||||
{
|
{
|
||||||
log(tr("\nERROR: Your version of avs2yuv is unsupported (Required version: v0.24 BugMaster's mod 2)"));
|
log(tr("\nERROR: Your version of avs2yuv is unsupported (required version: v0.24 BugMaster's mod 2)"));
|
||||||
log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/"));
|
log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Check Source Properties
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
void AvisynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
void AvisynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << "-frames" << "1";
|
cmdLine << "-frames" << "1";
|
||||||
@ -112,7 +136,10 @@ void AvisynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStri
|
|||||||
|
|
||||||
void AvisynthSource::checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen)
|
void AvisynthSource::checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen)
|
||||||
{
|
{
|
||||||
|
qWarning("parseLine \"%1\"", line.toUtf8().constData());
|
||||||
|
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
|
|
||||||
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok1 = false, ok2 = false;
|
||||||
@ -141,10 +168,12 @@ void AvisynthSource::checkSourceProperties_parseLine(const QString &line, QList<
|
|||||||
if(ok4) fpsDen = temp4;
|
if(ok4) fpsDen = temp4;
|
||||||
if(ok5) frames = temp5;
|
if(ok5) frames = temp5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!line.isEmpty())
|
if(!line.isEmpty())
|
||||||
{
|
{
|
||||||
log(line);
|
log(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(line.contains("failed to load avisynth.dll", Qt::CaseInsensitive))
|
if(line.contains("failed to load avisynth.dll", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
log(tr("\nWarning: It seems that %1-Bit Avisynth is not currently installed !!!").arg(m_preferences->getUseAvisyth64Bit() ? "64" : "32"));
|
log(tr("\nWarning: It seems that %1-Bit Avisynth is not currently installed !!!").arg(m_preferences->getUseAvisyth64Bit() ? "64" : "32"));
|
||||||
@ -155,6 +184,10 @@ void AvisynthSource::checkSourceProperties_parseLine(const QString &line, QList<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Source Processing
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
void AvisynthSource::buildCommandLine(QStringList &cmdLine)
|
void AvisynthSource::buildCommandLine(QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
|
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
|
||||||
|
@ -36,12 +36,12 @@ public:
|
|||||||
virtual void flushProcess(QProcess &processInput);
|
virtual void flushProcess(QProcess &processInput);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
||||||
void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified);
|
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified);
|
||||||
|
virtual bool checkVersion_succeeded(const int &exitCode);
|
||||||
|
|
||||||
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
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 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 const QString &getBinaryPath() { return m_binaryFile; }
|
||||||
virtual void buildCommandLine(QStringList &cmdLine);
|
virtual void buildCommandLine(QStringList &cmdLine);
|
||||||
|
|
||||||
|
@ -46,6 +46,10 @@ VapoursynthSource::~VapoursynthSource(void)
|
|||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Check Version
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
bool VapoursynthSource::isSourceAvailable()
|
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(m_sysinfo->getVPSPath()).isFile()))
|
||||||
@ -67,6 +71,7 @@ void VapoursynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList
|
|||||||
void VapoursynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
|
void VapoursynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
|
||||||
{
|
{
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
|
|
||||||
if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -79,11 +84,16 @@ void VapoursynthSource::checkVersion_parseLine(const QString &line, QList<QRegEx
|
|||||||
unsigned int temp = patterns[2]->cap(1).toUInt(&ok);
|
unsigned int temp = patterns[2]->cap(1).toUInt(&ok);
|
||||||
if(ok) coreVers = temp;
|
if(ok) coreVers = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!line.isEmpty())
|
||||||
|
{
|
||||||
|
log(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VapoursynthSource::printVersion(const unsigned int &revision, const bool &modified)
|
void VapoursynthSource::printVersion(const unsigned int &revision, const bool &modified)
|
||||||
{
|
{
|
||||||
log(tr("VapourSynth version: r%1 (API r%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)));
|
log(tr("\nVapourSynth version: r%1 (API r%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VapoursynthSource::isVersionSupported(const unsigned int &revision, const bool &modified)
|
bool VapoursynthSource::isVersionSupported(const unsigned int &revision, const bool &modified)
|
||||||
@ -97,6 +107,10 @@ bool VapoursynthSource::isVersionSupported(const unsigned int &revision, const b
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Check Source Properties
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
void VapoursynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
void VapoursynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
|
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
|
||||||
@ -110,6 +124,7 @@ void VapoursynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QS
|
|||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
|
|
||||||
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -128,12 +143,17 @@ void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, QLi
|
|||||||
unsigned int temp = patterns[2]->cap(1).toUInt(&ok);
|
unsigned int temp = patterns[2]->cap(1).toUInt(&ok);
|
||||||
if(ok) fSizeH = temp;
|
if(ok) fSizeH = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!line.isEmpty())
|
if(!line.isEmpty())
|
||||||
{
|
{
|
||||||
log(line);
|
log(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Check Source Properties
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
void VapoursynthSource::buildCommandLine(QStringList &cmdLine)
|
void VapoursynthSource::buildCommandLine(QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
|
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
|
||||||
|
@ -36,8 +36,8 @@ public:
|
|||||||
virtual void flushProcess(QProcess &processInput);
|
virtual void flushProcess(QProcess &processInput);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
||||||
void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified);
|
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified);
|
||||||
|
|
||||||
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
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 void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
|
||||||
|
@ -306,7 +306,7 @@ void EncodeThread::encode(void)
|
|||||||
CHECK_STATUS(m_abort, (ok = (sourceRevision != UINT_MAX)));
|
CHECK_STATUS(m_abort, (ok = (sourceRevision != UINT_MAX)));
|
||||||
|
|
||||||
//Print source versions
|
//Print source versions
|
||||||
m_pipedSource->printVersion(sourceModified, sourceModified);
|
m_pipedSource->printVersion(sourceRevision, sourceModified);
|
||||||
|
|
||||||
//Is source version supported?
|
//Is source version supported?
|
||||||
CHECK_STATUS(m_abort, (ok = m_pipedSource->isVersionSupported(sourceRevision, sourceModified)));
|
CHECK_STATUS(m_abort, (ok = m_pipedSource->isVersionSupported(sourceRevision, sourceModified)));
|
||||||
|
@ -48,10 +48,6 @@ QMutex AbstractTool::s_mutexStartProcess;
|
|||||||
{ \
|
{ \
|
||||||
const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); \
|
const QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified(); \
|
||||||
HANDLER(text, __VA_ARGS__); \
|
HANDLER(text, __VA_ARGS__); \
|
||||||
if(!text.isEmpty()) \
|
|
||||||
{ \
|
|
||||||
log(text); \
|
|
||||||
} \
|
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
@ -147,7 +143,7 @@ unsigned int AbstractTool::checkVersion(bool &modified)
|
|||||||
X264_DELETE(pattern);
|
X264_DELETE(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
|
if(bTimeout || bAborted || (!checkVersion_succeeded(process.exitCode())))
|
||||||
{
|
{
|
||||||
if(!(bTimeout || bAborted))
|
if(!(bTimeout || bAborted))
|
||||||
{
|
{
|
||||||
@ -165,6 +161,11 @@ unsigned int AbstractTool::checkVersion(bool &modified)
|
|||||||
return (coreVers * REV_MULT) + (revision % REV_MULT);
|
return (coreVers * REV_MULT) + (revision % REV_MULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbstractTool::checkVersion_succeeded(const int &exitCode)
|
||||||
|
{
|
||||||
|
return (exitCode == EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// Process Creation
|
// Process Creation
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
@ -62,6 +62,7 @@ protected:
|
|||||||
|
|
||||||
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
|
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
|
||||||
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified) = 0;
|
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified) = 0;
|
||||||
|
virtual bool checkVersion_succeeded(const int &exitCode);
|
||||||
|
|
||||||
void log(const QString &text) { emit messageLogged(text); }
|
void log(const QString &text) { emit messageLogged(text); }
|
||||||
void setStatus(const JobStatus &newStatus) { emit statusChanged(newStatus); }
|
void setStatus(const JobStatus &newStatus) { emit statusChanged(newStatus); }
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 3
|
#define VER_X264_MINOR 3
|
||||||
#define VER_X264_PATCH 2
|
#define VER_X264_PATCH 2
|
||||||
#define VER_X264_BUILD 795
|
#define VER_X264_BUILD 797
|
||||||
|
|
||||||
#define VER_X264_PORTABLE_EDITION (0)
|
#define VER_X264_PORTABLE_EDITION (0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user