Improved x264/x265 version check + check supported RC modes.
This commit is contained in:
parent
d10dfaec1e
commit
ca2d532f8b
@ -32,6 +32,7 @@ class AbstractEncoderInfo
|
||||
public:
|
||||
virtual QStringList supportedInputFormats (void) const = 0;
|
||||
virtual QStringList supportedOutputFormats(void) const = 0;
|
||||
virtual bool isRCModeSupported(const int rcMode) const = 0;
|
||||
};
|
||||
|
||||
class AbstractEncoder : public AbstractTool
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include <QRegExp>
|
||||
|
||||
//x264 version info
|
||||
static const unsigned int X264_VERSION_X264_MINIMUM_REV = 2397;
|
||||
static const unsigned int X264_VERSION_X264_CURRENT_API = 142;
|
||||
static const unsigned int VERSION_X264_MINIMUM_REV = 2397;
|
||||
static const unsigned int VERSION_X264_CURRENT_API = 142;
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Helper Macros
|
||||
@ -109,6 +109,20 @@ public:
|
||||
extLst << "mp4";
|
||||
return extLst;
|
||||
}
|
||||
|
||||
virtual bool isRCModeSupported(const int rcMode) const
|
||||
{
|
||||
switch(rcMode)
|
||||
{
|
||||
case OptionsModel::RCMode_CRF:
|
||||
case OptionsModel::RCMode_CQ:
|
||||
case OptionsModel::RCMode_2Pass:
|
||||
case OptionsModel::RCMode_ABR:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const X264EncoderInfo s_x264EncoderInfo;
|
||||
@ -196,16 +210,19 @@ QString X264Encoder::printVersion(const unsigned int &revision, const bool &modi
|
||||
|
||||
bool X264Encoder::isVersionSupported(const unsigned int &revision, const bool &modified)
|
||||
{
|
||||
if((revision % REV_MULT) < X264_VERSION_X264_MINIMUM_REV)
|
||||
const unsigned int ver = (revision / REV_MULT);
|
||||
const unsigned int rev = (revision % REV_MULT);
|
||||
|
||||
if((rev % REV_MULT) < VERSION_X264_MINIMUM_REV)
|
||||
{
|
||||
log(tr("\nERROR: Your revision of x264 is too old! (Minimum required revision is %1)").arg(QString::number(X264_VERSION_X264_MINIMUM_REV)));
|
||||
log(tr("\nERROR: Your revision of x264 is too old! Minimum required revision is %1.").arg(QString::number(VERSION_X264_MINIMUM_REV)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if((revision / REV_MULT) != X264_VERSION_X264_CURRENT_API)
|
||||
if(ver != VERSION_X264_CURRENT_API)
|
||||
{
|
||||
log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!"));
|
||||
log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(X264_VERSION_X264_CURRENT_API)));
|
||||
log(tr("\nWARNING: Your x264 binary uses an untested core (API) version, take care!"));
|
||||
log(tr("This application works best with x264 core (API) version %1. Newer versions may work or not.").arg(QString::number(VERSION_X264_CURRENT_API)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include <QRegExp>
|
||||
|
||||
//x265 version info
|
||||
static const unsigned int X265_VERSION_X264_MINIMUM_VER = 9;
|
||||
static const unsigned int X265_VERSION_X264_MINIMUM_REV = 29;
|
||||
static const unsigned int VERSION_X265_MINIMUM_VER = 9;
|
||||
static const unsigned int VERSION_X265_MINIMUM_REV = 29;
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Helper Macros
|
||||
@ -97,6 +97,20 @@ public:
|
||||
extLst << "hevc";
|
||||
return extLst;
|
||||
}
|
||||
|
||||
virtual bool isRCModeSupported(const int rcMode) const
|
||||
{
|
||||
switch(rcMode)
|
||||
{
|
||||
case OptionsModel::RCMode_CRF:
|
||||
case OptionsModel::RCMode_CQ:
|
||||
case OptionsModel::RCMode_ABR:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static const X265EncoderInfo s_x265EncoderInfo;
|
||||
@ -171,11 +185,16 @@ bool X265Encoder::isVersionSupported(const unsigned int &revision, const bool &m
|
||||
const unsigned int ver = (revision / REV_MULT);
|
||||
const unsigned int rev = (revision % REV_MULT);
|
||||
|
||||
if((ver < X265_VERSION_X264_MINIMUM_VER) || (rev < X265_VERSION_X264_MINIMUM_REV))
|
||||
if((ver < VERSION_X265_MINIMUM_VER) || ((ver == VERSION_X265_MINIMUM_VER) && (rev < VERSION_X265_MINIMUM_REV)))
|
||||
{
|
||||
log(tr("\nERROR: Your version of x265 is too old! (Minimum required revision is 0.%1+%2)").arg(QString::number(X265_VERSION_X264_MINIMUM_VER), QString::number(X265_VERSION_X264_MINIMUM_REV)));
|
||||
log(tr("\nERROR: Your version of x265 is too old! (Minimum required revision is 0.%1+%2)").arg(QString::number(VERSION_X265_MINIMUM_VER), QString::number(VERSION_X265_MINIMUM_REV)));
|
||||
return false;
|
||||
}
|
||||
else if(ver > VERSION_X265_MINIMUM_VER)
|
||||
{
|
||||
log(tr("\nWARNING: Your version of x265 is newer than the latest tested version, take care!"));
|
||||
log(tr("This application works best with x265 version %1. Newer versions may work or not.").arg(QString::number(VERSION_X265_MINIMUM_VER)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 3
|
||||
#define VER_X264_PATCH 5
|
||||
#define VER_X264_BUILD 813
|
||||
#define VER_X264_BUILD 815
|
||||
|
||||
#define VER_X264_PORTABLE_EDITION (0)
|
||||
|
||||
|
@ -501,6 +501,21 @@ void AddJobDialog::accept(void)
|
||||
//Get encoder info
|
||||
const AbstractEncoderInfo &encoderInfo = getEncoderInfo(ui->cbxEncoderType->currentIndex());
|
||||
|
||||
//Is selected RC mode supported?
|
||||
if(!encoderInfo.isRCModeSupported(ui->cbxRateControlMode->currentIndex()))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Bad RC Mode!"), tr("<nobr>The selected RC mode is not supported by the selected encoder!</nobr>"));
|
||||
for(int i = 0; i < ui->cbxRateControlMode->count(); i++)
|
||||
{
|
||||
if(encoderInfo.isRCModeSupported(i))
|
||||
{
|
||||
ui->cbxRateControlMode->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Is the type of the source file supported? (as far as we can tell)
|
||||
if(sourceFile.suffix().compare("AVS", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user