diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-10-31 21:45:59 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-11-01 13:23:22 +0100 |
commit | 1fa826738d555f0a68552e2ab4f51c2b316ae1ca (patch) | |
tree | 3ddfa15645cd751f5454cbc8095df15dc1bc4eb5 /rbutil | |
parent | daefd5686fe37a23d09b8bd65ffcaa28bdd1e8b0 (diff) |
rbutil: Simplify extenal encoder binary handling.
We only use lame as external encoder for voice on the Archos targets.
Simplify the implementation by removing (unused) handling of (potential)
other encoders.
Change-Id: I175cc21868fb7ef9524247d78cfb7bdf65e9e162
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/base/encoderexe.cpp | 54 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/encoderexe.h | 2 |
2 files changed, 19 insertions, 37 deletions
diff --git a/rbutil/rbutilqt/base/encoderexe.cpp b/rbutil/rbutilqt/base/encoderexe.cpp index 81315691e5..331b5fb2a4 100644 --- a/rbutil/rbutilqt/base/encoderexe.cpp +++ b/rbutil/rbutilqt/base/encoderexe.cpp @@ -22,31 +22,27 @@ #include "utils.h" #include "Logger.h" -EncoderExe::EncoderExe(QString name,QObject *parent) : EncoderBase(parent) +EncoderExe::EncoderExe(QString name, QObject *parent) : EncoderBase(parent), + m_name(name) { - m_name = name; - - m_TemplateMap["lame"] = "\"%exe\" %options \"%input\" \"%output\""; - } - void EncoderExe::generateSettings() { - QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString(); - if(exepath == "") exepath = Utils::findExecutable(m_name); + QString exepath = RbSettings::subValue(m_name,RbSettings::EncoderPath).toString(); + if(exepath.isEmpty()) exepath = Utils::findExecutable(m_name); - insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING, - tr("Path to Encoder:"),exepath,EncTtsSetting::eBROWSEBTN)); - insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING, - tr("Encoder options:"),RbSettings::subValue(m_name,RbSettings::EncoderOptions))); + insertSetting(eEXEPATH, new EncTtsSetting(this, EncTtsSetting::eSTRING, + tr("Path to Encoder:"), exepath, EncTtsSetting::eBROWSEBTN)); + insertSetting(eEXEOPTIONS, new EncTtsSetting(this, EncTtsSetting::eSTRING, + tr("Encoder options:"), RbSettings::subValue(m_name, RbSettings::EncoderOptions))); } void EncoderExe::saveSettings() { - RbSettings::setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString()); - RbSettings::setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString()); + RbSettings::setSubValue(m_name, RbSettings::EncoderPath, getSetting(eEXEPATH)->current().toString()); + RbSettings::setSubValue(m_name, RbSettings::EncoderOptions, getSetting(eEXEOPTIONS)->current().toString()); RbSettings::sync(); } @@ -55,29 +51,20 @@ bool EncoderExe::start() m_EncExec = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString(); m_EncOpts = RbSettings::subValue(m_name, RbSettings::EncoderOptions).toString(); - m_EncTemplate = m_TemplateMap.value(m_name); - QFileInfo enc(m_EncExec); - if(enc.exists()) - { - return true; - } - else - { - return false; - } + return enc.exists(); } bool EncoderExe::encode(QString input,QString output) { - QString execstring = m_EncTemplate; + if (!configOk()) + return false; - execstring.replace("%exe",m_EncExec); - execstring.replace("%options",m_EncOpts); - execstring.replace("%input",input); - execstring.replace("%output",output); - LOG_INFO() << "cmd: " << execstring; - int result = QProcess::execute(execstring); + QStringList args; + args << m_EncOpts; + args << input; + args << output; + int result = QProcess::execute(m_EncExec, args); return result == 0; } @@ -86,9 +73,6 @@ bool EncoderExe::configOk() { QString path = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString(); - if (QFileInfo(path).exists()) - return true; - - return false; + return QFileInfo::exists(path); } diff --git a/rbutil/rbutilqt/base/encoderexe.h b/rbutil/rbutilqt/base/encoderexe.h index 699dc417e1..dd1c57ec67 100644 --- a/rbutil/rbutilqt/base/encoderexe.h +++ b/rbutil/rbutilqt/base/encoderexe.h @@ -48,8 +48,6 @@ class EncoderExe : public EncoderBase QString m_name; QString m_EncExec; QString m_EncOpts; - QMap<QString,QString> m_TemplateMap; - QString m_EncTemplate; }; #endif |