- for (int i = 0; i < paramsList.count(); i++) {
- if (paramsList.at(i).startsWith("profile=")) {
- if (paramsList.at(i).section('=', 1) != m_profile.path) resizeProfile = true;
- break;
+
+ QScriptEngine sEngine;
+ sEngine.globalObject().setProperty("bitrate", m_view.comboBitrates->currentText());
+ sEngine.globalObject().setProperty("dar", '@' + QString::number(m_profile.display_aspect_num) + '/' + QString::number(m_profile.display_aspect_den));
+ sEngine.globalObject().setProperty("passes", static_cast<int>(m_view.checkTwoPass->isChecked()) + 1);
+
+ for (int i = 0; i < paramsList.count(); ++i) {
+ QString paramName = paramsList.at(i).section('=', 0, 0);
+ QString paramValue = paramsList.at(i).section('=', 1, 1);
+ // If the profiles do not match we need to use the consumer tag
+ if (paramName == "mlt_profile=" && paramValue != m_profile.path) {
+ resizeProfile = true;
+ }
+ // evaluate expression
+ if (paramValue.startsWith('%')) {
+ paramValue = sEngine.evaluate(paramValue.remove(0, 1)).toString();
+ paramsList[i] = paramName + '=' + paramValue;