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

Use compositing transition available on system, warn if none found

parent c6b9e487
......@@ -139,7 +139,7 @@ public:
void pushUndo(const Fun &undo, const Fun &redo, const QString &text);
void pushUndo(QUndoCommand *command);
/** @brief display a user info/warning message in statusbar */
void displayMessage(const QString &message, MessageType type, int timeout);
void displayMessage(const QString &message, MessageType type, int timeout = -1);
/** @brief Clear asset view if itemId is displayed. */
void clearAssetPanel(int itemId);
void adjustAssetRange(int itemId, int in, int out);
......
......@@ -29,6 +29,8 @@
#include "macros.hpp"
#include "trackmodel.hpp"
#include "transitions/transitionsrepository.hpp"
#include "kdenlivesettings.h"
#include "core.h"
#include <QDebug>
#include <QFileInfo>
#include <mlt++/MltProfile.h>
......@@ -352,11 +354,12 @@ void TimelineItemModel::buildTrackCompositing()
auto it = m_allTracks.cbegin();
QScopedPointer<Mlt::Field> field(m_tractor->field());
field->lock();
QString composite = getCompositingTransition();
while (it != m_allTracks.cend()) {
int trackId = getTrackMltIndex((*it)->getId());
if ((*it)->getProperty("kdenlive:audio_track").toInt() != 1) {
if (!composite.isEmpty() && (*it)->getProperty("kdenlive:audio_track").toInt() != 1) {
// video track, add composition
Mlt::Transition *transition = TransitionsRepository::get()->getTransition(QStringLiteral("qtblend"));
Mlt::Transition *transition = TransitionsRepository::get()->getTransition(composite);
transition->set("internal_added", 237);
transition->set("always_active", 1);
int ret = field->plant_transition(*transition, 0, trackId);
......@@ -372,6 +375,27 @@ void TimelineItemModel::buildTrackCompositing()
++it;
}
field->unlock();
if (composite.isEmpty()) {
pCore->displayMessage(i18n("Could not setup track compositing, check your install"), MessageType::ErrorMessage);
}
}
// static
const QString TimelineItemModel::getCompositingTransition()
{
if (KdenliveSettings::gpu_accel()) {
return QStringLiteral("movit.overlay");
}
if (TransitionsRepository::get()->exists(QStringLiteral("qtblend"))) {
return QStringLiteral("qtblend");
}
if (TransitionsRepository::get()->exists(QStringLiteral("frei0r.cairoblend"))) {
return QStringLiteral("frei0r.cairoblend");
}
if (TransitionsRepository::get()->exists(QStringLiteral("composite"))) {
return QStringLiteral("composite");
}
return QString();
}
void TimelineItemModel::notifyChange(const QModelIndex &topleft, const QModelIndex &bottomright, bool start, bool duration, bool updateThumb)
......
......@@ -84,6 +84,7 @@ public:
void notifyChange(const QModelIndex &topleft, const QModelIndex &bottomright, bool start, bool duration, bool updateThumb) override;
void notifyChange(const QModelIndex &topleft, const QModelIndex &bottomright, QVector<int> roles) override;
void buildTrackCompositing();
static const QString getCompositingTransition();
virtual void _beginRemoveRows(const QModelIndex &, int, int) override;
virtual void _beginInsertRows(const QModelIndex &, int, int) override;
......
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