When opening a project file with missing proxy and clip, don't remove clips from timeline

Don't store url twice in proxies
parent 0998213e
Pipeline #5067 passed with stage
in 18 minutes and 13 seconds
......@@ -253,7 +253,7 @@ bool DocumentChecker::hasErrorInClips()
if (!QFile::exists(original)) {
// clip has proxy but original clip is missing
missingSources.append(e);
missingPaths.append(resource);
missingPaths.append(original);
}
verifiedPaths.append(resource);
continue;
......@@ -564,7 +564,7 @@ bool DocumentChecker::hasErrorInClips()
for (int i = 0; i < max; ++i) {
QDomElement e = missingProxies.at(i).toElement();
QString realPath = Xml::getXmlProperty(e, QStringLiteral("kdenlive:originalurl"));
QString id = e.attribute(QStringLiteral("id"));
QString id = Xml::getXmlProperty(e, QStringLiteral("kdenlive:id"));
m_missingProxyIds << id;
// Tell Kdenlive to recreate proxy
e.setAttribute(QStringLiteral("_replaceproxy"), QStringLiteral("1"));
......@@ -574,7 +574,7 @@ bool DocumentChecker::hasErrorInClips()
for (int j = 0; j < prodsCount; ++j) {
mltProd = documentProducers.at(j).toElement();
QString prodId = mltProd.attribute(QStringLiteral("id"));
QString parentId = prodId;
QString parentId = Xml::getXmlProperty(mltProd, QStringLiteral("kdenlive:id"));
bool slowmotion = false;
if (parentId.startsWith(QLatin1String("slowmotion"))) {
slowmotion = true;
......@@ -586,14 +586,15 @@ bool DocumentChecker::hasErrorInClips()
if (parentId == id) {
// Hit, we must replace url
QString suffix;
QString resource = Xml::getXmlProperty(mltProd, QStringLiteral("resource"));
if (slowmotion) {
QString resource = Xml::getXmlProperty(mltProd, QStringLiteral("resource"));
suffix = QLatin1Char('?') + resource.section(QLatin1Char('?'), -1);
}
Xml::setXmlProperty(mltProd, QStringLiteral("resource"), realPath + suffix);
if (prodId == id) {
// Only set proxy property on master producer
Xml::setXmlProperty(mltProd, QStringLiteral("kdenlive:proxy"), QStringLiteral("-"));
Xml::setXmlProperty(mltProd, QStringLiteral("kdenlive:proxy"), QStringLiteral("-"));
if (missingPaths.contains(realPath)) {
// Proxy AND source missing
setProperty(mltProd, QStringLiteral("_placeholder"), QStringLiteral("1"));
}
}
}
......
......@@ -700,8 +700,12 @@ void ClipController::backupOriginalProperties()
}
int propsCount = m_properties->count();
// store original props
QStringList doNotPass {QStringLiteral("kdenlive:proxy"),QStringLiteral("kdenlive:originalurl"),QStringLiteral("kdenlive:clipname")};
for (int j = 0; j < propsCount; j++) {
QString propName = m_properties->get_name(j);
if (doNotPass.contains(propName)) {
continue;
}
if (!propName.startsWith(QLatin1Char('_'))) {
propName.prepend(QStringLiteral("kdenlive:original."));
m_properties->set(propName.toUtf8().constData(), m_properties->get(j));
......@@ -750,8 +754,12 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props)
props.inherit(sourceProps);
int propsCount = sourceProps.count();
// store original props
QStringList doNotPass {QStringLiteral("kdenlive:proxy"),QStringLiteral("kdenlive:originalurl"),QStringLiteral("kdenlive:clipname")};
for (int i = 0; i < propsCount; i++) {
QString propName = sourceProps.get_name(i);
if (doNotPass.contains(propName)) {
continue;
}
if (!propName.startsWith(QLatin1Char('_'))) {
propName.prepend(QStringLiteral("kdenlive:original."));
m_properties->set(propName.toUtf8().constData(), sourceProps.get(i));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment