diff --git a/src/encoder_abstract.h b/src/encoder_abstract.h index 8335dbf..b9a4a96 100644 --- a/src/encoder_abstract.h +++ b/src/encoder_abstract.h @@ -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 &patterns) = 0; - virtual void runEncodingPass_parseLine(const QString &line, QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) = 0; + virtual void runEncodingPass_parseLine(const QString &line, const QList &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); diff --git a/src/encoder_nvenc.cpp b/src/encoder_nvenc.cpp index 270063d..61c7bb6 100644 --- a/src/encoder_nvenc.cpp +++ b/src/encoder_nvenc.cpp @@ -252,7 +252,7 @@ void NVEncEncoder::checkVersion_init(QList &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 &patterns, unsigned int &core, unsigned int &build, bool &modified) +void NVEncEncoder::checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified) { if(patterns[0]->lastIndexIn(line) >= 0) { @@ -389,7 +389,7 @@ void NVEncEncoder::runEncodingPass_init(QList &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 &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) +void NVEncEncoder::runEncodingPass_parseLine(const QString &line, const QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) { int offset = -1; if((offset = patterns[0]->lastIndexIn(line)) >= 0) diff --git a/src/encoder_nvenc.h b/src/encoder_nvenc.h index 9806625..d7148d9 100644 --- a/src/encoder_nvenc.h +++ b/src/encoder_nvenc.h @@ -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 &patterns, QStringList &cmdLine); - virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified); + virtual void checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified); virtual bool checkVersion_succeeded(const int &exitCode); virtual void runEncodingPass_init(QList &patterns); - virtual void runEncodingPass_parseLine(const QString &line, QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate); + virtual void runEncodingPass_parseLine(const QString &line, const QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate); }; diff --git a/src/encoder_x264.cpp b/src/encoder_x264.cpp index a4bfeb4..10a7815 100644 --- a/src/encoder_x264.cpp +++ b/src/encoder_x264.cpp @@ -234,7 +234,7 @@ void X264Encoder::checkVersion_init(QList &patterns, QStringList &cmdL patterns << new QRegExp("\\bx264\\s+(\\d)\\.(\\d+)\\.(\\d+)", Qt::CaseInsensitive); } -void X264Encoder::checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified) +void X264Encoder::checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified) { if(patterns[0]->lastIndexIn(line) >= 0) { @@ -398,7 +398,7 @@ void X264Encoder::runEncodingPass_init(QList &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 &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) +void X264Encoder::runEncodingPass_parseLine(const QString &line, const QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) { int offset = -1; if((offset = patterns[0]->lastIndexIn(line)) >= 0) diff --git a/src/encoder_x264.h b/src/encoder_x264.h index b73849c..7e9ec95 100644 --- a/src/encoder_x264.h +++ b/src/encoder_x264.h @@ -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 &patterns, QStringList &cmdLine); - virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified); + virtual void checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified); virtual void runEncodingPass_init(QList &patterns); - virtual void runEncodingPass_parseLine(const QString &line, QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate); + virtual void runEncodingPass_parseLine(const QString &line, const QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate); }; diff --git a/src/encoder_x265.cpp b/src/encoder_x265.cpp index c9755e4..4362791 100644 --- a/src/encoder_x265.cpp +++ b/src/encoder_x265.cpp @@ -230,7 +230,7 @@ void X265Encoder::checkVersion_init(QList &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 &patterns, unsigned int &core, unsigned int &build, bool &modified) +void X265Encoder::checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified) { int offset = -1; @@ -387,7 +387,7 @@ void X265Encoder::runEncodingPass_init(QList &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 &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) +void X265Encoder::runEncodingPass_parseLine(const QString &line, const QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate) { int offset = -1; if((offset = patterns[0]->lastIndexIn(line)) >= 0) diff --git a/src/encoder_x265.h b/src/encoder_x265.h index bab5dd4..46cffc8 100644 --- a/src/encoder_x265.h +++ b/src/encoder_x265.h @@ -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 &patterns, QStringList &cmdLine); - virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified); + virtual void checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified); virtual void runEncodingPass_init(QList &patterns); - virtual void runEncodingPass_parseLine(const QString &line, QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate); + virtual void runEncodingPass_parseLine(const QString &line, const QList &patterns, const ClipInfo &clipInfo, const int &pass, double &last_progress, double &size_estimate); }; diff --git a/src/source_abstract.h b/src/source_abstract.h index d4bb142..bd35e5e 100644 --- a/src/source_abstract.h +++ b/src/source_abstract.h @@ -51,7 +51,7 @@ public: protected: virtual void checkSourceProperties_init(QList &patterns, QStringList &cmdLine) = 0; - virtual void checkSourceProperties_parseLine(const QString &line, QList &patterns, ClipInfo &clipInfo) = 0; + virtual void checkSourceProperties_parseLine(const QString &line, const QList &patterns, ClipInfo &clipInfo) = 0; virtual void buildCommandLine(QStringList &cmdLine) = 0; diff --git a/src/source_avisynth.cpp b/src/source_avisynth.cpp index 0ae1795..d86417a 100644 --- a/src/source_avisynth.cpp +++ b/src/source_avisynth.cpp @@ -105,7 +105,7 @@ void AvisynthSource::checkVersion_init(QList &patterns, QStringList &c patterns << new QRegExp("\\bAvs2YUV (\\d+).(\\d+)bm(\\d)\\b", Qt::CaseInsensitive); } -void AvisynthSource::checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified) +void AvisynthSource::checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified) { int offset = -1; @@ -178,54 +178,30 @@ void AvisynthSource::checkSourceProperties_init(QList &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 &patterns, ClipInfo &clipInfo) +void AvisynthSource::checkSourceProperties_parseLine(const QString &line, const QList &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]); } } diff --git a/src/source_avisynth.h b/src/source_avisynth.h index 9892637..d947b62 100644 --- a/src/source_avisynth.h +++ b/src/source_avisynth.h @@ -43,11 +43,11 @@ public: protected: virtual void checkVersion_init(QList &patterns, QStringList &cmdLine); - virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified); + virtual void checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified); virtual bool checkVersion_succeeded(const int &exitCode); virtual void checkSourceProperties_init(QList &patterns, QStringList &cmdLine); - virtual void checkSourceProperties_parseLine(const QString &line, QList &patterns, ClipInfo &clipInfo); + virtual void checkSourceProperties_parseLine(const QString &line, const QList &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)))); } diff --git a/src/source_vapoursynth.cpp b/src/source_vapoursynth.cpp index 39f375d..41ed019 100644 --- a/src/source_vapoursynth.cpp +++ b/src/source_vapoursynth.cpp @@ -95,7 +95,7 @@ void VapoursynthSource::checkVersion_init(QList &patterns, QStringList patterns << new QRegExp("\\bAPI\\s+r(\\d+)\\b", Qt::CaseInsensitive); } -void VapoursynthSource::checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified) +void VapoursynthSource::checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified) { int offset = -1; @@ -171,7 +171,7 @@ void VapoursynthSource::checkSourceProperties_init(QList &patterns, QS patterns << new QRegExp("\\bFPS:\\s+(\\d+)/(\\d+)\\b"); } -void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, QList &patterns, ClipInfo &clipInfo) +void VapoursynthSource::checkSourceProperties_parseLine(const QString &line, const QList &patterns, ClipInfo &clipInfo) { int offset = -1; diff --git a/src/source_vapoursynth.h b/src/source_vapoursynth.h index 8b598ba..b3fa640 100644 --- a/src/source_vapoursynth.h +++ b/src/source_vapoursynth.h @@ -43,10 +43,10 @@ public: protected: virtual void checkVersion_init(QList &patterns, QStringList &cmdLine); - virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified); + virtual void checkVersion_parseLine(const QString &line, const QList &patterns, unsigned int &core, unsigned int &build, bool &modified); virtual void checkSourceProperties_init(QList &patterns, QStringList &cmdLine); - virtual void checkSourceProperties_parseLine(const QString &line, QList &patterns, ClipInfo &clipInfo); + virtual void checkSourceProperties_parseLine(const QString &line, const QList &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); diff --git a/src/tool_abstract.h b/src/tool_abstract.h index 310339f..0ed5941 100644 --- a/src/tool_abstract.h +++ b/src/tool_abstract.h @@ -67,7 +67,7 @@ protected: virtual QStringList getExtraPaths(void) const { return QStringList(); } virtual void checkVersion_init(QList &patterns, QStringList &cmdLine) = 0; - virtual void checkVersion_parseLine(const QString &line, QList &patterns, unsigned int &core, unsigned int &build, bool &modified) = 0; + virtual void checkVersion_parseLine(const QString &line, const QList &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); } diff --git a/src/version.h b/src/version.h index e69b586..057469d 100644 --- a/src/version.h +++ b/src/version.h @@ -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)