KGlobal::dirs()->addResourceDir("ladspa_plugin", "/usr/lib64/ladspa");
KGlobal::dirs()->addResourceDir("ladspa_plugin", "/usr/local/lib64/ladspa");*/
- // Set the directories to look into for effects.
- QStringList direc = KGlobal::dirs()->findDirs("appdata", "effects");
-
- // Iterate through effects directories to parse all XML files.
- for (more = direc.begin(); more != direc.end(); ++more) {
- QDir directory(*more);
- QStringList filter;
- filter << "*.xml";
- fileList = directory.entryList(filter, QDir::Files);
- for (it = fileList.begin(); it != fileList.end(); ++it) {
- itemName = KUrl(*more + *it).path();
- parseEffectFile(&MainWindow::customEffects,
- &MainWindow::audioEffects,
- &MainWindow::videoEffects,
- itemName, filtersList, producersList, repository);
- }
- }
-
// Remove blacklisted effects from the filters list.
+ QStringList mltFiltersList = filtersList;
QFile file2(KStandardDirs::locate("appdata", "blacklisted_effects.txt"));
if (file2.open(QIODevice::ReadOnly)) {
QTextStream in(&file2);
while (!in.atEnd()) {
QString black = in.readLine().simplified();
if (!black.isEmpty() && !black.startsWith('#') &&
- filtersList.contains(black))
- filtersList.removeAll(black);
+ mltFiltersList.contains(black))
+ mltFiltersList.removeAll(black);
}
file2.close();
}
*/
QDomElement effectInfo;
QMap<QString, QDomElement> effectsMap;
+ QMap<QString, QDomElement> videoEffectsMap;
+ QMap<QString, QDomElement> audioEffectsMap;
+
+ // Create transitions
for (int i = 0; i < MainWindow::transitions.count(); ++i) {
effectInfo = MainWindow::transitions.at(i);
effectsMap.insert(effectInfo.elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::transitions.clearList();
foreach(const QDomElement & effect, effectsMap)
- MainWindow::transitions.append(effect);
+ MainWindow::transitions.append(effect);
effectsMap.clear();
+
+ // Create effects from MLT
+ foreach(const QString & filtername, mltFiltersList) {
+ QDomDocument doc = createDescriptionFromMlt(repository, "filters", filtername);
+ //WARNING: TEMPORARY FIX for empty MLT effects descriptions - disable effects without parameters - jbm 09-06-2011
+ if (!doc.isNull() && doc.elementsByTagName("parameter").count() > 0) {
+ if (doc.documentElement().attribute("type") == "audio") {
+ if (doc.elementsByTagName("description").count() > 0) {
+ QString desc = doc.documentElement().elementsByTagName("description").item(0).toElement().text();
+ //WARNING: TEMPORARY FIX for unusable MLT SOX parameters description
+ if (desc.startsWith("Process audio using a SoX")) {
+ // Remove MLT's SOX generated effects since the parameters properties are unusable for us
+ }
+ else audioEffectsMap.insert(doc.documentElement().elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), doc.documentElement());
+ }
+ }
+ else
+ videoEffectsMap.insert(doc.documentElement().elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), doc.documentElement());
+ }
+ }
+
+ // Set the directories to look into for effects.
+ QStringList direc = KGlobal::dirs()->findDirs("appdata", "effects");
+ // Iterate through effects directories to parse all XML files.
+ for (more = direc.begin(); more != direc.end(); ++more) {
+ QDir directory(*more);
+ QStringList filter;
+ filter << "*.xml";
+ fileList = directory.entryList(filter, QDir::Files);
+ for (it = fileList.begin(); it != fileList.end(); ++it) {
+ itemName = KUrl(*more + *it).path();
+ parseEffectFile(&MainWindow::customEffects,
+ &MainWindow::audioEffects,
+ &MainWindow::videoEffects,
+ itemName, filtersList, producersList, repository);
+ }
+ }
+
+ // Create custom effects
for (int i = 0; i < MainWindow::customEffects.count(); ++i) {
effectInfo = MainWindow::customEffects.at(i);
effectsMap.insert(effectInfo.elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::customEffects.clearList();
foreach(const QDomElement & effect, effectsMap)
- MainWindow::customEffects.append(effect);
+ MainWindow::customEffects.append(effect);
effectsMap.clear();
+
+ // Create audio effects
for (int i = 0; i < MainWindow::audioEffects.count(); ++i) {
effectInfo = MainWindow::audioEffects.at(i);
- effectsMap.insert(effectInfo.elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), effectInfo);
+ audioEffectsMap.insert(effectInfo.elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::audioEffects.clearList();
- foreach(const QDomElement & effect, effectsMap)
- MainWindow::audioEffects.append(effect);
- effectsMap.clear();
+ foreach(const QDomElement & effect, audioEffectsMap)
+ MainWindow::audioEffects.append(effect);
+
+ // Create video effects
for (int i = 0; i < MainWindow::videoEffects.count(); ++i) {
effectInfo = MainWindow::videoEffects.at(i);
- effectsMap.insert(effectInfo.elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), effectInfo);
- }
- // Add remaining filters
- foreach(const QString & filtername, filtersList) {
- QDomDocument doc = createDescriptionFromMlt(repository, "filters", filtername);
- if (!doc.isNull())
- effectsMap.insert(doc.documentElement().elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), doc.documentElement());
+ videoEffectsMap.insert(effectInfo.elementsByTagName("name").item(0).toElement().text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::videoEffects.clearList();
- foreach(const QDomElement & effect, effectsMap) {
- if (effect.attribute("type") == "audio")
- MainWindow::audioEffects.append(effect);
- else
- MainWindow::videoEffects.append(effect);
- }
+ foreach(const QDomElement & effect, videoEffectsMap)
+ MainWindow::videoEffects.append(effect);
return repository;
}
delete metadata;
}
- bool ladspaOk = true;
- if (tag == "ladspa") {
- //WARNING: old LADSPA xml effects are deprecated, so hide them
- /*QString library = documentElement.attribute("library", QString());
- if (KStandardDirs::locate("ladspa_plugin", library).isEmpty()) ladspaOk = false;*/
- ladspaOk = false;
- }
-
// Parse effect information.
- if ((filtersList.contains(tag) || producersList.contains(tag)) && ladspaOk) {
+ if ((filtersList.contains(tag) || producersList.contains(tag))) {
QString type = documentElement.attribute("type", QString());
if (type == "audio")
audioEffectList->append(documentElement);
if (paramdesc.get("maximum")) params.setAttribute("max", paramdesc.get("maximum"));
if (paramdesc.get("minimum")) params.setAttribute("min", paramdesc.get("minimum"));
- if (QString(paramdesc.get("type")) == "integer")
+
+ QString paramType = paramdesc.get("type");
+
+ if (paramType == "integer")
params.setAttribute("type", "constant");
- if (QString(paramdesc.get("type")) == "float") {
+ else if (paramType == "float") {
params.setAttribute("type", "constant");
// param type is float, set default decimals to 3
params.setAttribute("decimals", "3");
}
- if (QString(paramdesc.get("type")) == "boolean")
+ else if (paramType == "boolean")
params.setAttribute("type", "bool");
- if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) != "geometry") {
+ else if (paramType == "geometry") {
params.setAttribute("type", "geometry");
- params.setAttribute("format", paramdesc.get("format"));
}
- if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) == "geometry") {
- params.setAttribute("type", "geometry");
- //params.setAttribute("format", paramdesc.get("format"));
+ else {
+ params.setAttribute("type", paramType);
+ if (!QString(paramdesc.get("format")).isEmpty()) params.setAttribute("format", paramdesc.get("format"));
}
if (paramdesc.get("default")) params.setAttribute("default", paramdesc.get("default"));
if (paramdesc.get("value")) {
params.setAttribute("value", paramdesc.get("default"));
}
-
QDomElement pname = ret.createElement("name");
pname.appendChild(ret.createTextNode(paramdesc.get("title")));
params.appendChild(pname);
}
delete metadata;
metadata = 0;
- /* QString outstr;
+ /*QString outstr;
QTextStream str(&outstr);
ret.save(str, 2);
kDebug() << outstr;*/
path.addPath(fname);
imagefiles.append(path.toLocalFile());
}
+
+ //WARNING: this is a hack to get around temporary invalid metadata in MLT, 2nd of june 2011 JBM
+ QStringList customTransitions;
+ customTransitions << "composite" << "luma" << "affine" << "mix" << "region";
foreach(const QString & name, names) {
QDomDocument ret;
ktrans.appendChild(tname);
ktrans.appendChild(desc);
Mlt::Properties *metadata = repository->metadata(transition_type, name.toUtf8().data());
- if (metadata && metadata->is_valid()) {
+ if (!customTransitions.contains(name) && metadata && metadata->is_valid()) {
// If possible, set name and description.
if (metadata->get("title") && metadata->get("identifier"))
tname.appendChild(ret.createTextNode(metadata->get("title")));