Implemented VSPipe version detection + various fixes.
This commit is contained in:
parent
38e7dbae56
commit
155f66c061
@ -33,6 +33,7 @@ public:
|
|||||||
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(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 ~AbstractSource(void);
|
virtual ~AbstractSource(void);
|
||||||
|
|
||||||
|
virtual bool isSourceAvailable(void) = 0;
|
||||||
virtual bool checkSourceProperties(unsigned int &frames);
|
virtual bool checkSourceProperties(unsigned int &frames);
|
||||||
virtual bool createProcess(QProcess &processEncode, QProcess&processInput);
|
virtual bool createProcess(QProcess &processEncode, QProcess&processInput);
|
||||||
virtual void flushProcess(QProcess &processInput) = 0;
|
virtual void flushProcess(QProcess &processInput) = 0;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "source_avisynth.h"
|
#include "source_avisynth.h"
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "model_sysinfo.h"
|
||||||
#include "model_preferences.h"
|
#include "model_preferences.h"
|
||||||
#include "binaries.h"
|
#include "binaries.h"
|
||||||
|
|
||||||
@ -45,11 +46,21 @@ AvisynthSource::~AvisynthSource(void)
|
|||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AvisynthSource::isSourceAvailable()
|
||||||
|
{
|
||||||
|
if(!(m_sysinfo->hasAVSSupport()))
|
||||||
|
{
|
||||||
|
log(tr("\nAVS INPUT REQUIRES AVISYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void AvisynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
void AvisynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << "--version";
|
cmdLine << "--version";
|
||||||
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive);
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -29,6 +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);
|
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 ~AvisynthSource(void);
|
||||||
|
|
||||||
|
virtual bool isSourceAvailable(void);
|
||||||
virtual void printVersion(const unsigned int &revision, const bool &modified);
|
virtual void printVersion(const unsigned int &revision, const bool &modified);
|
||||||
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
||||||
|
|
||||||
|
@ -24,13 +24,14 @@
|
|||||||
#include "source_vapoursynth.h"
|
#include "source_vapoursynth.h"
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "model_sysinfo.h"
|
||||||
#include "model_preferences.h"
|
#include "model_preferences.h"
|
||||||
#include "binaries.h"
|
#include "binaries.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
static const unsigned int VER_X264_VSPIPE_VER = 242;
|
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)
|
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)
|
||||||
:
|
:
|
||||||
@ -45,46 +46,52 @@ VapoursynthSource::~VapoursynthSource(void)
|
|||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VapoursynthSource::isSourceAvailable()
|
||||||
|
{
|
||||||
|
if(!(m_sysinfo->hasVPSSupport() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(m_sysinfo->getVPSPath()).isFile()))
|
||||||
|
{
|
||||||
|
log(tr("\nVPY INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void VapoursynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
void VapoursynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
|
||||||
{
|
{
|
||||||
cmdLine << "--version";
|
cmdLine << "-version";
|
||||||
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive);
|
patterns << new QRegExp("\\bVapourSynth\\b", Qt::CaseInsensitive);
|
||||||
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)\\b", Qt::CaseInsensitive);
|
patterns << new QRegExp("\\bCore\\s+r(\\d+)\\b", Qt::CaseInsensitive);
|
||||||
|
patterns << new QRegExp("\\bAPI\\s+r(\\d+)\\b", Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
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[0]->lastIndexIn(line)) >= 0)
|
if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok = false;
|
||||||
unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1);
|
unsigned int temp = patterns[1]->cap(1).toUInt(&ok);
|
||||||
unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2);
|
if(ok) revision = temp;
|
||||||
if(ok1) coreVers = temp1;
|
|
||||||
if(ok2) revision = temp2;
|
|
||||||
}
|
}
|
||||||
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
|
else if((offset = patterns[2]->lastIndexIn(line)) >= 0)
|
||||||
{
|
{
|
||||||
bool ok1 = false, ok2 = false;
|
bool ok = false;
|
||||||
unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1);
|
unsigned int temp = patterns[2]->cap(1).toUInt(&ok);
|
||||||
unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2);
|
if(ok) coreVers = temp;
|
||||||
if(ok1) coreVers = temp1;
|
|
||||||
if(ok2) revision = temp2;
|
|
||||||
modified = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VapoursynthSource::printVersion(const unsigned int &revision, const bool &modified)
|
void VapoursynthSource::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("VapourSynth 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)
|
||||||
{
|
{
|
||||||
if((revision != UINT_MAX) && ((revision % REV_MULT) != VER_X264_VSPIPE_VER))
|
if((revision % REV_MULT) < VER_X264_VSPIPE_VER)
|
||||||
{
|
{
|
||||||
log(tr("\nERROR: Your version of avs2yuv is unsupported (Required version: v0.24 BugMaster's mod 2)"));
|
log(tr("\nERROR: Your version of VapourSynth is unsupported (requires version r%1 or newer").arg(QString::number(VER_X264_VSPIPE_VER)));
|
||||||
log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/"));
|
log(tr("You can find the latest VapourSynth version at: http://www.vapoursynth.com/"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -29,6 +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);
|
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 ~VapoursynthSource(void);
|
||||||
|
|
||||||
|
virtual bool isSourceAvailable(void);
|
||||||
virtual void printVersion(const unsigned int &revision, const bool &modified);
|
virtual void printVersion(const unsigned int &revision, const bool &modified);
|
||||||
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
|
||||||
|
|
||||||
|
@ -94,6 +94,18 @@ private:
|
|||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
|
|
||||||
|
#define CONNECT(OBJ) do \
|
||||||
|
{ \
|
||||||
|
if((OBJ)) \
|
||||||
|
{ \
|
||||||
|
connect((OBJ), SIGNAL(statusChanged(JobStatus)), this, SLOT(setStatus(JobStatus)), Qt::DirectConnection); \
|
||||||
|
connect((OBJ), SIGNAL(progressChanged(unsigned int)), this, SLOT(setProgress(unsigned int)), Qt::DirectConnection); \
|
||||||
|
connect((OBJ), SIGNAL(detailsChanged(QString)), this, SLOT(setDetails(QString)), Qt::DirectConnection); \
|
||||||
|
connect((OBJ), SIGNAL(messageLogged(QString)), this, SLOT(log(QString)), Qt::DirectConnection); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
while(0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Input types
|
* Input types
|
||||||
*/
|
*/
|
||||||
@ -154,17 +166,8 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Establish connections
|
//Establish connections
|
||||||
connect(m_encoder, SIGNAL(statusChanged(JobStatus)), this, SIGNAL(setStatus(QString)), Qt::DirectConnection);
|
CONNECT(m_encoder);
|
||||||
connect(m_encoder, SIGNAL(progressChanged(unsigned int)), this, SIGNAL(setProgress(QString)), Qt::DirectConnection);
|
CONNECT(m_pipedSource);
|
||||||
connect(m_encoder, SIGNAL(messageLogged(QString)), this, SIGNAL(log(QString)), Qt::DirectConnection);
|
|
||||||
connect(m_encoder, SIGNAL(detailsChanged(QString)), this, SIGNAL(setDetails(QString)), Qt::DirectConnection);
|
|
||||||
if(m_pipedSource)
|
|
||||||
{
|
|
||||||
connect(m_pipedSource, SIGNAL(statusChanged(JobStatus)), this, SIGNAL(setStatus(QString)), Qt::DirectConnection);
|
|
||||||
connect(m_pipedSource, SIGNAL(progressChanged(unsigned int)), this, SIGNAL(setProgress(QString)), Qt::DirectConnection);
|
|
||||||
connect(m_pipedSource, SIGNAL(messageLogged(QString)), this, SIGNAL(log(QString)), Qt::DirectConnection);
|
|
||||||
connect(m_pipedSource, SIGNAL(detailsChanged(QString)), this, SIGNAL(setDetails(QString)), Qt::DirectConnection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EncodeThread::~EncodeThread(void)
|
EncodeThread::~EncodeThread(void)
|
||||||
@ -290,14 +293,13 @@ void EncodeThread::encode(void)
|
|||||||
m_encoder->printVersion(encoderRevision, encoderModified);
|
m_encoder->printVersion(encoderRevision, encoderModified);
|
||||||
|
|
||||||
//Is encoder version suppoprted?
|
//Is encoder version suppoprted?
|
||||||
if(!m_encoder->isVersionSupported(encoderRevision, encoderModified))
|
CHECK_STATUS(m_abort, (ok = m_encoder->isVersionSupported(encoderRevision, encoderModified)));
|
||||||
{
|
|
||||||
setStatus(JobStatus_Failed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_pipedSource)
|
if(m_pipedSource)
|
||||||
{
|
{
|
||||||
|
//Is source type available?
|
||||||
|
CHECK_STATUS(m_abort, (ok = m_pipedSource->isSourceAvailable()));
|
||||||
|
|
||||||
//Checking source version
|
//Checking source version
|
||||||
bool sourceModified = false;
|
bool sourceModified = false;
|
||||||
const unsigned int sourceRevision = m_pipedSource->checkVersion(sourceModified);
|
const unsigned int sourceRevision = m_pipedSource->checkVersion(sourceModified);
|
||||||
@ -307,11 +309,7 @@ void EncodeThread::encode(void)
|
|||||||
m_pipedSource->printVersion(sourceModified, sourceModified);
|
m_pipedSource->printVersion(sourceModified, sourceModified);
|
||||||
|
|
||||||
//Is source version supported?
|
//Is source version supported?
|
||||||
if(!m_pipedSource->isVersionSupported(sourceRevision, sourceModified))
|
CHECK_STATUS(m_abort, (ok = m_pipedSource->isVersionSupported(sourceRevision, sourceModified)));
|
||||||
{
|
|
||||||
setStatus(JobStatus_Failed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
@ -402,7 +400,11 @@ void EncodeThread::setProgress(const unsigned int &newProgress)
|
|||||||
|
|
||||||
void EncodeThread::setDetails(const QString &text)
|
void EncodeThread::setDetails(const QString &text)
|
||||||
{
|
{
|
||||||
|
if((!text.isEmpty()) && (m_details.compare(text) != 0))
|
||||||
|
{
|
||||||
emit detailsChanged(m_jobId, text);
|
emit detailsChanged(m_jobId, text);
|
||||||
|
m_details = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int EncodeThread::getInputType(const QString &fileExt)
|
int EncodeThread::getInputType(const QString &fileExt)
|
||||||
|
@ -92,6 +92,7 @@ protected:
|
|||||||
//Internal status values
|
//Internal status values
|
||||||
JobStatus m_status;
|
JobStatus m_status;
|
||||||
unsigned int m_progress;
|
unsigned int m_progress;
|
||||||
|
QString m_details;
|
||||||
|
|
||||||
//Encoder and Source objects
|
//Encoder and Source objects
|
||||||
AbstractEncoder *m_encoder;
|
AbstractEncoder *m_encoder;
|
||||||
|
@ -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 791
|
#define VER_X264_BUILD 793
|
||||||
|
|
||||||
#define VER_X264_PORTABLE_EDITION (0)
|
#define VER_X264_PORTABLE_EDITION (0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user