Some improvements to x264 version check. In particular, some "patched" builds with *broken* string should now produce the correct error message.

This commit is contained in:
LoRd_MuldeR 2015-01-05 20:53:01 +01:00
parent 7a09181ad2
commit 7524549739
6 changed files with 40 additions and 39 deletions

View File

@ -47,6 +47,7 @@ s_parameters[] =
MAKE_ARG( "no-force-enqueue", 0, CLI_PARAM_NO_FORCE_ENQUEUE ), MAKE_ARG( "no-force-enqueue", 0, CLI_PARAM_NO_FORCE_ENQUEUE ),
MAKE_ARG( "skip-avisynth-check", 0, CLI_PARAM_SKIP_AVS_CHECK ), MAKE_ARG( "skip-avisynth-check", 0, CLI_PARAM_SKIP_AVS_CHECK ),
MAKE_ARG( "skip-vapoursynth-check", 0, CLI_PARAM_SKIP_VPS_CHECK ), MAKE_ARG( "skip-vapoursynth-check", 0, CLI_PARAM_SKIP_VPS_CHECK ),
MAKE_ARG( "skip-version-checks", 0, CLI_PARAM_SKIP_VERSION_CHECK ),
MAKE_ARG( "no-deadlock-detection", 0, CLI_PARAM_NO_DEADLOCK ), MAKE_ARG( "no-deadlock-detection", 0, CLI_PARAM_NO_DEADLOCK ),
MAKE_ARG( "no-style", 0, CLI_PARAM_NO_GUI_STYLE ), MAKE_ARG( "no-style", 0, CLI_PARAM_NO_GUI_STYLE ),
MAKE_ARG( "first-run", 0, CLI_PARAM_FIRST_RUN ), MAKE_ARG( "first-run", 0, CLI_PARAM_FIRST_RUN ),

View File

@ -35,7 +35,7 @@ static const int CLI_PARAM_FORCE_ENQUEUE = 4;
static const int CLI_PARAM_NO_FORCE_ENQUEUE = 5; static const int CLI_PARAM_NO_FORCE_ENQUEUE = 5;
static const int CLI_PARAM_SKIP_AVS_CHECK = 6; static const int CLI_PARAM_SKIP_AVS_CHECK = 6;
static const int CLI_PARAM_SKIP_VPS_CHECK = 7; static const int CLI_PARAM_SKIP_VPS_CHECK = 7;
static const int CLI_PARAM_SKIP_X264_CHECK = 8; static const int CLI_PARAM_SKIP_VERSION_CHECK = 8;
static const int CLI_PARAM_NO_DEADLOCK = 9; static const int CLI_PARAM_NO_DEADLOCK = 9;
static const int CLI_PARAM_NO_GUI_STYLE = 10; static const int CLI_PARAM_NO_GUI_STYLE = 10;
static const int CLI_PARAM_FIRST_RUN = 11; static const int CLI_PARAM_FIRST_RUN = 11;

View File

@ -206,8 +206,8 @@ const QString &X264Encoder::getName(void)
void X264Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine) void X264Encoder::checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
{ {
cmdLine << "--version"; cmdLine << "--version";
patterns << new QRegExp("\\bx264\\s(\\d)\\.(\\d+)\\.(\\d+)\\s([a-f0-9]{7})", Qt::CaseInsensitive); patterns << new QRegExp("\\bx264\\s+(\\d)\\.(\\d+)\\.(\\d+)\\s+([a-f0-9]{7})", Qt::CaseInsensitive);
patterns << new QRegExp("\\bx264 (\\d)\\.(\\d+)\\.(\\d+)", Qt::CaseInsensitive); 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, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified)
@ -219,7 +219,7 @@ void X264Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
bool ok1 = false, ok2 = false; bool ok1 = false, ok2 = false;
unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1); unsigned int temp1 = patterns[0]->cap(2).toUInt(&ok1);
unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2); unsigned int temp2 = patterns[0]->cap(3).toUInt(&ok2);
if(ok1 && ok2) if(ok1 && ok2 && (temp1 > 0) && (temp2 > 0))
{ {
core = temp1; core = temp1;
build = temp2; build = temp2;
@ -230,7 +230,7 @@ void X264Encoder::checkVersion_parseLine(const QString &line, QList<QRegExp*> &p
bool ok1 = false, ok2 = false; bool ok1 = false, ok2 = false;
unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1); unsigned int temp1 = patterns[1]->cap(2).toUInt(&ok1);
unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2); unsigned int temp2 = patterns[1]->cap(3).toUInt(&ok2);
if(ok1 && ok2) if(ok1 && ok2 && (temp1 > 0) && (temp2 > 0))
{ {
core = temp1; core = temp1;
build = temp2; build = temp2;

View File

@ -62,7 +62,7 @@ unsigned int AbstractTool::checkVersion(bool &modified)
if(m_preferences->getSkipVersionTest()) if(m_preferences->getSkipVersionTest())
{ {
log("Warning: Skipping the version check this time!"); log("Warning: Skipping the version check this time!");
return makeRevision(9999, 9999); return makeRevision(0xFFF0, 0xFFF0);
} }
QProcess process; QProcess process;

View File

@ -25,8 +25,8 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 4 #define VER_X264_MINOR 4
#define VER_X264_PATCH 4 #define VER_X264_PATCH 5
#define VER_X264_BUILD 896 #define VER_X264_BUILD 900
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)

View File

@ -869,9 +869,9 @@ void MainWindow::init(void)
} }
//Skip version check (not recommended!) //Skip version check (not recommended!)
if(CLIParser::checkFlag(CLI_PARAM_SKIP_X264_CHECK, arguments)) if(CLIParser::checkFlag(CLI_PARAM_SKIP_VERSION_CHECK, arguments))
{ {
qWarning("x264 version check disabled, you have been warned!\n"); qWarning("Version checks are disabled now, you have been warned!\n");
m_preferences->setSkipVersionTest(true); m_preferences->setSkipVersionTest(true);
} }