OSDN Git Service

Added support for presets to NVEncC.
authorlordmulder <mulder2@gmx.de>
Fri, 10 Apr 2020 13:09:39 +0000 (15:09 +0200)
committerlordmulder <mulder2@gmx.de>
Fri, 10 Apr 2020 13:09:39 +0000 (15:09 +0200)
src/encoder_nvencc.cpp
src/string_validator.cpp

index 52890c7..06bbb2c 100644 (file)
@@ -144,7 +144,7 @@ public:
 
        virtual QStringList getPresets(void) const
        {
-               return QStringList();
+               return QStringList() << "performance" << "quality";
        }
 
        virtual QStringList getProfiles(const quint32 &variant) const
@@ -341,6 +341,15 @@ void NVEncEncoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, c
                MUTILS_THROW("Bad encoder variant !!!");
        }
 
+       const QString preset = m_options->preset().simplified().toLower();
+       if(!preset.isEmpty())
+       {
+               if(preset.compare(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED), Qt::CaseInsensitive) != 0)
+               {
+                       cmdLine << "--preset" << preset;
+               }
+       }
+
        switch(m_options->rcMode())
        {
        case 0:
index 820df50..1007b34 100644 (file)
@@ -167,8 +167,8 @@ const bool &StringValidator::setStatus(const bool &flag, const QString &toolName
 
 QValidator::State StringValidatorEncoder::validate(QString &input, int &pos) const
 {
-       static const char *const params[] = { "D", "B", "o", "h", "p", "q", /*"fps", "frames",*/ "preset", "tune", "profile",
-               "stdin", "crf", "bitrate", "qp", "pass", "stats", "output", "output-depth", "help", "quiet", "codec", "y4m", NULL };
+       static const char *const params[] = { "D", "B", "o", "h", "p", "q", "u", "preset", "tune", "profile", "stdin",
+               "crf", "bitrate", "qp", "pass", "stats", "output", "output-depth", "help", "quiet", "codec", "y4m", NULL };
 
        const QString commandLine = input.trimmed();
        const QStringList tokens =  commandLine.isEmpty() ? QStringList() : MUtils::OS::crack_command_line(commandLine);