void BinController::duplicateFilters(Mlt::Producer original, Mlt::Producer clone) { Mlt::Service clipService(original.get_service()); Mlt::Service dupService(clone.get_service()); //delete original; //delete clone; int ct = 0; Mlt::Filter *filter = clipService.filter(ct); while (filter) { // Only duplicate Kdenlive filters, and skip the fade in effects //fprintf(stderr, "CHKNG FILTER: %s\n", filter->get("kdenlive_id")); if (filter->is_valid()/* && strcmp(filter->get("kdenlive_id"), "") && strcmp(filter->get("kdenlive_id"), "fadein") && strcmp(filter->get("kdenlive_id"), "fade_from_black")*/) { // looks like there is no easy way to duplicate a filter, // so we will create a new one and duplicate its properties Mlt::Filter *dup = new Mlt::Filter(*original.profile(), filter->get("mlt_service")); if (dup && dup->is_valid()) { Mlt::Properties entries(filter->get_properties()); for (int i = 0; i < entries.count(); ++i) { dup->set(entries.get_name(i), entries.get(i)); } dupService.attach(*dup); } } ct++; filter = clipService.filter(ct); } }
QString BinController::getProducerXML(Mlt::Producer &producer) { QString filename = QStringLiteral("string"); Mlt::Consumer c(*producer.profile(), "xml", filename.toUtf8().constData()); Mlt::Service s(producer.get_service()); if (!s.is_valid()) return QLatin1String(""); int ignore = s.get_int("ignore_points"); if (ignore) s.set("ignore_points", 0); c.set("time_format", "frames"); c.set("no_meta", 1); c.set("store", "kdenlive"); if (filename != QLatin1String("string")) { c.set("no_root", 1); c.set("root", QFileInfo(filename).absolutePath().toUtf8().constData()); } c.connect(s); c.start(); if (ignore) s.set("ignore_points", ignore); return QString::fromUtf8(c.get(filename.toUtf8().constData())); }