]> git.sesse.net Git - kdenlive/commitdiff
Correctly replace a the producer when user does a "reload clip" action
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 14 Jun 2009 10:51:30 +0000 (10:51 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 14 Jun 2009 10:51:30 +0000 (10:51 +0000)
svn path=/trunk/kdenlive/; revision=3534

src/docclipbase.cpp
src/docclipbase.h
src/projectlist.cpp

index f0720bb3c8ec63040532e57c748f831691cb00b6..0df8adb20c70ae6b6f155d7352e94f9b062f9847 100644 (file)
@@ -416,9 +416,13 @@ void DocClipBase::deleteProducers()
     m_videoOnlyProducer = NULL;
 }
 
-void DocClipBase::setProducer(Mlt::Producer *producer)
+void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
 {
     if (producer == NULL) return;
+    if (reset) {
+        // Clear all previous producers
+        deleteProducers();
+    }
     QString id = producer->get("id");
     if (id.contains('_')) {
         // this is a subtrack producer, insert it at correct place
@@ -450,7 +454,7 @@ void DocClipBase::setProducer(Mlt::Producer *producer)
     }
     //m_clipProducer = producer;
     //m_clipProducer->set("transparency", m_properties.value("transparency").toInt());
-    if (m_thumbProd && !m_thumbProd->hasProducer()) m_thumbProd->setProducer(producer);
+    if (m_thumbProd && (reset || !m_thumbProd->hasProducer())) m_thumbProd->setProducer(producer);
 }
 
 Mlt::Producer *DocClipBase::audioProducer(int track)
index bae4e62326c2ba9a06ddaa0905cddcd1d0572c79..01af13b6cb06bc56dcea9133e2a5bf60faf352ac 100644 (file)
@@ -110,7 +110,7 @@ Q_OBJECT public:
     }
 
     /** Sets producers for the current clip (one for each track due to a limitation in MLT's track mixing */
-    void setProducer(Mlt::Producer *producer);
+    void setProducer(Mlt::Producer *producer, bool reset = false);
     /** Retrieve a producer for a track */
     Mlt::Producer *producer(int track = -1);
     /** Retrieve the producer that shows only video */
index 0536cbf3f81a1b8e45232cbe6725418b5dbabe17..ccb1599af834305bbda924710927bfd9d11d6d47 100644 (file)
@@ -210,7 +210,7 @@ void ProjectList::slotReloadClip()
         if (item->clipType() == IMAGE) {
             item->referencedClip()->producer()->set("force_reload", 1);
         }
-        emit getFileProperties(item->toXml(), item->clipId(), false);
+        emit getFileProperties(item->toXml(), item->clipId(), true);
     }
 }
 
@@ -520,7 +520,7 @@ void ProjectList::slotProcessNextClipInQueue()
         const QDomElement dom = i.value();
         const QString id = i.key();
         m_infoQueue.remove(i.key());
-        emit getFileProperties(dom, id, true);
+        emit getFileProperties(dom, id, false);
     }
     if (m_infoQueue.isEmpty()) m_listView->setEnabled(true);
 }
@@ -833,12 +833,18 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
         m_listView->blockSignals(true);
         item->setProperties(properties, metadata);
         Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1());
-        if (replace) item->referencedClip()->setProducer(producer);
-        else {
+        item->referencedClip()->setProducer(producer, replace);
+        emit receivedClipDuration(clipId);
+        if (replace) {
+            // update clip in clip monitor
+            emit clipSelected(NULL);
+            emit clipSelected(item->referencedClip());
+        }
+        /*else {
             // Check if duration changed.
             emit receivedClipDuration(clipId);
             delete producer;
-        }
+        }*/
         m_listView->blockSignals(false);
     } else kDebug() << "////////  COULD NOT FIND CLIP TO UPDATE PRPS...";
     if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));