}
}
}
+ if (version <= 0.85) {
+ // update the LADSPA effects to use the new ladspa.id format instead of external xml file
+ QDomNodeList effectNodes = m_doc.elementsByTagName("filter");
+ for (int i = 0; i < effectNodes.count(); ++i) {
+ QDomElement effect = effectNodes.at(i).toElement();
+ if (EffectsList::property(effect, "mlt_service") == "ladspa") {
+ // Needs to be converted
+ QStringList info = getInfoFromEffectName(EffectsList::property(effect, "kdenlive_id"));
+ if (info.isEmpty()) continue;
+ // info contains the correct ladspa.id from kdenlive effect name, and a list of parameter's old and new names
+ EffectsList::setProperty(effect, "kdenlive_id", info.at(0));
+ EffectsList::setProperty(effect, "tag", info.at(0));
+ EffectsList::setProperty(effect, "mlt_service", info.at(0));
+ EffectsList::removeProperty(effect, "src");
+ for (int j = 1; j < info.size(); j++) {
+ QString value = EffectsList::property(effect, info.at(j).section('=', 0, 0));
+ if (!value.isEmpty()) {
+ // update parameter name
+ EffectsList::renameProperty(effect, info.at(j).section('=', 0, 0), info.at(j).section('=', 1, 1));
+ }
+ }
+ }
+ }
+ }
// The document has been converted: mark it as modified
return true;
}
+QStringList DocumentValidator::getInfoFromEffectName(const QString oldName)
+{
+ QStringList info;
+ // Returns a list to convert old Kdenlive ladspa effects
+ if (oldName == "pitch_shift") {
+ info << "ladspa.1433";
+ info << "pitch=0";
+ }
+ else if (oldName == "vinyl") {
+ info << "ladspa.1905";
+ info << "year=0";
+ info << "rpm=1";
+ info << "warping=2";
+ info << "crackle=3";
+ info << "wear=4";
+ }
+ else if (oldName == "room_reverb") {
+ info << "ladspa.1216";
+ info << "room=0";
+ info << "delay=1";
+ info << "damp=2";
+ }
+ else if (oldName == "reverb") {
+ info << "ladspa.1423";
+ info << "room=0";
+ info << "damp=1";
+ }
+ else if (oldName == "rate_scale") {
+ info << "ladspa.1417";
+ info << "rate=0";
+ }
+ else if (oldName == "pitch_scale") {
+ info << "ladspa.1193";
+ info << "coef=0";
+ }
+ else if (oldName == "phaser") {
+ info << "ladspa.1217";
+ info << "rate=0";
+ info << "depth=1";
+ info << "feedback=2";
+ info << "spread=3";
+ }
+ else if (oldName == "limiter") {
+ info << "ladspa.1913";
+ info << "gain=0";
+ info << "limit=1";
+ info << "release=2";
+ }
+ else if (oldName == "equalizer_15") {
+ info << "ladspa.1197";
+ info << "1=0";
+ info << "2=1";
+ info << "3=2";
+ info << "4=3";
+ info << "5=4";
+ info << "6=5";
+ info << "7=6";
+ info << "8=7";
+ info << "9=8";
+ info << "10=9";
+ info << "11=10";
+ info << "12=11";
+ info << "13=12";
+ info << "14=13";
+ info << "15=14";
+ }
+ else if (oldName == "equalizer") {
+ info << "ladspa.1901";
+ info << "logain=0";
+ info << "midgain=1";
+ info << "higain=2";
+ }
+ else if (oldName == "declipper") {
+ info << "ladspa.1195";
+ }
+ return info;
+}
+
QString DocumentValidator::colorToString(const QColor& c)
{
QString ret = "%1,%2,%3,%4";
void EffectsList::setProperty(QDomElement effect, const QString &name, const QString &value)
{
QDomNodeList params = effect.elementsByTagName("property");
+ // Update property if it already exists
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (e.attribute("name") == name) {
}
}
+// static
+void EffectsList::renameProperty(QDomElement effect, const QString &oldName, const QString &newName)
+{
+ QDomNodeList params = effect.elementsByTagName("property");
+ // Update property if it already exists
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ if (e.attribute("name") == oldName) {
+ e.setAttribute("name", newName);
+ break;
+ }
+ }
+}
+
// static
QString EffectsList::property(QDomElement effect, const QString &name)
{
static QString parameter(QDomElement effect, const QString &name);
/** @brief Change the value of a 'property' element from the effect node. */
static void setProperty(QDomElement effect, const QString &name, const QString &value);
+ /** @brief Rename a 'property' element from the effect node. */
+ static void renameProperty(QDomElement effect, const QString &oldName, const QString &newName);
/** @brief Get the value of a 'property' element from the effect node. */
static QString property(QDomElement effect, const QString &name);
/** @brief Delete a 'property' element from the effect node. */
#include <mlt++/Mlt.h>
-const double DOCUMENTVERSION = 0.85;
+const double DOCUMENTVERSION = 0.86;
KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, QMap <QString, QString> properties, const QPoint tracks, Render *render, KTextEdit *notes, MainWindow *parent, KProgressDialog *progressDialog) :
QObject(parent),