Fix crashes when using MLT 6.2.0

BUG: 366107
Bug: 365955
parent 6e10c6c9
......@@ -387,10 +387,12 @@ Mlt::Producer *ProjectClip::thumbProducer()
if (m_thumbsProducer) {
return m_thumbsProducer;
}
if (!m_controller) {
if (!m_controller || m_controller->clipType() == Unknown) {
return NULL;
}
Mlt::Producer prod = m_controller->originalProducer();
if (!prod.is_valid())
return NULL;
Clip clip(prod);
if (KdenliveSettings::gpu_accel()) {
m_thumbsProducer = clip.softClone(ClipController::getPassPropertiesList());
......
......@@ -1694,3 +1694,19 @@ QStringList KdenliveDoc::getProxyHashList()
{
return pCore->bin()->getProxyHashList();
}
//static
int KdenliveDoc::compositingMode()
{
QString composite = TransitionHandler::compositeTransition();
if (composite == QLatin1String("composite")) {
// only simple preview compositing enabled
return 0;
}
if (composite == QLatin1String("movit.overlay")) {
// Movit compositing enabled
return 2;
}
// Cairoblend or qtblend available
return 1;
}
......@@ -171,6 +171,8 @@ public:
void initCacheDirs();
/** @brief Get a list of all proxy hash used in this project */
QStringList getProxyHashList();
/** @brief Returns true if advanced compositing is available */
static int compositingMode();
private:
QUrl m_url;
......
......@@ -229,7 +229,7 @@ bool initEffects::parseEffectFiles(Mlt::Repository* repository, const QString &l
fileList = directory.entryList(filter, QDir::Files);
for (it = fileList.begin(); it != fileList.end(); ++it) {
itemName = directory.absoluteFilePath(*it);
parseTransitionFile(&MainWindow::transitions, itemName, repository, transDescriptions);
parseTransitionFile(&MainWindow::transitions, itemName, repository, transitionsItemList, transDescriptions);
}
}
......@@ -855,7 +855,7 @@ QDomElement initEffects::quickParameterFill(QDomDocument & doc, const QString &n
}
// static
void initEffects::parseTransitionFile(EffectsList *transitionList, const QString &name, Mlt::Repository *repository, QMap <QString, QString> effectDescriptions)
void initEffects::parseTransitionFile(EffectsList *transitionList, const QString &name, Mlt::Repository *repository, QStringList installedTransitions, QMap <QString, QString> effectDescriptions)
{
QDomDocument doc;
QFile file(name);
......@@ -884,6 +884,11 @@ void initEffects::parseTransitionFile(EffectsList *transitionList, const QString
QDomNode n = effects.item(i);
if (n.isNull()) continue;
documentElement = n.toElement();
QString tag = documentElement.attribute(QStringLiteral("tag"));
if (!installedTransitions.contains(tag)) {
// This transition is not available
return;
}
QString id = documentElement.attribute(QStringLiteral("id"));
if (addedTags.contains(id)) {
// We already processed a version of that filter
......
......@@ -89,7 +89,7 @@ public:
const QString &name, QStringList filtersList,
QStringList producersList,
Mlt::Repository *repository, QMap <QString, QString> effectDescriptions);
static void parseTransitionFile(EffectsList *transitionList, const QString &name, Mlt::Repository *repository, QMap <QString, QString> effectDescriptions);
static void parseTransitionFile(EffectsList *transitionList, const QString &name, Mlt::Repository *repository, QStringList installedTransitions, QMap <QString, QString> effectDescriptions);
/** @brief Reloads information about custom effects. */
static void parseCustomEffectsFile();
......
......@@ -957,12 +957,35 @@ void MainWindow::setupActions()
m_compositeAction = new KSelectAction(KoIconUtils::themedIcon("composite-track-off"), i18n("Track compositing"), this);
m_compositeAction->setToolTip(i18n("Track compositing"));
m_compositeAction->addAction(KoIconUtils::themedIcon("composite-track-off"), i18n("None"));
m_compositeAction->addAction(KoIconUtils::themedIcon("composite-track-preview"), i18n("Preview"));
m_compositeAction->addAction(KoIconUtils::themedIcon("composite-track-on"), i18n("High Quality"));
//New projects created with Hq by default
m_compositeAction->setCurrentItem(2);
connect(m_compositeAction, SIGNAL(triggered(int)), this, SLOT(slotUpdateCompositing(int)));
QAction *noComposite = new QAction(KoIconUtils::themedIcon("composite-track-off"),
i18n("None"));
noComposite->setCheckable(true);
noComposite->setData(0);
m_compositeAction->addAction(noComposite);
int compose = KdenliveDoc::compositingMode();
if (compose == 2) {
// Movit, do not show "preview" option since movit is faster
QAction *hqComposite = new QAction(KoIconUtils::themedIcon("composite-track-on"), i18n("High Quality"));
hqComposite->setCheckable(true);
hqComposite->setData(2);
m_compositeAction->addAction(hqComposite);
m_compositeAction->setCurrentAction(hqComposite);
} else {
QAction *previewComposite = new QAction(KoIconUtils::themedIcon("composite-track-preview"), i18n("Preview"));
previewComposite->setCheckable(true);
previewComposite->setData(1);
m_compositeAction->addAction(previewComposite);
if (compose == 1) {
QAction *hqComposite = new QAction(KoIconUtils::themedIcon("composite-track-on"), i18n("High Quality"));
hqComposite->setData(2);
hqComposite->setCheckable(true);
m_compositeAction->addAction(hqComposite);
m_compositeAction->setCurrentAction(hqComposite);
} else {
m_compositeAction->setCurrentAction(previewComposite);
}
}
connect(m_compositeAction, SIGNAL(triggered(QAction*)), this, SLOT(slotUpdateCompositing(QAction*)));
addAction(QStringLiteral("timeline_compositing"), m_compositeAction);
m_timeFormatButton = new KSelectAction(QStringLiteral("00:00:00:00 / 00:00:00:00"), this);
......@@ -1388,7 +1411,7 @@ void MainWindow::setupActions()
pCore->library()->setupActions(QList <QAction *>() << sentToLibrary);
KStandardAction::showMenubar(this, SLOT(showMenuBar(bool)), actionCollection());
QAction *a = KStandardAction::quit(this, SLOT(close()), actionCollection());
a->setIcon(KoIconUtils::themedIcon(QStringLiteral("application-exit")));
// TODO: make the following connection to slotEditKeys work
......@@ -1673,7 +1696,7 @@ void MainWindow::slotRenderProject()
m_renderWidget->setDocumentPath(project->projectFolder().path() + QDir::separator());
m_renderWidget->setRenderProfile(project->getRenderProperties());
}
m_renderWidget->errorMessage(m_compositeAction->currentItem() == 1 ? i18n("Rendering using low quality track compositing") : QString());
m_renderWidget->errorMessage(m_compositeAction->currentAction()->data().toInt() == 1 ? i18n("Rendering using low quality track compositing") : QString());
}
slotCheckRenderStatus();
m_renderWidget->show();
......@@ -3685,9 +3708,10 @@ void MainWindow::slotManageCache()
d.exec();
}
void MainWindow::slotUpdateCompositing(int mode)
void MainWindow::slotUpdateCompositing(QAction *compose)
{
if (pCore->projectManager()->currentTimeline()) {
int mode = compose->data().toInt();
pCore->projectManager()->currentTimeline()->switchComposite(mode);
if (m_renderWidget)
m_renderWidget->errorMessage(mode == 1 ? i18n("Rendering using low quality track compositing") : QString());
......
......@@ -458,7 +458,7 @@ private slots:
/** @brief Change forced icon theme setting (asks for app restart). */
void forceIconSet(bool force);
/** @brief Toggle current project's compositing mode. */
void slotUpdateCompositing(int mode);
void slotUpdateCompositing(QAction *compose);
/** @brief Update compositing action to display current project setting. */
void slotUpdateCompositeAction(int mode);
......
......@@ -396,7 +396,6 @@ void Timeline::getTransitions() {
service = mlt_service_producer(service);
continue;
}
int a_track = prop.get_int("a_track");
int b_track = prop.get_int("b_track");
......
......@@ -563,7 +563,10 @@ const QString TransitionHandler::compositeTransition()
if (MainWindow::transitions.hasTransition(QStringLiteral("qtblend"))) {
return QStringLiteral("qtblend");
}
return QStringLiteral("frei0r.cairoblend");
if (MainWindow::transitions.hasTransition(QStringLiteral("frei0r.cairoblend"))) {
return QStringLiteral("frei0r.cairoblend");
}
return QStringLiteral("composite");
}
void TransitionHandler::rebuildTransitions(int mode, QList <int> videoTracks, int maxTrack)
......
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