summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-24 19:41:37 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-24 19:41:37 (GMT)
commitab3efa5d5c1e4c3f30940c1e9a220e9599b1c010 (patch)
treeadb3b437bb957db25febcfa30b7eadce66a6f16c
parent61fbf1293bed700b6149b02b7d828042a66411ab (diff)
Allow proxy clips for slideshows
BUG: 369243
-rw-r--r--src/doc/kdenlivedoc.cpp25
-rw-r--r--src/mltcontroller/producerqueue.cpp1
-rw-r--r--src/project/jobs/proxyclipjob.cpp27
-rw-r--r--src/project/jobs/proxyclipjob.h4
-rw-r--r--src/timeline/customruler.cpp2
5 files changed, 43 insertions, 16 deletions
diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp
index f2e08f2..f4cacc5 100644
--- a/src/doc/kdenlivedoc.cpp
+++ b/src/doc/kdenlivedoc.cpp
@@ -1297,7 +1297,7 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy, QList<ProjectClip *> clipLi
ProjectClip *item = clipList.at(i);
ClipType t = item->clipType();
// Only allow proxy on some clip types
- if ((t == Video || t == AV || t == Unknown || t == Image || t == Playlist) && item->isReady()) {
+ if ((t == Video || t == AV || t == Unknown || t == Image || t == Playlist || t == SlideShow) && item->isReady()) {
if ((doProxy && !force && item->hasProxy()) || (!doProxy && !item->hasProxy() && pCore->binController()->hasClip(item->clipId()))) continue;
if (pCore->producerQueue()->isProcessing(item->clipId())) {
continue;
@@ -1309,16 +1309,25 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy, QList<ProjectClip *> clipLi
// insert required duration for proxy
newProps.insert(QStringLiteral("proxy_out"), item->getProducerProperty(QStringLiteral("out")));
newProps.insert(QStringLiteral("kdenlive:proxy"), path);
+ // We need to insert empty proxy so that undo will work
+ //TODO: how to handle clip properties
+ //oldProps = clip->currentProperties(newProps);
+ oldProps.insert(QStringLiteral("kdenlive:proxy"), QStringLiteral("-"));
}
- else if (!pCore->binController()->hasClip(item->clipId())) {
- // Force clip reload
- newProps.insert(QStringLiteral("resource"), item->url().toLocalFile());
+ else {
+ if (t == SlideShow) {
+ // Revert to picture aspect ratio
+ newProps.insert(QStringLiteral("aspect_ratio"), QStringLiteral("1"));
+ }
+ if (!pCore->binController()->hasClip(item->clipId())) {
+ // Force clip reload
+ newProps.insert(QStringLiteral("resource"), item->url().toLocalFile());
+ }
}
- // We need to insert empty proxy so that undo will work
- //TODO: how to handle clip properties
- //oldProps = clip->currentProperties(newProps);
- if (doProxy) oldProps.insert(QStringLiteral("kdenlive:proxy"), QStringLiteral("-"));
new EditClipCommand(pCore->bin(), item->clipId(), oldProps, newProps, true, masterCommand);
+ } else {
+ // Cannot proxy this clip type
+ pCore->bin()->doDisplayMessage(i18n("Clip type does not support proxies"), KMessageWidget::Information);
}
}
if (!hasParent) {
diff --git a/src/mltcontroller/producerqueue.cpp b/src/mltcontroller/producerqueue.cpp
index 9ca511f..9e70330 100644
--- a/src/mltcontroller/producerqueue.cpp
+++ b/src/mltcontroller/producerqueue.cpp
@@ -432,7 +432,6 @@ void ProducerQueue::processFileProperties()
producer->set("length", length);
int kdenlive_duration = EffectsList::property(info.xml, QStringLiteral("kdenlive:duration")).toInt();
producer->set("kdenlive:duration", kdenlive_duration > 0 ? kdenlive_duration : length);
-
}
if (clipOut > 0) {
producer->set_in_and_out(info.xml.attribute(QStringLiteral("in")).toInt(), clipOut);
diff --git a/src/project/jobs/proxyclipjob.cpp b/src/project/jobs/proxyclipjob.cpp
index d702b25..9fc7f4e 100644
--- a/src/project/jobs/proxyclipjob.cpp
+++ b/src/project/jobs/proxyclipjob.cpp
@@ -24,12 +24,12 @@
#include "bin/projectclip.h"
#include "bin/bin.h"
#include <QProcess>
-
+#include <QTemporaryFile>
#include <QDebug>
#include <klocalizedstring.h>
-ProxyJob::ProxyJob(ClipType cType, const QString &id, const QStringList& parameters)
+ProxyJob::ProxyJob(ClipType cType, const QString &id, const QStringList& parameters, QTemporaryFile *playlist)
: AbstractClipJob(PROXYJOB, cType, id),
m_jobDuration(0),
m_isFfmpegJob(true)
@@ -42,6 +42,7 @@ ProxyJob::ProxyJob(ClipType cType, const QString &id, const QStringList& paramet
m_proxyParams = parameters.at(3);
m_renderWidth = parameters.at(4).toInt();
m_renderHeight = parameters.at(5).toInt();
+ m_playlist = playlist;
replaceClip = true;
}
@@ -49,7 +50,7 @@ void ProxyJob::startJob()
{
// Special case: playlist clips (.mlt or .kdenlive project files)
m_jobDuration = 0;
- if (clipType == Playlist) {
+ if (clipType == Playlist || clipType == SlideShow) {
// change FFmpeg params to MLT format
m_isFfmpegJob = false;
QStringList mltParameters;
@@ -167,6 +168,8 @@ void ProxyJob::startJob()
}
m_jobProcess->waitForFinished(400);
}
+ // remove temporary playlist if it exists
+ delete m_playlist;
if (m_jobStatus != JobAborted) {
int result = m_jobProcess->exitStatus();
if (result == QProcess::NormalExit) {
@@ -265,7 +268,7 @@ QList <ProjectClip *> ProxyJob::filterClips(QList <ProjectClip *>clips)
for (int i = 0; i < clips.count(); i++) {
ProjectClip *clip = clips.at(i);
ClipType type = clip->clipType();
- if (type != AV && type != Video && type != Playlist && type != Image) {
+ if (type != AV && type != Video && type != Playlist && type != Image && type != SlideShow) {
// Clip will not be processed by this job
continue;
}
@@ -302,8 +305,22 @@ QHash <ProjectClip *, AbstractClipJob *> ProxyJob::prepareJob(Bin *bin, QList <P
sourcePath.prepend("consumer:");
}
QStringList parameters;
+ QTemporaryFile *playlist = NULL;
+ if (item->clipType() == SlideShow) {
+ // we save a temporary .mlt clip for rendering
+ QDomDocument doc;
+ QDomElement xml = item->toXml(doc, false);
+ playlist = new QTemporaryFile();
+ playlist->setFileTemplate(playlist->fileTemplate() + QStringLiteral(".mlt"));
+ if (playlist->open()) {
+ sourcePath = playlist->fileName();
+ QTextStream out(playlist);
+ out << doc.toString();
+ playlist->close();
+ }
+ }
parameters << path << sourcePath << item->getProducerProperty(QStringLiteral("_exif_orientation")) << params << QString::number(renderSize.width()) << QString::number(renderSize.height());
- ProxyJob *job = new ProxyJob(item->clipType(), id, parameters);
+ ProxyJob *job = new ProxyJob(item->clipType(), id, parameters, playlist);
jobs.insert(item, job);
}
return jobs;
diff --git a/src/project/jobs/proxyclipjob.h b/src/project/jobs/proxyclipjob.h
index 5267b34..b0b520a 100644
--- a/src/project/jobs/proxyclipjob.h
+++ b/src/project/jobs/proxyclipjob.h
@@ -23,6 +23,7 @@
#include "abstractclipjob.h"
+class QTemporaryFile;
class Bin;
class ProjectClip;
@@ -31,7 +32,7 @@ class ProxyJob : public AbstractClipJob
Q_OBJECT
public:
- ProxyJob(ClipType cType, const QString &id, const QStringList& parameters);
+ ProxyJob(ClipType cType, const QString &id, const QStringList& parameters, QTemporaryFile *playlist);
virtual ~ ProxyJob();
const QString destination() const;
void startJob();
@@ -50,6 +51,7 @@ private:
int m_renderHeight;
int m_jobDuration;
bool m_isFfmpegJob;
+ QTemporaryFile *m_playlist;
};
#endif
diff --git a/src/timeline/customruler.cpp b/src/timeline/customruler.cpp
index 6c0bf5c..828abe1 100644
--- a/src/timeline/customruler.cpp
+++ b/src/timeline/customruler.cpp
@@ -498,7 +498,7 @@ void CustomRuler::paintEvent(QPaintEvent *e)
QRectF rec(xPos, MAX_HEIGHT + 1, chunkWidth, PREVIEW_SIZE - 1);
p.fillRect(rec, preview);
}
- preview = Qt::darkRed;
+ preview = QColor(200, 0, 0);
preview.setAlpha(120);
foreach(int frame, m_dirtyRenderingPreviews) {
double xPos = frame * m_factor - m_offset;