]> git.sesse.net Git - kdenlive/blobdiff - src/renderer.cpp
Round corners in project tree thumbnails
[kdenlive] / src / renderer.cpp
index a51ef5d4b3c11252c63f2b1c61fcfb5ad3404f04..482384d8d3af9a5a6692a0468b014f0deaad3fe9 100644 (file)
@@ -128,7 +128,7 @@ Render::Render(Kdenlive::MONITORID rendererName, int winid, QString profile, QWi
     m_mltConsumer->connect(*m_mltProducer);
     m_mltProducer->set_speed(0.0);
     m_refreshTimer.setSingleShot(true);
-    m_refreshTimer.setInterval(70);
+    m_refreshTimer.setInterval(100);
     connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
     connect(this, SIGNAL(multiStreamFound(const QString &,QList<int>,QList<int>,stringMap)), this, SLOT(slotMultiStreamProducerFound(const QString &,QList<int>,QList<int>,stringMap)));
 }
@@ -538,7 +538,8 @@ void Render::slotSplitView(bool doit)
                 transition->set("mlt_service", "composite");
                 transition->set("a_track", 0);
                 transition->set("b_track", i);
-                transition->set("distort", 1);
+                transition->set("distort", 0);
+               transition->set("aligned", 0);
                 transition->set("internal_added", "200");
                 QString geometry;
                 switch (screen) {
@@ -885,6 +886,7 @@ void Render::processFileProperties()
            filePropertyMap["progressive"] = QString::number(original_profile->progressive());
            filePropertyMap["colorspace"] = QString::number(original_profile->colorspace());
            filePropertyMap["fps"] = QString::number(original_profile->fps());
+           filePropertyMap["aspect_ratio"] = QString::number(original_profile->sar());
            delete tmpProd;
            delete original_profile;
        }
@@ -931,10 +933,10 @@ void Render::processFileProperties()
             filePropertyMap["frame_size"] = QString::number(frame->get_int("width")) + 'x' + QString::number(frame->get_int("height"));
             filePropertyMap["frequency"] = QString::number(frame->get_int("frequency"));
             filePropertyMap["channels"] = QString::number(frame->get_int("channels"));
-            filePropertyMap["aspect_ratio"] = frame->get("aspect_ratio");
+            if (!filePropertyMap.contains("aspect_ratio")) filePropertyMap["aspect_ratio"] = frame->get("aspect_ratio");
 
             if (frame->get_int("test_image") == 0) {
-                if (url.path().endsWith(".mlt") || url.path().endsWith(".westley") || url.path().endsWith(".kdenlive")) {
+                if (mltService == "xml" || mltService == "consumer") {
                     filePropertyMap["type"] = "playlist";
                     metadataPropertyMap["comment"] = QString::fromUtf8(producer->get("title"));
                 } else if (frame->get_int("test_audio") == 0)
@@ -1116,9 +1118,38 @@ int Render::setProducer(Mlt::Producer *producer, int position)
     emit stopped();
     if (position == -1 && producer->get("id") == currentId) position = consumerPosition;
     if (position != -1) producer->seek(position);
+    m_fps = producer->get_fps();
     int volume = KdenliveSettings::volume();
+    if (producer->get_int("_audioclip") == 1) {
+       // This is an audio only clip, create fake multitrack to apply audiowave filter
+       Mlt::Tractor *tractor = new Mlt::Tractor();
+       Mlt::Producer *color= new Mlt::Producer(*m_mltProfile, "color:red");
+       color->set_in_and_out(0, producer->get_out());
+       tractor->set_track(*producer, 0);
+       tractor->set_track(*color, 1);
+
+       Mlt::Consumer xmlConsumer(*m_mltProfile, "xml:audio_hack");
+       if (!xmlConsumer.is_valid()) return -1;
+       xmlConsumer.set("terminate_on_pause", 1);
+       xmlConsumer.connect(tractor->parent());
+       xmlConsumer.run();
+       delete tractor;
+       delete color;
+       delete producer;
+       QString playlist = QString::fromUtf8(xmlConsumer.get("audio_hack"));
+       
+       Mlt::Producer *result = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
+       Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, "audiowave");
+       result->attach(*filter);
+       tractor = new Mlt::Tractor();
+       tractor->set_track(*result, 0);
+       delete result;
+       delete filter;
+       producer = &(tractor->parent());
+       m_mltConsumer->connect(*producer);
+    }
+    
     producer->set("meta.volume", (double)volume / 100);
-    m_fps = producer->get_fps();
     blockSignals(false);
     m_mltConsumer->connect(*producer);
 
@@ -1622,7 +1653,7 @@ void Render::refresh()
         return;
     if (m_mltConsumer) {
         if (m_mltConsumer->is_stopped()) m_mltConsumer->start();
-        m_mltConsumer->purge();
+        //m_mltConsumer->purge();
         m_mltConsumer->set("refresh", 1);
     }
 }
@@ -1674,13 +1705,6 @@ void Render::emitFrameUpdated(Mlt::Frame& frame)
     const uchar* image = frame.get_image(format, width, height);
     QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
     memcpy(qimage.scanLine(0), image, width * height * 4);
-
-    /*mlt_image_format format = mlt_image_rgb24;
-    int width = 0;
-    int height = 0;
-    const uchar* image = frame.get_image(format, width, height);
-    QImage qimage(width, height, QImage::Format_RGB888);
-    memcpy(qimage.bits(), image, width * height * 3);*/
     emit frameUpdated(qimage.rgbSwapped());
 }