]> git.sesse.net Git - kdenlive/commitdiff
Improve proxy handling, fix project tree staying disabled after loading project
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 9 Nov 2011 02:02:32 +0000 (03:02 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 9 Nov 2011 02:02:32 +0000 (03:02 +0100)
src/projectlist.cpp
src/renderer.cpp
src/renderer.h

index 6923f3896fec6c87ffa342eeabab1959a6c58144..a8ae3af195ac6b75eb3085b93a17b72c9ed3c978 100644 (file)
@@ -1125,7 +1125,7 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
 
 void ProjectList::slotGotProxy(const QString &proxyPath)
 {
-    if (proxyPath.isEmpty() || !m_refreshed || m_abortAllProxies) return;
+    if (proxyPath.isEmpty() || m_abortAllProxies) return;
     QTreeWidgetItemIterator it(m_listView);
     ProjectItem *item;
 
@@ -1281,7 +1281,7 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged)
                     if (replace) resetThumbsProducer(clip);
                     m_render->getFileProperties(xml, clip->getId(), m_listView->iconSize().height(), replace);
                 }
-                else {
+                else if (clip->isPlaceHolder()) {
                     item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
                     if (item->data(0, Qt::DecorationRole).isNull()) {
                         item->setData(0, Qt::DecorationRole, missingPixmap);
@@ -1829,7 +1829,7 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
             if (item->parent()) {
                 if (item->parent()->type() == PROJECTFOLDERTYPE)
                     static_cast <FolderProjectItem *>(item->parent())->switchIcon();
-            } else if (KdenliveSettings::checkfirstprojectclip() &&  m_listView->topLevelItemCount() == 1) {
+            } else if (KdenliveSettings::checkfirstprojectclip() &&  m_listView->topLevelItemCount() == 1 && m_refreshed && m_allClipsProcessed) {
                 // this is the first clip loaded in project, check if we want to adjust project settings to the clip
                 updatedProfile = adjustProjectProfileToItem(item);
             }
index 4be4ae91f32e8301fbeb7df070dc40edff69f59c..ea95bf535a42872f5748cb9c9f92997a1a4e78b1 100644 (file)
@@ -605,10 +605,15 @@ void Render::forceProcessing(const QString &id)
     m_infoMutex.unlock();
 }
 
-int Render::processingItems() const
+int Render::processingItems()
 {
+    m_infoMutex.lock();
     int count = m_requestList.count();
-    if (m_infoThread.isRunning()) count++;
+    if (!m_processingClipId.isEmpty()) {
+        // one clip is currently processed
+        count++;
+    }
+    m_infoMutex.unlock();
     return count;
 }
 
@@ -670,13 +675,13 @@ void Render::processFileProperties()
 
         if (producer == NULL || producer->is_blank() || !producer->is_valid()) {
             kDebug() << " / / / / / / / / ERROR / / / / // CANNOT LOAD PRODUCER: "<<path;
+            m_processingClipId.clear();
             if (proxyProducer) {
                 // Proxy file is corrupted
                 emit removeInvalidProxy(info.clipId, false);
             }
             else emit removeInvalidClip(info.clipId, info.replaceProducer);
             delete producer;
-            m_processingClipId.clear();
             continue;
         }
 
@@ -685,9 +690,9 @@ void Render::processFileProperties()
             producer->set("out", info.xml.attribute("proxy_out").toInt());
             if (producer->get_out() != info.xml.attribute("proxy_out").toInt()) {
                 // Proxy file length is different than original clip length, this will corrupt project so disable this proxy clip
+                m_processingClipId.clear();
                 emit removeInvalidProxy(info.clipId, true);
                 delete producer;
-                m_processingClipId.clear();
                 continue;
             }
         }
@@ -781,8 +786,8 @@ void Render::processFileProperties()
                     emit replyGetImage(info.clipId, img);
                 }
             }
-            emit replyGetFileProperties(info.clipId, producer, stringMap(), stringMap(), info.replaceProducer);
             m_processingClipId.clear();
+            emit replyGetFileProperties(info.clipId, producer, stringMap(), stringMap(), info.replaceProducer);
             continue;
         }
 
@@ -962,6 +967,7 @@ void Render::processFileProperties()
                 metadataPropertyMap[ name.section('.', 0, -2)] = value;
         }
         producer->seek(0);
+        m_processingClipId.clear();
         emit replyGetFileProperties(info.clipId, producer, filePropertyMap, metadataPropertyMap, info.replaceProducer);
     }
     m_processingClipId.clear();
@@ -1024,30 +1030,33 @@ int Render::setProducer(Mlt::Producer *producer, int position)
     m_mltConsumer->purge();
     consumerPosition = m_mltConsumer->position();
 
-    if (m_mltProducer) {
-        m_mltProducer->set_speed(0);
-        currentId = m_mltProducer->get("id");
-        delete m_mltProducer;
-        m_mltProducer = NULL;
-        emit stopped();
-    }
 
     blockSignals(true);
-    if (producer && producer->is_valid()) {
-        m_mltProducer = producer;
-    } else m_mltProducer = m_blackClip->cut(0, 1);
+    if (!producer || !producer->is_valid()) {
+        if (producer) delete producer;
+        producer = m_blackClip->cut(0, 1);
+    }
 
-    if (!m_mltProducer || !m_mltProducer->is_valid()) {
+    if (!producer || !producer->is_valid()) {
         kDebug() << " WARNING - - - - -INVALID PLAYLIST: ";
         return -1;
     }
-    if (position == -1 && m_mltProducer->get("id") == currentId) position = consumerPosition;
-    if (position != -1) m_mltProducer->seek(position);
+    if (m_mltProducer) currentId = m_mltProducer->get("id");
+    emit stopped();
+    if (position == -1 && producer->get("id") == currentId) position = consumerPosition;
+    if (position != -1) producer->seek(position);
     int volume = KdenliveSettings::volume();
-    m_mltProducer->set("meta.volume", (double)volume / 100);
-    m_fps = m_mltProducer->get_fps();
+    producer->set("meta.volume", (double)volume / 100);
+    m_fps = producer->get_fps();
     blockSignals(false);
-    m_mltConsumer->connect(*m_mltProducer);
+    m_mltConsumer->connect(*producer);
+
+    if (m_mltProducer) {
+        m_mltProducer->set_speed(0);
+        delete m_mltProducer;
+        m_mltProducer = NULL;
+    }
+    m_mltProducer = producer;
     m_mltProducer->set_speed(0);
     emit durationChanged(m_mltProducer->get_playtime());
     if (m_mltConsumer->start() == -1) {
index eb9f4b03448c6786f565cba5be38fd6879a12300..4a1c5a56d68b3b80954beffa1bcc0f70388e31f1 100644 (file)
@@ -285,7 +285,7 @@ Q_OBJECT public:
     /** @brief Returns a pointer to the main producer. */
     Mlt::Producer *getProducer();
     /** @brief Returns the number of clips to process (When requesting clip info). */
-    int processingItems() const;
+    int processingItems();
     /** @brief Force processing of clip with selected id. */
     void forceProcessing(const QString &id);
     /** @brief Are we currently processing clip with selected id. */