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

Fix proxy rebuild on clip property change

parent 8bda4a1b
......@@ -299,7 +299,10 @@ void ProjectClip::reloadProducer(bool refreshOnly)
pCore->jobManager()->startJob<ThumbJob>({clipId()}, loadjobId, QString(), 150, -1, true, true);
} else {
// TODO: check if another load job is running?
// If another load job is running?
if (loadjobId > -1) {
pCore->jobManager()->discardJobs(clipId(), AbstractClipJob::LOADJOB);
}
QDomDocument doc;
QDomElement xml = toXml(doc);
if (!xml.isNull()) {
......@@ -816,7 +819,8 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
if (value.isEmpty() || value == QLatin1String("-")) {
// reset proxy
pCore->jobManager()->discardJobs(clipId(), AbstractClipJob::PROXYJOB);
reloadProducer();
reload = true;
refreshOnly = false;
} else {
// A proxy was requested, make sure to keep original url
setProducerProperty(QStringLiteral("kdenlive:originalurl"), url());
......@@ -826,7 +830,8 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
properties.contains(QStringLiteral("autorotate"))) {
// Clip resource changed, update thumbnail
if (m_clipType != ClipType::Color) {
reloadProducer();
reload = true;
refreshOnly = false;
} else {
reload = true;
updateRoles << TimelineModel::ResourceRole;
......@@ -863,9 +868,17 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
}
if (reload) {
// producer has changed, refresh monitor and thumbnail
reloadProducer(refreshOnly);
if (auto ptr = m_model.lock()) {
emit std::static_pointer_cast<ProjectItemModel>(ptr)->refreshClip(m_binId);
if (hasProxy()) {
pCore->jobManager()->discardJobs(clipId(), AbstractClipJob::PROXYJOB);
setProducerProperty(QStringLiteral("_overwriteproxy"), 1);
pCore->jobManager()->startJob<ProxyJob>({clipId()}, -1, QString());
} else {
reloadProducer(refreshOnly);
}
if (refreshOnly) {
if (auto ptr = m_model.lock()) {
emit std::static_pointer_cast<ProjectItemModel>(ptr)->refreshClip(m_binId);
}
}
if (!updateRoles.isEmpty()) {
updateTimelineClips(updateRoles);
......
......@@ -51,7 +51,7 @@ bool ProxyJob::startJob()
{
auto binClip = pCore->projectItemModel()->getClipByBinID(m_clipId);
const QString dest = binClip->getProducerProperty(QStringLiteral("kdenlive:proxy"));
if (QFile::exists(dest) && QFileInfo(dest).size() > 0) {
if (binClip->getProducerIntProperty(QStringLiteral("_overwriteproxy")) == 0 && QFile::exists(dest) && QFileInfo(dest).size() > 0) {
// Proxy clip already created
m_done = true;
return true;
......@@ -208,7 +208,8 @@ bool ProxyJob::startJob()
return false;
}
const QString proxyParams = pCore->currentDoc()->getDocumentProperty(QStringLiteral("proxyparams")).simplified();
if (proxyParams.contains(QStringLiteral("-noautorotate"))) {
bool disableAutorotate = binClip->getProducerProperty(QStringLiteral("autorotate")) == QLatin1String("0");
if (disableAutorotate || proxyParams.contains(QStringLiteral("-noautorotate"))) {
// The noautorotate flag must be passed before input source
parameters << QStringLiteral("-noautorotate");
}
......@@ -320,6 +321,7 @@ bool ProxyJob::commitResult(Fun &undo, Fun &redo, Updates &list)
auto operation = [clipId = m_clipId]()
{
auto binClip = pCore->projectItemModel()->getClipByBinID(clipId);
binClip->setProducerProperty(QStringLiteral("_overwriteproxy"), QString());
const QString dest = binClip->getProducerProperty(QStringLiteral("kdenlive:proxy"));
binClip->setProducerProperty(QStringLiteral("resource"), dest);
pCore->bin()->reloadClip(clipId);
......
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