]> git.sesse.net Git - kdenlive/blobdiff - src/clipitem.cpp
Rewrite audio thumbs threading
[kdenlive] / src / clipitem.cpp
index 4b2434fa206d0ca643bcc5c47cf6006e0fac897d..086aa7c6108a32d9a310d974bd30ea54808ce195 100644 (file)
@@ -27,7 +27,7 @@
 #include "kdenlivesettings.h"
 #include "kthumb.h"
 #include "profilesdialog.h"
-#ifdef QJSON
+#ifdef USE_QJSON
 #include "rotoscoping/rotowidget.h"
 #endif
 
@@ -99,9 +99,6 @@ ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, i
             connect(&m_startThumbTimer, SIGNAL(timeout()), this, SLOT(slotGetStartThumb()));
             m_endThumbTimer.setSingleShot(true);
             connect(&m_endThumbTimer, SIGNAL(timeout()), this, SLOT(slotGetEndThumb()));
-
-            connect(this, SIGNAL(getThumb(int, int)), m_clip, SLOT(slotExtractImage(int, int)));
-
             connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QImage)), this, SLOT(slotThumbReady(int, QImage)));
             connect(m_clip, SIGNAL(gotAudioData()), this, SLOT(slotGotAudioData()));
             if (generateThumbs) QTimer::singleShot(200, this, SLOT(slotFetchThumbs()));
@@ -114,7 +111,6 @@ ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, i
     } else if (m_clipType == IMAGE || m_clipType == TEXT) {
         m_baseColor = QColor(141, 166, 215);
         if (m_clipType == TEXT) {
-            connect(this, SIGNAL(getThumb(int, int)), m_clip, SLOT(slotExtractImage(int, int)));
             connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QImage)), this, SLOT(slotThumbReady(int, QImage)));
         }
         //m_startPix = KThumb::getImage(KUrl(clip->getProperty("resource")), (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio()), KdenliveSettings::trackheight());
@@ -521,7 +517,6 @@ void ClipItem::resetThumbs(bool clearExistingThumbs)
         m_endPix = QPixmap();
         m_audioThumbCachePic.clear();
     }
-    kDebug()<<"...........  RESET THMBS";
     slotFetchThumbs();
 }
 
@@ -567,30 +562,30 @@ void ClipItem::slotFetchThumbs()
         return;
     }
 
-    if (m_endPix.isNull() && m_startPix.isNull()) {
+    QList <int> frames;
+    if (m_startPix.isNull()) {
         m_startThumbRequested = true;
+        frames.append((int)m_speedIndependantInfo.cropStart.frames(m_fps));
+    }
+
+    if (m_endPix.isNull()) {
         m_endThumbRequested = true;
-        emit getThumb((int)m_speedIndependantInfo.cropStart.frames(m_fps), (int)(m_speedIndependantInfo.cropStart + m_speedIndependantInfo.cropDuration).frames(m_fps) - 1);
-    } else {
-        if (m_endPix.isNull()) {
-            slotGetEndThumb();
-        }
-        if (m_startPix.isNull()) {
-            slotGetStartThumb();
-        }
+        frames.append((int)(m_speedIndependantInfo.cropStart + m_speedIndependantInfo.cropDuration).frames(m_fps) - 1);
     }
+
+    if (!frames.isEmpty()) m_clip->slotExtractImage(frames);
 }
 
 void ClipItem::slotGetStartThumb()
 {
     m_startThumbRequested = true;
-    emit getThumb((int)m_speedIndependantInfo.cropStart.frames(m_fps), -1);
+    m_clip->slotExtractImage(QList<int>() << (int)m_speedIndependantInfo.cropStart.frames(m_fps));
 }
 
 void ClipItem::slotGetEndThumb()
 {
     m_endThumbRequested = true;
-    emit getThumb(-1, (int)(m_speedIndependantInfo.cropStart + m_speedIndependantInfo.cropDuration).frames(m_fps) - 1);
+    m_clip->slotExtractImage(QList<int>() << (int)(m_speedIndependantInfo.cropStart + m_speedIndependantInfo.cropDuration).frames(m_fps) - 1);
 }
 
 
@@ -1780,7 +1775,7 @@ Mlt::Producer *ClipItem::getProducer(int track, bool trackSpecific)
     else if (isVideoOnly())
         return m_clip->videoProducer();
     else
-        return m_clip->producer(trackSpecific ? track : -1);
+        return m_clip->getProducer(trackSpecific ? track : -1);
 }
 
 QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height, ItemInfo oldInfo)
@@ -1849,7 +1844,7 @@ QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height,
                 if (!effects.contains(i))
                     effects[i] = effect.cloneNode().toElement();
                 updateNormalKeyframes(param);
-#ifdef QJSON
+#ifdef USE_QJSON
             } else if (type == "roto-spline") {
                 if (!effects.contains(i))
                     effects[i] = effect.cloneNode().toElement();