- producerXml.setAttribute("colour", "0xff0000ff");
- producerXml.setAttribute("mlt_service", "colour");
- producerXml.setAttribute("length", "15000");
- producerXml.setAttribute("name", "INVALID");
- producerXml.setAttribute("type", COLOR);
- producerXml.setAttribute("id", id);
- clip = new DocClipBase(m_doc->clipManager(), doc.documentElement(), id);
- xml.insertBefore(producerXml, QDomNode());
- m_doc->clipManager()->addClip(clip);
-
- m_documentErrors.append(i18n("Broken clip producer %1", id) + '\n');
- } else {
- // Found correct producer
- m_documentErrors.append(i18n("Replaced wrong clip producer %1 with %2", id, clip->getId()) + '\n');
- elem.setAttribute("producer", clip->getId());
+ bool foundMltProd = false;
+ for (int i = 0; i < producers.count(); ++i) {
+ QDomElement prod = producers.at(i).toElement();
+ if (prod.attribute("id") == id) {
+ QString service = EffectsList::property(prod, "mlt_service");
+ QString type = EffectsList::property(prod, "mlt_type");
+ QString resource = EffectsList::property(prod, "resource");
+ if (!resource.startsWith('/') && service != "colour") {
+ resource.prepend(docRoot);
+ kDebug()<<"******************\nADJUSTED 1\n*************************";
+ }
+ QString length = EffectsList::property(prod, "length");
+ producerXml.setAttribute("mlt_service", service);
+ producerXml.setAttribute("mlt_type", type);
+ producerXml.setAttribute("resource", resource);
+ producerXml.setAttribute("duration", length);
+ if (service == "colour") producerXml.setAttribute("type", Color);
+ else if (service == "qimage" || service == "pixbuf") producerXml.setAttribute("type", Image);
+ else if (service == "kdenlivetitle") producerXml.setAttribute("type", Text);
+ else producerXml.setAttribute("type", AV);
+ clip = new DocClipBase(m_doc->clipManager(), doc.documentElement(), id);
+ m_doc->clipManager()->addClip(clip);
+ m_documentErrors.append(i18n("Broken clip producer %1, recreated base clip: %2", id, resource) + '\n');
+ foundMltProd = true;
+ break;
+ }
+ }
+ if (!foundMltProd) {
+ // Cannot recover, replace with blank
+ int duration = elem.attribute("out").toInt() - elem.attribute("in").toInt();
+ elem.setAttribute("length", duration);
+ elem.setTagName("blank");
+ m_documentErrors.append(i18n("Broken clip producer %1, removed from project", id) + '\n');
+ }