]> git.sesse.net Git - kdenlive/blobdiff - src/renderer.cpp
* Allow to edit transparent background for images in group properties
[kdenlive] / src / renderer.cpp
index b5b4c9a3e2c5da15fae1b93748137baa1392bfc7..9ddfd753a69540cc9545ca7c18f83bb52ef1bc37 100644 (file)
@@ -96,8 +96,8 @@ static void consumer_gl_frame_show(mlt_consumer, Render * self, mlt_frame frame_
 Render::Render(const QString & rendererName, int winid, QString profile, QWidget *parent) :
     QObject(parent),
     m_isBlocked(0),
-    sendFrameForAnalysis(false),
     analyseAudio(KdenliveSettings::monitor_audio()),
+    sendFrameForAnalysis(false),
     m_name(rendererName),
     m_mltConsumer(NULL),
     m_mltProducer(NULL),
@@ -355,6 +355,15 @@ void Render::seek(GenTime time)
     refresh();
 }
 
+void Render::seek(int time)
+{
+    if (!m_mltProducer)
+        return;
+    m_isBlocked = false;
+    m_mltProducer->seek(time);
+    refresh();
+}
+
 //static
 /*QPixmap Render::frameThumbnail(Mlt::Frame *frame, int width, int height, bool border) {
     QPixmap pix(width, height);
@@ -454,6 +463,10 @@ double Render::dar() const
     return m_mltProfile->dar();
 }
 
+double Render::sar() const
+{
+    return m_mltProfile->sar();
+}
 
 void Render::slotSplitView(bool doit)
 {
@@ -520,7 +533,7 @@ void Render::slotSplitView(bool doit)
     }
 }
 
-void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer)
+void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer, bool selectClip)
 {
     QString path;
     if (xml.hasAttribute("proxy")) path = xml.attribute("proxy");
@@ -610,8 +623,12 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
     }
 
     // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
-    if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW)
-        producer->set("length", xml.attribute("out").toInt() - xml.attribute("in").toInt() + 1);
+    if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) {
+        int length;
+        if (xml.hasAttribute("length")) length = xml.attribute("length").toInt();
+        else length = xml.attribute("out").toInt() - xml.attribute("in").toInt();
+        producer->set("length", length);
+    }
 
     if (xml.hasAttribute("out"))
         producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt());
@@ -621,9 +638,9 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
     if (xml.hasAttribute("templatetext"))
         producer->set("templatetext", xml.attribute("templatetext").toUtf8().constData());
 
-    if (!replaceProducer && xml.hasAttribute("file_hash")) {
+    if ((!replaceProducer && xml.hasAttribute("file_hash")) || xml.hasAttribute("proxy")) {
         // Clip  already has all properties
-        emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer);
+        emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer, selectClip);
         return;
     }
 
@@ -799,7 +816,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
             metadataPropertyMap[ name.section('.', 0, -2)] = value;
     }
     producer->seek(0);
-    emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
+    emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer, selectClip);
     // FIXME: should delete this to avoid a leak...
     //delete producer;
 }
@@ -893,6 +910,13 @@ int Render::setSceneList(QString playlist, int position)
 
     //kDebug() << "//////  RENDER, SET SCENE LIST: " << playlist;
 
+    // Remove previous profile info
+    QDomDocument doc;
+    doc.setContent(playlist);
+    QDomElement profile = doc.documentElement().firstChildElement("profile");
+    doc.documentElement().removeChild(profile);
+    playlist = doc.toString();
+
     if (m_mltConsumer) {
         if (!m_mltConsumer->is_stopped()) {
             m_mltConsumer->stop();
@@ -907,7 +931,6 @@ int Render::setSceneList(QString playlist, int position)
         m_mltProducer->set_speed(0);
         //if (KdenliveSettings::osdtimecode() && m_osdInfo) m_mltProducer->detach(*m_osdInfo);
 
-
         Mlt::Service service(m_mltProducer->parent().get_service());
         mlt_service_lock(service.get_service());
 
@@ -948,7 +971,6 @@ int Render::setSceneList(QString playlist, int position)
     }
 
     blockSignals(true);
-
     // TODO: Better way to do this
     if (KdenliveSettings::projectloading_avformatnovalidate())
         playlist.replace(">avformat</property>", ">avformat-novalidate</property>");
@@ -956,7 +978,6 @@ int Render::setSceneList(QString playlist, int position)
         playlist.replace(">avformat-novalidate</property>", ">avformat</property>");
 
     m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
-
     if (!m_mltProducer || !m_mltProducer->is_valid()) {
         kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << playlist.toUtf8().constData();
         m_mltProducer = m_blackClip->cut(0, 50);