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

Various fixes for playlist proxy: fix possible crash on error, rendering...

Various fixes for playlist proxy: fix possible crash on error, rendering artifacts and incorrect length
parent a9147c78
Pipeline #248272 canceled with stage
in 3 minutes and 12 seconds
......@@ -3405,7 +3405,7 @@ void Bin::doDisplayMessage(const QString &text, KMessageWidget::MessageType type
m_infoMessage->animatedShow();
}
void Bin::doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QString &logInfo)
void Bin::doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QString logInfo)
{
// Remove existing actions if any
m_currentMessage = BinMessage::BinCategory::InformationMessage;
......@@ -4599,11 +4599,11 @@ void Bin::refreshProxySettings()
if (!m_doc->useProxy()) {
// Disable all proxies
m_doc->slotProxyCurrentItem(false, clipList, false, masterCommand);
} else {
} else if (m_doc->autoGenerateProxy(-1) || m_doc->autoGenerateImageProxy(-1)) {
QList<std::shared_ptr<ProjectClip>> toProxy;
for (const std::shared_ptr<ProjectClip> &clp : qAsConst(clipList)) {
ClipType::ProducerType t = clp->clipType();
if (t == ClipType::Playlist) {
if (t == ClipType::Playlist && m_doc->autoGenerateProxy(pCore->getCurrentFrameDisplaySize().width())) {
toProxy << clp;
continue;
} else if ((t == ClipType::AV || t == ClipType::Video) &&
......
......@@ -443,7 +443,7 @@ public slots:
/** @brief Abort all ongoing operations to prepare close. */
void abortOperations();
void doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QList<QAction *> &actions = QList<QAction *>(), bool showCloseButton = false, BinMessage::BinCategory messageCategory = BinMessage::BinCategory::NoMessage);
void doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QString &logInfo);
void doDisplayMessage(const QString &text, KMessageWidget::MessageType type, const QString logInfo);
/** @brief Reset all clip usage to 0 */
void resetUsageCount();
/** @brief Select a clip in the Bin from its id. */
......
......@@ -848,7 +848,7 @@ void Core::displayBinMessage(const QString &text, int type, const QList<QAction
m_mainWindow->getBin()->doDisplayMessage(text, KMessageWidget::MessageType(type), actions, showClose, messageCategory);
}
void Core::displayBinLogMessage(const QString &text, int type, const QString &logInfo)
void Core::displayBinLogMessage(const QString &text, int type, const QString logInfo)
{
m_mainWindow->getBin()->doDisplayMessage(text, KMessageWidget::MessageType(type), logInfo);
}
......
......@@ -331,7 +331,7 @@ public slots:
const QString actionText(const QString &name);
/** @brief display a user info/warning message in the project bin */
void displayBinMessage(const QString &text, int type, const QList<QAction *> &actions = QList<QAction *>(), bool showClose = false, BinMessage::BinCategory messageCategory = BinMessage::BinCategory::NoMessage);
void displayBinLogMessage(const QString &text, int type, const QString &logInfo);
void displayBinLogMessage(const QString &text, int type, const QString logInfo);
/** @brief Create small thumbnails for luma used in compositions */
void buildLumaThumbs(const QStringList &values);
/** @brief Try to find a display name for the given filename.
......
......@@ -485,13 +485,13 @@ bool KdenliveDoc::useExternalProxy() const
bool KdenliveDoc::autoGenerateProxy(int width) const
{
return (m_documentProperties.value(QStringLiteral("generateproxy")).toInt() != 0) &&
width > m_documentProperties.value(QStringLiteral("proxyminsize")).toInt();
(width < 0 || width > m_documentProperties.value(QStringLiteral("proxyminsize")).toInt());
}
bool KdenliveDoc::autoGenerateImageProxy(int width) const
{
return (m_documentProperties.value(QStringLiteral("generateimageproxy")).toInt() != 0) &&
width > m_documentProperties.value(QStringLiteral("proxyimageminsize")).toInt();
(width < 0 || width > m_documentProperties.value(QStringLiteral("proxyimageminsize")).toInt());
}
void KdenliveDoc::slotAutoSave(const QString &scene)
......
......@@ -162,7 +162,13 @@ public:
QMap<QString, QString> documentProperties();
bool useProxy() const;
bool useExternalProxy() const;
/** @brief Returns true if a proxy clip should be automatically generated for this width.
* if width < 0, returns true if the document's automatic proxy generation is enabled
*/
bool autoGenerateProxy(int width) const;
/** @brief Returns true if a proxy clip should be automatically generated for this width.
* if width < 0, returns true if the document's automatic proxy generation is enabled
*/
bool autoGenerateImageProxy(int width) const;
/** @brief Saves effects embedded in project file. */
void saveCustomEffects(const QDomNodeList &customeffects);
......
......@@ -96,7 +96,7 @@ void ProxyTask::run()
}
mltParameters << source;
// set destination
mltParameters << QStringLiteral("-consumer") << QStringLiteral("avformat:") + dest;
mltParameters << QStringLiteral("-consumer") << QStringLiteral("avformat:%1").arg(dest) << QStringLiteral("out=%1").arg(binClip->frameDuration());
QString parameter = pCore->currentDoc()->getDocumentProperty(QStringLiteral("proxyparams")).simplified();
if (parameter.isEmpty()) {
// Automatic setting, decide based on hw support
......@@ -162,7 +162,8 @@ void ProxyTask::run()
} else {
threadCount = 1;
}
mltParameters.append(QStringLiteral("real_time=-%1").arg(threadCount));
// real_time parameter seems to cause rendering artifacts with playlist clips
// mltParameters.append(QStringLiteral("real_time=-%1").arg(threadCount));
mltParameters.append(QStringLiteral("threads=%1").arg(threadCount));
mltParameters.append(QStringLiteral("terminate_on_pause=1"));
......@@ -347,8 +348,6 @@ void ProxyTask::run()
}
// remove temporary playlist if it exists
m_progress = 100;
pCore->taskManager.taskDone(m_owner.second, this);
QMetaObject::invokeMethod(m_object, "updateJobProgress");
if (result && !m_isCanceled) {
if (QFileInfo(dest).size() == 0) {
QFile::remove(dest);
......@@ -371,6 +370,8 @@ void ProxyTask::run()
Q_ARG(int, int(KMessageWidget::Warning)), Q_ARG(QString, m_logDetails));
}
}
pCore->taskManager.taskDone(m_owner.second, this);
QMetaObject::invokeMethod(m_object, "updateJobProgress");
return;
}
......
Supports Markdown
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