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

Fix deletion of source clip when using new speed clip job, add safeguard

BUG: 368836
parent a0d1e3d5
......@@ -90,7 +90,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
producerParams.insert(QStringLiteral("producer"), prodstring);
QString destination;
if (multipleSelection) {
destination = destFolder.absoluteFilePath(QUrl::fromLocalFile(sources.at(i)).fileName());
destination = destFolder.absoluteFilePath(QUrl::fromLocalFile(sources.at(i)).fileName() + QStringLiteral(".mlt"));
} else {
destination = d->selectedUrl().path();
}
......@@ -126,7 +126,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
QMap <QString, QString> producerParams = QMap <QString, QString> ();
QMap <QString, QString> filterParams = QMap <QString, QString> ();
QMap <QString, QString> consumerParams = QMap <QString, QString> ();
// Producer params
// None
......@@ -135,7 +135,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
filterParams.insert(QStringLiteral("filter"), filterName);
filterParams.insert(QStringLiteral("shot_change_list"), QStringLiteral("0"));
filterParams.insert(QStringLiteral("denoise"), QStringLiteral("0"));
// Consumer
consumerParams.insert(QStringLiteral("consumer"), QStringLiteral("null"));
consumerParams.insert(QStringLiteral("all"), QStringLiteral("1"));
......@@ -188,7 +188,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
producerParams.insert(QStringLiteral("in"), QString::number(in));
producerParams.insert(QStringLiteral("out"), QString::number(out));
producerParams.insert(QStringLiteral("producer"), sources.at(i));
// Destination
// Since this job is only doing analysis, we have a null consumer and no destination
MeltJob *job = new MeltJob(clip->clipType(), clip->clipId(), producerParams, filterParams, consumerParams, extraParams);
......@@ -250,9 +250,3 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
}
return jobs;
}
......@@ -52,8 +52,9 @@ MeltJob::MeltJob(ClipType cType, const QString id, const QMap <QString, QString>
m_jobStatus = JobWaiting;
description = i18n("Processing clip");
QString consum = m_consumerParams.value(QStringLiteral("consumer"));
if (consum.contains(QLatin1Char(':')))
if (consum.contains(QLatin1Char(':'))) {
m_dest = consum.section(QLatin1Char(':'), 1);
}
m_url = producerParams.value(QStringLiteral("producer"));
}
......@@ -64,12 +65,17 @@ void MeltJob::startJob()
setStatus(JobCrashed);
return;
}
QString consumerName = m_consumerParams.value(QStringLiteral("consumer"));
// safety check, make sure we don't overwrite a source clip
if (!m_dest.isEmpty() && !m_dest.endsWith(QStringLiteral(".mlt"))) {
m_errorMessage.append(i18n("Invalid destination: %1.", consumerName));
setStatus(JobCrashed);
return;
}
int in = m_producerParams.value(QStringLiteral("in")).toInt();
if (in > 0 && !m_extra.contains(QStringLiteral("offset"))) m_extra.insert(QStringLiteral("offset"), QString::number(in));
int out = m_producerParams.value(QStringLiteral("out")).toInt();
QString filterName = m_filterParams.value(QStringLiteral("filter"));
QString consumerName = m_consumerParams.value(QStringLiteral("consumer"));
if (consumerName.contains(QLatin1Char(':'))) m_dest = consumerName.section(QLatin1Char(':'), 1);
// optional params
int startPos = -1;
......
Supports Markdown
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