Fixed parsing of source properties for new Avs2YUV version.

This commit is contained in:
LoRd_MuldeR 2017-01-07 21:54:06 +01:00
parent b46a90dab3
commit a348b67891
14 changed files with 29 additions and 53 deletions

View File

@ -87,7 +87,7 @@ protected:
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const ClipInfo &clipInfo, const QString &indexFile, const int &pass, const QString &passLogFile) = 0;
virtual void runEncodingPass_init(QList<QRegExp*> &patterns) = 0;
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) = 0;
virtual void runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) = 0;
static double estimateSize(const QString &fileName, const double &progress);
static QString sizeToString(qint64 size);

View File

@ -252,7 +252,7 @@ void NVEncEncoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmd
patterns << new QRegExp("\\bNVEncC\\s+\\(x\\d+\\)\\s+(\\d)\\.(\\d+).*\\[NVENC\\s+API\\s+v(\\d+)\\.(\\d+)\\]", Qt::CaseInsensitive);
}
void NVEncEncoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
void NVEncEncoder::checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
{
if(patterns[0]->lastIndexIn(line) >= 0)
{
@ -389,7 +389,7 @@ void NVEncEncoder::runEncodingPass_init(QList<QRegExp*> &patterns)
patterns << new QRegExp("nvEncodeAPI.dll\\s+does\\s+not\\s+exists\\s+in\\s+your\\s+system", Qt::CaseInsensitive);
}
void NVEncEncoder::runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate)
void NVEncEncoder::runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate)
{
int offset = -1;
if((offset = patterns[0]->lastIndexIn(line)) >= 0)

View File

@ -42,9 +42,9 @@ protected:
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const ClipInfo &clipInfo, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual bool checkVersion_succeeded(const int &exitCode);
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate);
virtual void runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate);
};

View File

@ -234,7 +234,7 @@ void X264Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdL
patterns << new QRegExp("\\bx264\\s+(\\d)\\.(\\d+)\\.(\\d+)", Qt::CaseInsensitive);
}
void X264Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
void X264Encoder::checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
{
if(patterns[0]->lastIndexIn(line) >= 0)
{
@ -398,7 +398,7 @@ void X264Encoder::runEncodingPass_init(QList<QRegExp*> &patterns)
patterns << new QRegExp("\\[\\s*(\\d+)\\.(\\d+)%\\]\\s+(\\d+)/(\\d+)\\s(\\d+).(\\d+)\\s(\\d+).(\\d+)\\s+(\\d+):(\\d+):(\\d+)\\s+(\\d+):(\\d+):(\\d+)"); //regExpModified
}
void X264Encoder::runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate)
void X264Encoder::runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate)
{
int offset = -1;
if((offset = patterns[0]->lastIndexIn(line)) >= 0)

View File

@ -42,9 +42,9 @@ protected:
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const ClipInfo &clipInfo, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate);
virtual void runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate);
};

View File

@ -230,7 +230,7 @@ void X265Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdL
patterns << new QRegExp("\\bHEVC\\s+encoder\\s+version\\s+(\\d)\\.(\\d+)\\b", Qt::CaseInsensitive);
}
void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
void X265Encoder::checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
{
int offset = -1;
@ -387,7 +387,7 @@ void X265Encoder::runEncodingPass_init(QList<QRegExp*> &patterns)
patterns << new QRegExp("\\[\\s*(\\d+)\\.(\\d+)%\\]\\s+(\\d+)/(\\d+)\\s(\\d+).(\\d+)\\s(\\d+).(\\d+)\\s+(\\d+):(\\d+):(\\d+)\\s+(\\d+):(\\d+):(\\d+)"); //regExpModified
}
void X265Encoder::runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate)
void X265Encoder::runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate)
{
int offset = -1;
if((offset = patterns[0]->lastIndexIn(line)) >= 0)

View File

@ -42,8 +42,8 @@ protected:
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const ClipInfo &clipInfo, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate);
virtual void runEncodingPass_parseLine(const QString &line, const QList<QRegExp*> &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate);
};

View File

@ -51,7 +51,7 @@ public:
protected:
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, ClipInfo &clipInfo) = 0;
virtual void checkSourceProperties_parseLine(const QString &line, const QList<QRegExp*> &patterns, ClipInfo &clipInfo) = 0;
virtual void buildCommandLine(QStringList &cmdLine) = 0;

View File

