8000 Fix proxy creation not restarting when changing a property while crea… · szczk/kdenlive@68556db · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
Fix proxy creation not restarting when changing a property while crea…
Browse files Browse the repository at this point in the history
…ting proxy
  • Loading branch information
j-b-m committed Sep 2, 2018
1 parent 5cd17e3 commit 68556db
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/bin/bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/bin/bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ class Bin : public QWidget
/** @brief Start a job of selected type for a clip */
void startJob(const QString &id, AbstractClipJob::JOBTYPE type);

/** @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);
/** @brief Discard jobs from a chosen type, use NOJOBTYPE to discard all jobs for this clip
* @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 */
bool hasPendingJob(const QString &id, AbstractClipJob::JOBTYPE type);
Expand Down
13 changes: 11 additions & 2 deletions src/bin/projectclip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,17 @@ void ProjectClip::reloadProducer(bool refreshOnly)
// set a special flag to request thumbnail only
xml.setAttribute(QStringLiteral("refreshOnly"), QStringLiteral("1"));
} else {
bin()->discardJobs(m_id, AbstractClipJob::PROXYJOB);
if (hasProxy()) {
if (bin()->discardJobs(m_id, AbstractClipJob::PROXYJOB)) {
// 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
xml.setAttribute(QStringLiteral("overwriteproxy"), QStringLiteral("1"));
setProducerProperty(QStringLiteral("_overwriteproxy"), QStringLiteral("1"));
Expand Down
2 changes: 2 additions & 0 deletions src/mltcontroller/producerqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ void ProducerQueue::processFileProperties()
if (QFileInfo(path).size() <= 0 || info.xml.hasAttribute(QStringLiteral("overwriteproxy"))) {
// proxy is missing, re-create it
emit requestProxy(info.clipId);
m_processingClipId.removeAll(info.clipId);
continue;
proxyProducer = false;
//path = info.xml.attribute("resource");
path = ProjectClip::getXmlProperty(info.xml, QStringLiteral("resource"));
Expand Down
3 changes: 2 additions & 1 deletion src/project/jobs/jobmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ QStringList JobManager::getPendingJobs(const QString &id)
return result;
}

void JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type)
bool JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type)
{
QMutexLocker lock(&m_jobMutex);
bool jobFound = false;
Expand All @@ -96,6 +96,7 @@ void JobManager::discardJobs(const QString &id, AbstractClipJob::JOBTYPE type)
emit updateJobStatus(id, type, JobAborted);
updateJobCount();
}
return jobFound;
}

bool JobManager::hasPendingJob(const QString &clipId, AbstractClipJob::JOBTYPE type)
Expand Down
3 changes: 2 additions & 1 deletion src/project/jobs/jobmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ class JobManager : public QObject
/** @brief Discard specific job type for a clip.
* @param id the clip id
* @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.
* @param id the clip id
Expand Down
4 changes: 3 additions & 1 deletion src/project/jobs/proxyclipjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,13 @@ QHash<ProjectClip *, AbstractClipJob *> ProxyJob::prepareJob(Bin *bin, const QLi
local_params.append(QStringLiteral(" -noautorotate"));
}
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, Jo 563A bCrashed, -1, i18n("Failed to create proxy, empty path."));
continue;
}
// Reset proxy path until it is really created
item->setProducerProperty(QStringLiteral("_proxy"), path.toUtf8().constData());
item->setProducerProperty(QStringLiteral("kdenlive:proxy"), QString());
if (item->getProducerIntProperty(QStringLiteral("_overwriteproxy")) == 0 && QFileInfo(path).size() > 0) {
// Proxy already created
Expand Down

0 comments on commit 68556db

Please sign in to comment.
0