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

Port proxy job to new job framework, make size of image proxy configurable

parent a6840e21
......@@ -1749,11 +1749,7 @@ void Bin::reloadClip(const QString &id)
if (!clip) {
return;
}
QDomDocument doc;
QDomElement xml = clip->toXml(doc);
if (!xml.isNull()) {
pCore->jobManager()->startJob<LoadJob>({id}, {}, QString(), xml);
}
clip->reloadProducer();
}
......
......@@ -29,6 +29,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "effects/effectstack/model/effectstackmodel.hpp"
#include "jobs/jobmanager.h"
#include "jobs/thumbjob.hpp"
#include "jobs/loadjob.hpp"
#include <jobs/proxyclipjob.h>
#include "kdenlivesettings.h"
#include "lib/audio/audioStreamInfo.h"
#include "mltcontroller/clip.h"
......@@ -292,8 +294,12 @@ void ProjectClip::reloadProducer(bool refreshOnly)
pCore->jobManager()->startJob<ThumbJob>({clipId()}, parentJobs, QString(), 150, -1, true);
} else {
// TODO refac: launch load job
// if (auto ptr = m_model.lock()) emit std::static_pointer_cast<ProjectItemModel>(ptr)->reloadProducer(m_binId, xml);
//TODO: check if another load job is running?
QDomDocument doc;
QDomElement xml = toXml(doc);
if (!xml.isNull()) {
pCore->jobManager()->startJob<LoadJob>({clipId()}, {}, QString(), xml);
}
}
}
......@@ -585,18 +591,12 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
// If value is "-", that means user manually disabled proxy on this clip
if (value.isEmpty() || value == QLatin1String("-")) {
// reset proxy
if (auto ptr = m_model.lock()) {
// TODO refac
// emit std::static_pointer_cast<ProjectItemModel>(ptr)->discardJobs(m_binId, AbstractClipJob::PROXYJOB);
reloadProducer();
}
pCore->jobManager()->discardJobs(clipId(), AbstractClipJob::PROXYJOB);
reloadProducer();
} else {
// A proxy was requested, make sure to keep original url
setProducerProperty(QStringLiteral("kdenlive:originalurl"), url());
if (auto ptr = m_model.lock()) {
// TODO refac
// emit std::static_pointer_cast<ProjectItemModel>(ptr)->startJob(m_binId, AbstractClipJob::PROXYJOB);
}
pCore->jobManager()->startJob<ProxyJob>({clipId()}, {}, QString());
}
} else if (properties.contains(QStringLiteral("resource")) || properties.contains(QStringLiteral("templatetext")) ||
properties.contains(QStringLiteral("autorotate"))) {
......
......@@ -109,6 +109,7 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QString &projectFolder, QUndoGro
m_documentProperties[QStringLiteral("proxyminsize")] = QString::number(KdenliveSettings::proxyminsize());
m_documentProperties[QStringLiteral("generateimageproxy")] = QString::number((int)KdenliveSettings::generateimageproxy());
m_documentProperties[QStringLiteral("proxyimageminsize")] = QString::number(KdenliveSettings::proxyimageminsize());
m_documentProperties[QStringLiteral("proxyimagesize")] = QString::number(KdenliveSettings::proxyimagesize());
// Load properties
QMapIterator<QString, QString> i(properties);
......
......@@ -10,5 +10,5 @@ set(kdenlive_SRCS
jobs/thumbjob.cpp
# jobs/cutclipjob.cpp
# jobs/filterjob.cpp
# jobs/proxyclipjob.cpp
jobs/proxyclipjob.cpp
PARENT_SCOPE)
......@@ -272,9 +272,10 @@ bool LoadJob::startJob()
}
processProducerProperties(m_producer, m_xml);
QString clipName = Xml::getXmlProperty(m_xml, QStringLiteral("kdenlive:clipname"));
if (!clipName.isEmpty()) {
m_producer->set("kdenlive:clipname", clipName.toUtf8().constData());
if (clipName.isEmpty()) {
clipName = QFileInfo(Xml::getXmlProperty(m_xml, QStringLiteral("kdenlive:originalurl"))).fileName();
}
m_producer->set("kdenlive:clipname", clipName.toUtf8().constData());
QString groupId = Xml::getXmlProperty(m_xml, QStringLiteral("kdenlive:folderid"));
if (!groupId.isEmpty()) {
m_producer->set("kdenlive:folderid", groupId.toUtf8().constData());
......
This diff is collapsed.
......@@ -26,32 +26,28 @@
class QTemporaryFile;
class Bin;
class ProjectClip;
class QProcess;
class ProxyJob : public AbstractClipJob
{
Q_OBJECT
public:
ProxyJob(ClipType cType, const QString &id, const QStringList &parameters, QTemporaryFile *playlist);
virtual ~ProxyJob();
const QString destination() const override;
void startJob() override;
stringMap cancelProperties() override;
const QString statusMessage() override;
void processLogInfo() override;
static QList<ProjectClip *> filterClips(const QList<ProjectClip *> &clips);
static QHash<ProjectClip *, AbstractClipJob *> prepareJob(Bin *bin, const QList<ProjectClip *> &clips);
ProxyJob(const QString &binId);
const QString getDescription() const override;
bool startJob() override;
/** @brief This is to be called after the job finished.
By design, the job should store the result of the computation but not share it with the rest of the code. This happens when we call commitResult */
bool commitResult(Fun &undo, Fun &redo) override;
private slots:
void processLogInfo();
private:
QString m_dest;
QString m_src;
int m_exif;
QString m_proxyParams;
int m_renderWidth;
int m_renderHeight;
int m_jobDuration;
bool m_isFfmpegJob;
QTemporaryFile *m_playlist;
QProcess *m_jobProcess;
bool m_done;
};
#endif
......@@ -150,7 +150,10 @@
<label>Minimum source size for proxy creation.</label>
<default>2000</default>
</entry>
<entry name="proxyimagesize" type="Int">
<label>Rescale size for image proxy creation.</label>
<default>800</default>
</entry>
<entry name="proxyextension" type="String">
<label>File extension for proxy clips.</label>
<default></default>
......
......@@ -1752,6 +1752,10 @@ void MainWindow::slotEditProjectSettings()
modified = true;
project->setDocumentProperty(QStringLiteral("proxyimageminsize"), QString::number(w->proxyImageMinSize()));
}
if (project->getDocumentProperty(QStringLiteral("proxyimagesize")) != QString::number(w->proxyImageSize())) {
modified = true;
project->setDocumentProperty(QStringLiteral("proxyimagesize"), QString::number(w->proxyImageSize()));
}
if (QString::number((int)w->useProxy()) != project->getDocumentProperty(QStringLiteral("enableproxy"))) {
project->setDocumentProperty(QStringLiteral("enableproxy"), QString::number((int)w->useProxy()));
modified = true;
......
......@@ -97,6 +97,7 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap<QString, QString> metada
m_proxyparameters = doc->getDocumentProperty(QStringLiteral("proxyparams"));
generate_imageproxy->setChecked(doc->getDocumentProperty(QStringLiteral("generateimageproxy")).toInt() != 0);
proxy_imageminsize->setValue(doc->getDocumentProperty(QStringLiteral("proxyimageminsize")).toInt());
proxy_imagesize->setValue(doc->getDocumentProperty(QStringLiteral("proxyimagesize")).toInt());
m_proxyextension = doc->getDocumentProperty(QStringLiteral("proxyextension"));
m_previewparams = doc->getDocumentProperty(QStringLiteral("previewparameters"));
m_previewextension = doc->getDocumentProperty(QStringLiteral("previewextension"));
......@@ -499,6 +500,11 @@ int ProjectSettings::proxyImageMinSize() const
return proxy_imageminsize->value();
}
int ProjectSettings::proxyImageSize() const
{
return proxy_imagesize->value();
}
QString ProjectSettings::proxyParams() const
{
QString params = proxy_profile->itemData(proxy_profile->currentIndex()).toString();
......
......@@ -45,6 +45,7 @@ public:
int proxyMinSize() const;
bool generateImageProxy() const;
int proxyImageMinSize() const;
int proxyImageSize() const;
QString proxyParams() const;
QString proxyExtension() const;
const QMap<QString, QString> metadata() const;
......
......@@ -6,11 +6,25 @@
<rect>
<x>0</x>
<y>0</y>
<width>809</width>
<height>818</height>
<width>467</width>
<height>578</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_disable_effect_parameters">
<property name="text">
<string>Disable parameters when the effect is disabled</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_exiftool">
<property name="text">
<string>Get clip metadata with exiftool</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
......@@ -70,21 +84,28 @@
</layout>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_exiftool">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_projectloading_avformatnovalidate">
<property name="text">
<string>Get clip metadata with exiftool</string>
<string>Do not validate the video files when loading a project (faster)</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_disable_effect_parameters">
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_crashrecovery">
<property name="text">
<string>Disable parameters when the effect is disabled</string>
<string>Activate crash recovery (auto save)</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagesequence">
<property name="text">
<string>Automatically import image sequences</string>
</property>
</widget>
</item>
<item row="13" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -97,62 +118,6 @@
</property>
</spacer>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tab position</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_openlastproject">
<property name="text">
<string>Open last project on startup</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_automultistreams">
<property name="text">
<string>Automatically import all streams in multi stream clips</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_magicLantern">
<property name="text">
<string>Get clip metadata created by Magic Lantern</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagesequence">
<property name="text">
<string>Automatically import image sequences</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_bypasscodeccheck">
<property name="text">
<string>Bypass codec verification</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_checkfirstprojectclip">
<property name="text">
<string>Check if first added clip matches project profile</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_usekuiserver">
<property name="text">
<string>Use KDE job tracking for render jobs</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="kcfg_tabposition">
<item>
......@@ -177,13 +142,6 @@
</item>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_projectloading_avformatnovalidate">
<property name="text">
<string>Do not validate the video files when loading a project (faster)</string>
</property>
</widget>
</item>
<item row="10" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
......@@ -197,17 +155,52 @@
</property>
</spacer>
</item>
<item row="13" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagetransparency">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_checkfirstprojectclip">
<property name="text">
<string>Transparent background for imported images</string>
<string>Check if first added clip matches project profile</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_crashrecovery">
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_openlastproject">
<property name="text">
<string>Activate crash recovery (auto save)</string>
<string>Open last project on startup</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_usekuiserver">
<property name="text">
<string>Use KDE job tracking for render jobs</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_bypasscodeccheck">
<property name="text">
<string>Bypass codec verification</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tab position</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_automultistreams">
<property name="text">
<string>Automatically import all streams in multi stream clips</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_magicLantern">
<property name="text">
<string>Get clip metadata created by Magic Lantern</string>
</property>
</widget>
</item>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>521</width>
<height>560</height>
<width>451</width>
<height>546</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
......@@ -112,6 +112,9 @@
</item>
<item row="3" column="0" colspan="5">
<widget class="QGroupBox" name="kcfg_enableproxy">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Pro&amp;xy clips</string>
</property>
......@@ -129,43 +132,7 @@
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<widget class="QSpinBox" name="kcfg_proxyminsize">
<property name="suffix">
<string>pixels</string>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_generateimageproxy">
<property name="text">
<string>Generate for images larger than</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3">
<widget class="QSpinBox" name="kcfg_proxyimageminsize">
<property name="suffix">
<string>pixels</string>
</property>
<property name="minimum">
<number>500</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>2000</number>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_24">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
......@@ -178,7 +145,7 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="1" column="1" colspan="2">
<widget class="KComboBox" name="kcfg_proxy_profile">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
......@@ -188,7 +155,7 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="1" column="3">
<widget class="QToolButton" name="proxy_showprofileinfo">
<property name="text">
<string>...</string>
......@@ -198,14 +165,14 @@
</property>
</widget>
</item>
<item row="2" column="4">
<item row="1" column="4">
<widget class="QToolButton" name="proxy_manageprofile">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="5">
<item row="2" column="0" colspan="5">
<widget class="QPlainTextEdit" name="proxyparams">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
......@@ -218,6 +185,71 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_generateimageproxy">
<property name="text">
<string>Generate for images larger than</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="image_label">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Proxy image size</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QSpinBox" name="kcfg_proxyimageminsize">
<property name="suffix">
<string>pixels</string>
</property>
<property name="minimum">
<number>500</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>2000</number>
</property>
</widget>
</item>
<item row="4" column="2" colspan="3">
<widget class="QSpinBox" name="kcfg_proxyimagesize">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string>pixels</string>
</property>
<property name="minimum">
<number>200</number>
</property>
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<widget class="QSpinBox" name="kcfg_proxyminsize">
<property name="suffix">
<string>pixels</string>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -231,7 +263,7 @@
</widget>
</item>
<item>
<widget class="KUrlRequester" name="projecturl">
<widget class="KUrlRequester" name="projecturl" native="true">
<property name="enabled">
<bool>false</bool>
</property>
......@@ -272,5 +304,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>kcfg_generateimageproxy</sender>
<signal>toggled(bool)</signal>
<receiver>image_label</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>137</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>69</x>
<y>321</y>
</hint>
</hints>
</connection>
<connection>
<sender>kcfg_generateimageproxy</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_proxyimagesize</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>137</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>328</y>
</hint>
</hints>
</connection>
</connections>
</ui>
This diff is collapsed.
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