@ -105,7 +105,7 @@ void AvisynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList &c
patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive);
}
void AvisynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
void AvisynthSource::checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
{
int offset = -1;
@ -178,54 +178,30 @@ void AvisynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStri
cmdLine << "-frames" << "1";
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true)) << "NUL";
patterns << new QRegExp(": (\\d+)x(\\d+), (\\d+) fps, (\\d+) frames");
patterns << new QRegExp(": (\\d+)x(\\d+), (\\d+)/(\\d+) fps, (\\d+) frames");
patterns << new QRegExp(":\\s+(\\d+)\\s*x\\s*(\\d+)\\s*,\\s+\\w+\\s*,\\s+\\d+-bits\\s*,\\s+\\w+\\s*,\\s+(\\d+)\\s+fps\\s*,\\s+(\\d+)\\s+frames");
patterns << new QRegExp(":\\s+(\\d+)\\s*x\\s*(\\d+)\\s*,\\s+\\w+\\s*,\\s+\\d+-bits\\s*,\\s+\\w+\\s*,\\s+(\\d+)\\s*/\\s*(\\d+)\\s+fps\\s*,\\s+(\\d+)\\s+frames");
}
void AvisynthSource::checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, ClipInfo &clipInfo)
void AvisynthSource::checkSourceProperties_parseLine(const QString &line, const QList<QRegExp*> &patterns, ClipInfo &clipInfo)
{
int offset = -1;
quint32 temp[5];
if((offset = patterns[0]->lastIndexIn(line)) >= 0)
{
bool ok[4] = { false, false, false, false };
quint32 temp[4];
temp[0] = patterns[0]->cap(1).toUInt(&ok[0]);
temp[1] = patterns[0]->cap(2).toUInt(&ok[1]);
temp[2] = patterns[0]->cap(3).toUInt(&ok[2]);
temp[3] = patterns[0]->cap(4).toUInt(&ok[3]);
if (ok[0] && ok[1])
if (MUtils::regexp_parse_uint32((*patterns[0]), temp, 4))
{
clipInfo.setFrameSize(temp[0], temp[1]);
}
if (ok[2])
{
clipInfo.setFrameRate(temp[2], 0);
}
if (ok[3])
{
clipInfo.setFrameCount(temp[3]);
}
}
else if((offset = patterns[1]->lastIndexIn(line)) >= 0)
{
bool ok[5] = { false, false, false, false, false };
quint32 temp[5];
temp[0] = patterns[1]->cap(1).toUInt(&ok[0]);
temp[1] = patterns[1]->cap(2).toUInt(&ok[1]);
temp[2] = patterns[1]->cap(3).toUInt(&ok[2]);
temp[3] = patterns[1]->cap(4).toUInt(&ok[3]);
temp[4] = patterns[1]->cap(5).toUInt(&ok[4]);
if (ok[0] && ok[1])
if (MUtils::regexp_parse_uint32((*patterns[1]), temp, 5))
{
clipInfo.setFrameSize(temp[0], temp[1]);
}
if (ok[2] && ok[3])
{
clipInfo.setFrameRate(temp[2], temp[3]);
}
if (ok[4])
{
clipInfo.setFrameCount(temp[4]);
}
}

View File

@ -43,11 +43,11 @@ public:
protected:
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual bool checkVersion_succeeded(const int &exitCode);
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, ClipInfo &clipInfo);
virtual void checkSourceProperties_parseLine(const QString &line, const QList<QRegExp*> &patterns, ClipInfo &clipInfo);
virtual QString getBinaryPath(void) const { return getSourceInfo().getBinaryPath(m_sysinfo, m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && (m_preferences->getPrefer64BitSource() || (!m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X86)))); }
virtual QStringList getExtraPath(void) const { return getSourceInfo().getExtraPaths(m_sysinfo, m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && (m_preferences->getPrefer64BitSource() || (!m_sysinfo->getAvisynth(SysinfoModel::Avisynth_X86)))); }

View File

@ -95,7 +95,7 @@ void VapoursynthSource::checkVersion_init(QList<QRegExp*> &patterns, QStringList
patterns << new QRegExp("\\bAPI\\s+r(\\d+)\\b", Qt::CaseInsensitive);
}
void VapoursynthSource::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
void VapoursynthSource::checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
{
int offset = -1;
@ -171,7 +171,7 @@ void VapoursynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QS
patterns << new QRegExp("\\bFPS:\\s+(\\d+)/(\\d+)\\b");
}
void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, ClipInfo &clipInfo)
void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, const QList<QRegExp*> &patterns, ClipInfo &clipInfo)
{
int offset = -1;

View File

@ -43,10 +43,10 @@ public:
protected:
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, ClipInfo &clipInfo);
virtual void checkSourceProperties_parseLine(const QString &line, const QList<QRegExp*> &patterns, ClipInfo &clipInfo);
virtual QString getBinaryPath() const { return getSourceInfo().getBinaryPath(m_sysinfo, m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_sysinfo->getVapourSynth(SysinfoModel::VapourSynth_X64) && (m_preferences->getPrefer64BitSource() || (!m_sysinfo->getVapourSynth(SysinfoModel::VapourSynth_X86)))); }
virtual void buildCommandLine(QStringList &cmdLine);

View File

@ -67,7 +67,7 @@ protected:
virtual QStringList getExtraPaths(void) const { return QStringList(); }
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;
virtual void checkVersion_parseLine(const QString &line, const QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified) = 0;
virtual bool checkVersion_succeeded(const int &exitCode);
void log(const QString &text) { emit messageLogged(text); }

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 7
#define VER_X264_PATCH 8
#define VER_X264_BUILD 1082
#define VER_X264_BUILD 1084
#define VER_X264_PORTABLE_EDITION (0)