Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix proxy creation not restarting when changing a property while creating proxy

parent 5cd17e33
...@@ -2504,9 +2504,9 @@ void Bin::refreshClipMarkers(const QString &id) ...@@ -2504,9 +2504,9 @@ void Bin::refreshClipMarkers(const QString &id)
} }
} }
void Bin::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type) bool Bin::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type)
{ {
m_jobManager->discardJobs(id, type); return m_jobManager->discardJobs(id, type);
} }
void Bin::slotStartCutJob(const QString &id) void Bin::slotStartCutJob(const QString &id)
......
...@@ -214,8 +214,10 @@ public: ...@@ -214,8 +214,10 @@ public:
/** @brief Start a job of selected type for a clip */ /** @brief Start a job of selected type for a clip */
void startJob(const QString &id, AbstractClipJob::JOBTYPE type); void startJob(const QString &id, AbstractClipJob::JOBTYPE type);
/** @brief Discard jobs from a chosen type, use NOJOBTYPE to discard all jobs for this clip */ /** @brief Discard jobs from a chosen type, use NOJOBTYPE to discard all jobs for this clip
void discardJobs(const QString &id, AbstractClipJob::JOBTYPE type = AbstractClipJob::NOJOBTYPE); * @returns true if a job was found and discarded
*/
bool discardJobs(const QString &id, AbstractClipJob::JOBTYPE type = AbstractClipJob::NOJOBTYPE);
/** @brief Check if there is a job waiting / running for this clip */ /** @brief Check if there is a job waiting / running for this clip */
bool hasPendingJob(const QString &id, AbstractClipJob::JOBTYPE type); bool hasPendingJob(const QString &id, AbstractClipJob::JOBTYPE type);
......
...@@ -282,8 +282,17 @@ void ProjectClip::reloadProducer(bool refreshOnly) ...@@ -282,8 +282,17 @@ void ProjectClip::reloadProducer(bool refreshOnly)
// set a special flag to request thumbnail only // set a special flag to request thumbnail only
xml.setAttribute(QStringLiteral("refreshOnly"), QStringLiteral("1")); xml.setAttribute(QStringLiteral("refreshOnly"), QStringLiteral("1"));
} else { } else {
bin()->discardJobs(m_id, AbstractClipJob::PROXYJOB); if (bin()->discardJobs(m_id, AbstractClipJob::PROXYJOB)) {
if (hasProxy()) { // A proxy job was running, reset proxy property to trigger proxy creation
QString path = getProducerProperty(QStringLiteral("_proxy"));
if (!path.isEmpty()) {
EffectsList::setProperty(xml, QStringLiteral("kdenlive:proxy"), path.toUtf8().constData());
}
// If we have a proxy, delete it
xml.setAttribute(QStringLiteral("overwriteproxy"), QStringLiteral("1"));
setProducerProperty(QStringLiteral("_overwriteproxy"), QStringLiteral("1"));
}
else if (hasProxy()) {
// If we have a proxy, delete it // If we have a proxy, delete it
xml.setAttribute(QStringLiteral("overwriteproxy"), QStringLiteral("1")); xml.setAttribute(QStringLiteral("overwriteproxy"), QStringLiteral("1"));
setProducerProperty(QStringLiteral("_overwriteproxy"), QStringLiteral("1")); setProducerProperty(QStringLiteral("_overwriteproxy"), QStringLiteral("1"));
......
...@@ -194,6 +194,8 @@ void ProducerQueue::processFileProperties() ...@@ -194,6 +194,8 @@ void ProducerQueue::processFileProperties()
if (QFileInfo(path).size() <= 0 || info.xml.hasAttribute(QStringLiteral("overwriteproxy"))) { if (QFileInfo(path).size() <= 0 || info.xml.hasAttribute(QStringLiteral("overwriteproxy"))) {
// proxy is missing, re-create it // proxy is missing, re-create it
emit requestProxy(info.clipId); emit requestProxy(info.clipId);
m_processingClipId.removeAll(info.clipId);
continue;
proxyProducer = false; proxyProducer = false;
//path = info.xml.attribute("resource"); //path = info.xml.attribute("resource");
path = ProjectClip::getXmlProperty(info.xml, QStringLiteral("resource")); path = ProjectClip::getXmlProperty(info.xml, QStringLiteral("resource"));
......
...@@ -81,7 +81,7 @@ QStringList JobManager::getPendingJobs(const QString &id) ...@@ -81,7 +81,7 @@ QStringList JobManager::getPendingJobs(const QString &id)
return result; return result;
} }
void JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type) bool JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type)
{ {
QMutexLocker lock(&m_jobMutex); QMutexLocker lock(&m_jobMutex);
bool jobFound = false; bool jobFound = false;
...@@ -96,6 +96,7 @@ void JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type) ...@@ -96,6 +96,7 @@ void JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type)
emit updateJobStatus(id, type, JobAborted); emit updateJobStatus(id, type, JobAborted);
updateJobCount(); updateJobCount();
} }
return jobFound;
} }
bool JobManager::hasPendingJob(const QString &clipId, AbstractClipJob::JOBTYPE type) bool JobManager::hasPendingJob(const QString &clipId, AbstractClipJob::JOBTYPE type)
......
...@@ -50,8 +50,9 @@ public: ...@@ -50,8 +50,9 @@ public:
/** @brief Discard specific job type for a clip. /** @brief Discard specific job type for a clip.
* @param id the clip id * @param id the clip id
* @param type The type of job that you want to abort, leave to NOJOBTYPE to abort all jobs * @param type The type of job that you want to abort, leave to NOJOBTYPE to abort all jobs
* @returns true if a job was found and discarded
*/ */
void discardJobs(const QString &id, AbstractClipJob::JOBTYPE type = AbstractClipJob::NOJOBTYPE); bool discardJobs(const QString &id, AbstractClipJob::JOBTYPE type = AbstractClipJob::NOJOBTYPE);
/** @brief Check if there is a pending / running job a clip. /** @brief Check if there is a pending / running job a clip.
* @param id the clip id * @param id the clip id
......
...@@ -334,11 +334,13 @@ QHash<ProjectClip *, AbstractClipJob *> ProxyJob::prepareJob(Bin *bin, const QLi ...@@ -334,11 +334,13 @@ QHash<ProjectClip *, AbstractClipJob *> ProxyJob::prepareJob(Bin *bin, const QLi
local_params.append(QStringLiteral(" -noautorotate")); local_params.append(QStringLiteral(" -noautorotate"));
} }
QString path = item->getProducerProperty(QStringLiteral("kdenlive:proxy")); QString path = item->getProducerProperty(QStringLiteral("kdenlive:proxy"));
if (path.isEmpty()) { if (path.isEmpty() || path.length() < 3) path = item->getProducerProperty(QStringLiteral("_proxy"));
if (path.isEmpty() || path.length() < 3) {
item->setJobStatus(AbstractClipJob::PROXYJOB, JobCrashed, -1, i18n("Failed to create proxy, empty path.")); item->setJobStatus(AbstractClipJob::PROXYJOB, JobCrashed, -1, i18n("Failed to create proxy, empty path."));
continue; continue;
} }
// Reset proxy path until it is really created // Reset proxy path until it is really created
item->setProducerProperty(QStringLiteral("_proxy"), path.toUtf8().constData());
item->setProducerProperty(QStringLiteral("kdenlive:proxy"), QString()); item->setProducerProperty(QStringLiteral("kdenlive:proxy"), QString());
if (item->getProducerIntProperty(QStringLiteral("_overwriteproxy")) == 0 && QFileInfo(path).size() > 0) { if (item->getProducerIntProperty(QStringLiteral("_overwriteproxy")) == 0 && QFileInfo(path).size() > 0) {
// Proxy already created // Proxy already created
......
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