Commit ad990b83 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

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() ...@@ -253,7 +253,7 @@ bool DocumentChecker::hasErrorInClips()
if (!QFile::exists(original)) { if (!QFile::exists(original)) {
// clip has proxy but original clip is missing // clip has proxy but original clip is missing
missingSources.append(e); missingSources.append(e);
missingPaths.append(resource); missingPaths.append(original);
} }
verifiedPaths.append(resource); verifiedPaths.append(resource);
continue; continue;
...@@ -564,7 +564,7 @@ bool DocumentChecker::hasErrorInClips() ...@@ -564,7 +564,7 @@ bool DocumentChecker::hasErrorInClips()
for (int i = 0; i < max; ++i) { for (int i = 0; i < max; ++i) {
QDomElement e = missingProxies.at(i).toElement(); QDomElement e = missingProxies.at(i).toElement();
QString realPath = Xml::getXmlProperty(e, QStringLiteral("kdenlive:originalurl")); 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; m_missingProxyIds << id;
// Tell Kdenlive to recreate proxy // Tell Kdenlive to recreate proxy
e.setAttribute(QStringLiteral("_replaceproxy"), QStringLiteral("1")); e.setAttribute(QStringLiteral("_replaceproxy"), QStringLiteral("1"));
...@@ -574,7 +574,7 @@ bool DocumentChecker::hasErrorInClips() ...@@ -574,7 +574,7 @@ bool DocumentChecker::hasErrorInClips()
for (int j = 0; j < prodsCount; ++j) { for (int j = 0; j < prodsCount; ++j) {
mltProd = documentProducers.at(j).toElement(); mltProd = documentProducers.at(j).toElement();
QString prodId = mltProd.attribute(QStringLiteral("id")); QString prodId = mltProd.attribute(QStringLiteral("id"));
QString parentId = prodId; QString parentId = Xml::getXmlProperty(mltProd, QStringLiteral("kdenlive:id"));
bool slowmotion = false; bool slowmotion = false;
if (parentId.startsWith(QLatin1String("slowmotion"))) { if (parentId.startsWith(QLatin1String("slowmotion"))) {
slowmotion = true; slowmotion = true;
...@@ -586,14 +586,15 @@ bool DocumentChecker::hasErrorInClips() ...@@ -586,14 +586,15 @@ bool DocumentChecker::hasErrorInClips()
if (parentId == id) { if (parentId == id) {
// Hit, we must replace url // Hit, we must replace url
QString suffix; QString suffix;
QString resource = Xml::getXmlProperty(mltProd, QStringLiteral("resource"));
if (slowmotion) { if (slowmotion) {
QString resource = Xml::getXmlProperty(mltProd, QStringLiteral("resource"));
suffix = QLatin1Char('?') + resource.section(QLatin1Char('?'), -1); suffix = QLatin1Char('?') + resource.section(QLatin1Char('?'), -1);
} }
Xml::setXmlProperty(mltProd, QStringLiteral("resource"), realPath + suffix); Xml::setXmlProperty(mltProd, QStringLiteral("resource"), realPath + suffix);
if (prodId == id) { Xml::setXmlProperty(mltProd, QStringLiteral("kdenlive:proxy"), QStringLiteral("-"));
// Only set proxy property on master producer if (missingPaths.contains(realPath)) {
Xml::setXmlProperty(mltProd, QStringLiteral("kdenlive:proxy"), QStringLiteral("-")); // Proxy AND source missing
setProperty(mltProd, QStringLiteral("_placeholder"), QStringLiteral("1"));
} }
} }
} }
......
...@@ -700,8 +700,12 @@ void ClipController::backupOriginalProperties() ...@@ -700,8 +700,12 @@ void ClipController::backupOriginalProperties()
} }
int propsCount = m_properties->count(); int propsCount = m_properties->count();
// store original props // store original props
QStringList doNotPass {QStringLiteral("kdenlive:proxy"),QStringLiteral("kdenlive:originalurl"),QStringLiteral("kdenlive:clipname")};
for (int j = 0; j < propsCount; j++) { for (int j = 0; j < propsCount; j++) {
QString propName = m_properties->get_name(j); QString propName = m_properties->get_name(j);
if (doNotPass.contains(propName)) {
continue;
}
if (!propName.startsWith(QLatin1Char('_'))) { if (!propName.startsWith(QLatin1Char('_'))) {
propName.prepend(QStringLiteral("kdenlive:original.")); propName.prepend(QStringLiteral("kdenlive:original."));
m_properties->set(propName.toUtf8().constData(), m_properties->get(j)); m_properties->set(propName.toUtf8().constData(), m_properties->get(j));
...@@ -750,8 +754,12 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props) ...@@ -750,8 +754,12 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props)
props.inherit(sourceProps); props.inherit(sourceProps);
int propsCount = sourceProps.count(); int propsCount = sourceProps.count();
// store original props // store original props
QStringList doNotPass {QStringLiteral("kdenlive:proxy"),QStringLiteral("kdenlive:originalurl"),QStringLiteral("kdenlive:clipname")};
for (int i = 0; i < propsCount; i++) { for (int i = 0; i < propsCount; i++) {
QString propName = sourceProps.get_name(i); QString propName = sourceProps.get_name(i);
if (doNotPass.contains(propName)) {
continue;
}
if (!propName.startsWith(QLatin1Char('_'))) { if (!propName.startsWith(QLatin1Char('_'))) {
propName.prepend(QStringLiteral("kdenlive:original.")); propName.prepend(QStringLiteral("kdenlive:original."));
m_properties->set(propName.toUtf8().constData(), sourceProps.get(i)); 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