]> git.sesse.net Git - kdenlive/blobdiff - src/renderer.cpp
Add mlt and encoder threads to render dialog.
[kdenlive] / src / renderer.cpp
index 90f733b9ebfe8008a3187a8dc351cde4295ad589..55ad1a0f57524ac109e15f45ecd5c44463568bc1 100644 (file)
@@ -205,6 +205,7 @@ void Render::buildConsumer(const QString profileName)
                 m_mltConsumer->set("terminate_on_pause", 0);
                 m_mltConsumer->set("buffer", 12);
                 m_mltConsumer->set("deinterlace_method", "onefield");
+                m_mltConsumer->set("real_time", KdenliveSettings::mltthreads());
                 mlt_log_set_callback(kdenlive_callback);
             }
             if (m_mltConsumer && m_mltConsumer->is_valid()) return;
@@ -262,6 +263,7 @@ void Render::buildConsumer(const QString profileName)
     m_mltConsumer->set("progressive", 1);
     m_mltConsumer->set("audio_buffer", 1024);
     m_mltConsumer->set("frequency", 48000);
+    m_mltConsumer->set("real_time", KdenliveSettings::mltthreads());
 }
 
 Mlt::Producer *Render::invalidProducer(const QString &id)
@@ -536,7 +538,7 @@ void Render::slotSplitView(bool doit)
 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");
+    if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") path = xml.attribute("proxy");
     else path = xml.attribute("resource");
     KUrl url = KUrl(path);
     Mlt::Producer *producer = NULL;
@@ -567,7 +569,11 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
 
     if (producer == NULL || producer->is_blank() || !producer->is_valid()) {
         kDebug() << " / / / / / / / / ERROR / / / / // CANNOT LOAD PRODUCER: ";
-        emit removeInvalidClip(clipId, replaceProducer);
+        if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") {
+            // Proxy file is corrupted
+            emit removeInvalidProxy(clipId);
+        }
+        else emit removeInvalidClip(clipId, replaceProducer);
         delete producer;
         return;
     }
@@ -623,8 +629,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());
@@ -1372,8 +1382,8 @@ void Render::refresh()
 void Render::setDropFrames(bool show)
 {
     if (m_mltConsumer) {
-        int dropFrames = 1;
-        if (show == false) dropFrames = 0;
+        int dropFrames = KdenliveSettings::mltthreads();
+        if (show == false) dropFrames = -dropFrames;
         m_mltConsumer->stop();
         if (m_winid == 0)
             m_mltConsumer->set("real_time", dropFrames);