OSDN Git Service

Fixed detection of x265 core version 1.0 and higher (old code assumed "0.x" format).
authorlordmulder <mulder2@gmx.de>
Mon, 5 May 2014 16:20:58 +0000 (18:20 +0200)
committerlordmulder <mulder2@gmx.de>
Mon, 5 May 2014 16:20:58 +0000 (18:20 +0200)
src/encoder_x265.cpp
src/thread_encode.cpp
src/version.h

index 29f4624..cf65ffc 100644 (file)
@@ -182,7 +182,7 @@ const QString &X265Encoder::getName(void)
 void X265Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
 {
        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)
@@ -191,11 +191,16 @@ void X265Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
 
        if((offset = patterns[0]->lastIndexIn(line)) >= 0)
        {
-               bool ok1 = false, ok2 = false;
-               unsigned int temp1 = patterns[0]->cap(1).toUInt(&ok1);
-               unsigned int temp2 = patterns[0]->cap(2).toUInt(&ok2);
-               if(ok1) coreVers = temp1;
-               if(ok2) revision = temp2;
+               bool ok[3] = { false, false, false };
+               unsigned int temp[3];
+               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]);
+               if(ok[0] && ok[1])
+               {
+                       coreVers = (10 * temp[0]) + temp[1];
+               }
+               if(ok[2]) revision = temp[2];
        }
 
        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)
 {
-       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)
index 89626b6..20ae23b 100644 (file)
@@ -262,7 +262,7 @@ void EncodeThread::encode(void)
        log(tr("Preset  : %1").arg(m_options->preset()));
        log(tr("Tuning  : %1").arg(m_options->tune()));
        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;
        unsigned int frames = 0;
index 6f65556..e123a4f 100644 (file)
@@ -26,7 +26,7 @@
 #define VER_X264_MAJOR 2
 #define VER_X264_MINOR 3
 #define VER_X264_PATCH 9
-#define VER_X264_BUILD 864
+#define VER_X264_BUILD 865
 
 #define VER_X264_PORTABLE_EDITION (0)