diff --git a/src/encoder_abstract.h b/src/encoder_abstract.h index 1a867eb..d3638a9 100644 --- a/src/encoder_abstract.h +++ b/src/encoder_abstract.h @@ -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 diff --git a/src/encoder_x264.cpp b/src/encoder_x264.cpp index 474d4d7..9fa2719 100644 --- a/src/encoder_x264.cpp +++ b/src/encoder_x264.cpp @@ -30,8 +30,8 @@ #include //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; diff --git a/src/encoder_x265.cpp b/src/encoder_x265.cpp index 1ca70fa..42c551a 100644 --- a/src/encoder_x265.cpp +++ b/src/encoder_x265.cpp @@ -31,8 +31,8 @@ #include //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; } diff --git a/src/version.h b/src/version.h index 500d6a6..d6bba7f 100644 --- a/src/version.h +++ b/src/version.h @@ -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) diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp index fcd0efd..2142dbd 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -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("The selected RC mode is not supported by the selected encoder!")); + 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) {