Fixed detection of x265 core version 1.0 and higher (old code assumed "0.x" format).

This commit is contained in:
LoRd_MuldeR 2014-05-05 18:20:58 +02:00
parent 8f16f75ead
commit 726d494ca1
3 changed files with 17 additions and 9 deletions

View File

@ -182,7 +182,7 @@ const QString &X265Encoder::getName(void)
void X265Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine) void X265Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
{ {
cmdLine << "--version"; cmdLine << "--version";
patterns << new QRegExp("\\bHEVC\\s+encoder\\s+version\\s+0\\.(\\d+)\\+(\\d+)-[a-f0-9]+\\b", Qt::CaseInsensitive); patterns << new QRegExp("\\bHEVC\\s+encoder\\s+version\\s+(\\d)\\.(\\d+)\\+(\\d+)-[a-f0-9]+\\b", Qt::CaseInsensitive);
} }
void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified) void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &coreVers, unsigned int &revision, bool &modified)
@ -191,11 +191,16 @@ void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
if((offset = patterns[0]->lastIndexIn(line)) >= 0) if((offset = patterns[0]->lastIndexIn(line)) >= 0)
{ {
bool ok1 = false, ok2 = false; bool ok[3] = { false, false, false };
unsigned int temp1 = patterns[0]->cap(1).toUInt(&ok1); unsigned int temp[3];
unsigned int temp2 = patterns[0]->cap(2).toUInt(&ok2); temp[0] = patterns[0]->cap(1).toUInt(&ok[0]);
if(ok1) coreVers = temp1; temp[1] = patterns[0]->cap(2).toUInt(&ok[1]);
if(ok2) revision = temp2; temp[2] = patterns[0]->cap(3).toUInt(&ok[2]);
if(ok[0] && ok[1])
{
coreVers = (10 * temp[0]) + temp[1];
}
if(ok[2]) revision = temp[2];
} }
if(!line.isEmpty()) if(!line.isEmpty())
@ -206,7 +211,10 @@ void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
QString X265Encoder::printVersion(const unsigned int &revision, const bool &modified) QString X265Encoder::printVersion(const unsigned int &revision, const bool &modified)
{ {
return tr("x265 version: 0.%1+%2").arg(QString::number(revision / REV_MULT), QString::number(revision % REV_MULT)); const unsigned int core = revision / REV_MULT;
const unsigned int plus = revision % REV_MULT;
return tr("x265 version: %1.%2+%3").arg(QString::number(core / 10), QString::number(core % 10), QString::number(plus));
} }
bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &modified) bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)

View File

@ -262,7 +262,7 @@ void EncodeThread::encode(void)
log(tr("Preset : %1").arg(m_options->preset())); log(tr("Preset : %1").arg(m_options->preset()));
log(tr("Tuning : %1").arg(m_options->tune())); log(tr("Tuning : %1").arg(m_options->tune()));
log(tr("Profile : %1").arg(m_options->profile())); log(tr("Profile : %1").arg(m_options->profile()));
log(tr("Custom : %1").arg(m_options->customEncParams().isEmpty() ? tr("(None)") : m_options->customEncParams())); log(tr("Custom : %1").arg(m_options->customEncParams().isEmpty() ? tr("<None>") : m_options->customEncParams()));
bool ok = false; bool ok = false;
unsigned int frames = 0; unsigned int frames = 0;

View File

@ -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 9 #define VER_X264_PATCH 9
#define VER_X264_BUILD 864 #define VER_X264_BUILD 865
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)