]> git.sesse.net Git - kdenlive/blobdiff - src/renderer.cpp
Fix timeline corruption when creating new project with fps != default fps
[kdenlive] / src / renderer.cpp
index c0a86da5a5b530d0446a62d1cace2c04ebfa3a62..7c110a10dabb64795540d861828b2a4d4486d3a3 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);
@@ -893,6 +902,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 +923,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 +963,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 +970,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);