+ QString docRoot = m_doc->toXml().documentElement().attribute("root");
+ if (!docRoot.endsWith('/')) docRoot.append('/');
+ clip = getMissingProducer(idString);
+ if (clip) {
+ // We found the original producer in Kdenlive's producers
+ // Found correct producer
+ m_documentErrors.append(i18n("Replaced wrong clip producer %1 with %2", id, clip->getId()) + '\n');
+ QString prodId = clip->getId();
+ if (clip->clipType() == PLAYLIST || clip->clipType() == AV || clip->clipType() == AUDIO) {
+ // We need producer for the track
+ prodId.append("_" + QString::number(ix));
+ }
+ elem.setAttribute("producer", prodId);
+ producerReplacementIds.insert(idString, prodId);
+ // now adjust the mlt producer
+ bool found = false;
+ for (int i = 0; i < producers.count(); i++) {
+ QDomElement prod = producers.at(i).toElement();
+ if (prod.attribute("id") == prodId) {
+ // ok, producer already exists
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ for (int i = 0; i < producers.count(); i++) {
+ QDomElement prod = producers.at(i).toElement();
+ if (prod.attribute("id") == idString) {
+ prod.setAttribute("id", prodId);
+ m_replacementProducerIds.insert(idString, prodId);
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ // We didn't find the producer for this track, find producer for another track and duplicate
+ for (int i = 0; i < producers.count(); i++) {
+ QDomElement prod = producers.at(i).toElement();
+ QString mltProdId = prod.attribute("id");
+ if (mltProdId == prodId || mltProdId.startsWith(prodId + "_")) {
+ // Found parent producer, clone it
+ QDomElement clone = prod.cloneNode().toElement();
+ clone.setAttribute("id", prodId);
+ m_doc->toXml().documentElement().insertBefore(clone, xml);
+ break;
+ }
+ }
+ }
+ }
+ else {