...
 
Commits (6)
......@@ -6,7 +6,7 @@ project(Kdenlive)
# KDE Application Version, managed by release script
set (KDE_APPLICATIONS_VERSION_MAJOR "16")
set (KDE_APPLICATIONS_VERSION_MINOR "04")
set (KDE_APPLICATIONS_VERSION_MICRO "2")
set (KDE_APPLICATIONS_VERSION_MICRO "3")
set(KDENLIVE_VERSION ${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO})
cmake_minimum_required(VERSION 2.8.12)
......
......@@ -2862,9 +2862,13 @@ void Bin::showTitleWidget(ProjectClip *clip)
QString titlepath = m_doc->projectFolder().path() + QDir::separator() + "titles/";
TitleWidget dia_ui(QUrl(), m_doc->timecode(), titlepath, pCore->monitorManager()->projectMonitor()->render, pCore->window());
connect(&dia_ui, SIGNAL(requestBackgroundFrame()), pCore->monitorManager()->projectMonitor(), SLOT(slotGetCurrentImage()));
if (!path.isEmpty()) {
dia_ui.loadTitle(QUrl::fromLocalFile(path));
} else {
QDomDocument doc;
doc.setContent(clip->getProducerProperty(QStringLiteral("xmldata")));
dia_ui.setXml(doc);
}
if (dia_ui.exec() == QDialog::Accepted) {
QMap <QString, QString> newprops;
newprops.insert(QStringLiteral("xmldata"), dia_ui.xml().toString());
......
......@@ -356,6 +356,8 @@ QDomDocument KdenliveDoc::createEmptyDocument(const QList <TrackInfo> &tracks)
QDomElement blk = doc.createElement(QStringLiteral("producer"));
blk.setAttribute(QStringLiteral("in"), 0);
blk.setAttribute(QStringLiteral("out"), 500);
blk.setAttribute(QStringLiteral("aspect_ratio"), 1);
blk.setAttribute(QStringLiteral("set.test_audio"), 0);
blk.setAttribute(QStringLiteral("id"), QStringLiteral("black"));
QDomElement property = doc.createElement(QStringLiteral("property"));
......
......@@ -154,7 +154,7 @@ void MyTextItem::updateShadow()
}
QFontMetrics metrics(font());
//ADJUST TO CURRENT SETTING
int lineSpacing = data(TitleDocument::LineSpacing).toInt() + metrics.lineSpacing();
double lineSpacing = data(TitleDocument::LineSpacing).toInt() + metrics.lineSpacing();
QPainterPath path;
// Calculate line width
......@@ -176,9 +176,7 @@ void MyTextItem::updateShadow()
path.addPath(linePath);
}
// Calculate position of text in parent item
QRectF pathRect = QRectF(0, 0, bounding.width(), linePos - lineSpacing + metrics.descent() );
QPointF offset = bounding.center() - pathRect.center() + QPointF(2 * m_shadowBlur, 2 * m_shadowBlur);
path.translate(offset);
path.translate(QPointF(2 * m_shadowBlur, 2 * m_shadowBlur));
QRectF fullSize = bounding.united(path.boundingRect());
QImage shadow(fullSize.width() + qAbs(m_shadowOffset.x()) + 4 * m_shadowBlur, fullSize.height() + qAbs(m_shadowOffset.y()) + 4 * m_shadowBlur, QImage::Format_ARGB32_Premultiplied);
shadow.fill(Qt::transparent);
......
......@@ -144,11 +144,11 @@ void GLWidget::showEvent(QShowEvent * event)
void GLWidget::initializeGL()
{
//if (m_isInitialized || !isVisible() || !openglContext()) return;
if (m_isInitialized || !isVisible() || !openglContext()) return;
if (!m_offscreenSurface.isValid()) {
m_offscreenSurface.setFormat(openglContext()->format());
m_offscreenSurface.create();
//openglContext()->makeCurrent(this);
openglContext()->makeCurrent(this);
}
initializeOpenGLFunctions();
qDebug() << "OpenGL vendor: " << QString::fromUtf8((const char*) glGetString(GL_VENDOR));
......
......@@ -92,9 +92,8 @@ void MeltJob::startJob()
if (producerProfile) {
m_profile = new Mlt::Profile;
m_profile->set_explicit(false);
}
else {
m_profile = projectProfile;
} else {
m_profile = projectProfile;
}
if (m_extra.contains(QStringLiteral("resize_profile"))) {
m_profile->set_height(m_extra.value(QStringLiteral("resize_profile")).toInt());
......@@ -103,47 +102,28 @@ void MeltJob::startJob()
double fps = projectProfile->fps();
int fps_num = projectProfile->frame_rate_num();
int fps_den = projectProfile->frame_rate_den();
if (out == -1) {
m_producer = new Mlt::Producer(*m_profile, m_url.toUtf8().constData());
if (m_producer && producerProfile) {
m_profile->from_producer(*m_producer);
m_profile->set_explicit(true);
}
if (m_profile->fps() != fps || producerProfile) {
// Reload producer
delete m_producer;
// Force same fps as projec profile or the resulting .mlt will not load in our project
m_profile->set_frame_rate(fps_num, fps_den);
m_producer = new Mlt::Producer(*m_profile, m_url.toUtf8().constData());
}
Mlt::Producer *producer = new Mlt::Producer(*m_profile, m_url.toUtf8().constData());
if (producer && producerProfile) {
m_profile->from_producer(*producer);
m_profile->set_explicit(true);
}
else {
Mlt::Producer *tmp = new Mlt::Producer(*m_profile, m_url.toUtf8().constData());
if (tmp && producerProfile) {
m_profile->from_producer(*tmp);
m_profile->set_explicit(true);
}
if (m_profile->fps() != fps || producerProfile) {
// Reload producer
delete tmp;
// Force same fps as projec profile or the resulting .mlt will not load in our project
m_profile->set_frame_rate(fps_num, fps_den);
tmp = new Mlt::Producer(*m_profile, m_url.toUtf8().constData());
}
if (tmp) m_producer = tmp->cut(in, out);
delete tmp;
if (m_profile->fps() != fps || producerProfile) {
// Reload producer
delete producer;
// Force same fps as projec profile or the resulting .mlt will not load in our project
m_profile->set_frame_rate(fps_num, fps_den);
producer = new Mlt::Producer(*m_profile, m_url.toUtf8().constData());
}
if (!producerProfile) {
if (producerProfile) {
delete projectProfile;
}
if (!m_producer || !m_producer->is_valid()) {
if (!producer || !producer->is_valid()) {
// Clip was removed or something went wrong, Notify user?
//m_errorMessage.append(i18n("Invalid clip"));
setStatus(JobCrashed);
return;
}
m_length = m_producer->get_length();
// Process producer params
QMapIterator<QString, QString> i(m_producerParams);
......@@ -153,10 +133,17 @@ void MeltJob::startJob()
i.next();
QString key = i.key();
if (!ignoredProps.contains(key)) {
m_producer->set(i.key().toUtf8().constData(), i.value().toUtf8().constData());
producer->set(i.key().toUtf8().constData(), i.value().toUtf8().constData());
}
}
if (out == -1) {
m_producer = producer;
} else {
m_producer = producer->cut(in, out);
delete producer;
}
// Build consumer
if (consumerName.contains(QLatin1String(":"))) {
m_consumer = new Mlt::Consumer(*m_profile, consumerName.section(QLatin1Char(':'), 0, 0).toUtf8().constData(), m_dest.toUtf8().constData());
......@@ -206,14 +193,17 @@ void MeltJob::startJob()
}
}
Mlt::Tractor tractor(*m_profile);
Mlt::Playlist playlist(*m_profile);
Mlt::Playlist playlist;
playlist.append(*m_producer);
tractor.set_track(playlist, 0);
m_consumer->connect(tractor);
m_producer->set_speed(0);
m_producer->seek(0);
m_length = m_producer->get_playtime();
if (m_length == 0)
m_length = m_producer->get_length();
if (m_filter) m_producer->attach(*m_filter);
m_showFrameEvent = m_consumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_render);
m_showFrameEvent = m_consumer->listen("consumer-frame-render", this, (mlt_listener) consumer_frame_render);
m_producer->set_speed(1);
m_consumer->run();
......@@ -267,7 +257,7 @@ const QString MeltJob::statusMessage()
void MeltJob::emitFrameNumber(int pos)
{
if (m_length > 0 && m_jobStatus != JobAborted) {
if (m_length > 0 && m_jobStatus == JobWorking) {
emit jobProgress(m_clipId, (int) (100 * pos / m_length), jobType);
}
}
......
......@@ -81,6 +81,8 @@ Render::Render(Kdenlive::MonitorId rendererName, BinController *binController, G
m_blackClip = new Mlt::Producer(*m_qmlView->profile(), "colour:black");
m_blackClip->set("id", "black");
m_blackClip->set("mlt_type", "producer");
m_blackClip->set("aspect_ratio", 1);
m_blackClip->set("set.test_audio", 0);
m_mltProducer = m_blackClip->cut(0, 1);
m_qmlView->setProducer(m_mltProducer);
m_mltConsumer = qmlView->consumer();
......@@ -2106,8 +2108,21 @@ QList <TransitionInfo> Render::mltInsertTrack(int ix, const QString &name, bool
blockSignals(true);
service.lock();
Mlt::Tractor tractor(service);
// Find available track name
QStringList trackNames;
for (int i = 0; i < tractor.count(); i++) {
QScopedPointer<Mlt::Producer> track(tractor.track(i));
trackNames << track->get("id");
}
QString newName = QStringLiteral("playlist0");
int i = 1;
while (trackNames.contains(newName)) {
newName = QString("playlist%1").arg(i);
i++;
}
Mlt::Playlist playlist(*service.profile());
playlist.set("kdenlive:track_name", name.toUtf8().constData());
playlist.set("id", newName.toUtf8().constData());
int ct = tractor.count();
if (ix > ct) {
//qDebug() << "// ERROR, TRYING TO insert TRACK " << ix << ", max: " << ct;
......