]> git.sesse.net Git - kdenlive/blobdiff - src/clipitem.cpp
Merge branch 'buildsystem' into next
[kdenlive] / src / clipitem.cpp
index 8e361e9f53cfbcf477800ec32358cdf263d438d7..cac5eda2b4690f0c6f683d3588161c1a903ece7a 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());
@@ -142,7 +138,9 @@ ClipItem *ClipItem::clone(ItemInfo info) const
     if (m_clipType == IMAGE || m_clipType == TEXT) duplicate->slotSetStartThumb(m_startPix);
     else if (m_clipType != COLOR) {
         if (info.cropStart == m_info.cropStart) duplicate->slotSetStartThumb(m_startPix);
-        if (info.cropStart + (info.endPos - info.startPos) == m_info.cropStart + (m_info.endPos - m_info.startPos)) duplicate->slotSetEndThumb(m_endPix);
+        if (info.cropStart + (info.endPos - info.startPos) == m_info.cropStart + m_info.cropDuration) {
+            duplicate->slotSetEndThumb(m_endPix);
+        }
     }
     //kDebug() << "// CLoning clip: " << (info.cropStart + (info.endPos - info.startPos)).frames(m_fps) << ", CURRENT end: " << (cropStart() + duration()).frames(m_fps);
     duplicate->setEffectList(m_effectList);
@@ -519,7 +517,6 @@ void ClipItem::resetThumbs(bool clearExistingThumbs)
         m_endPix = QPixmap();
         m_audioThumbCachePic.clear();
     }
-    kDebug()<<"...........  RESET THMBS";
     slotFetchThumbs();
 }
 
@@ -565,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);
     }
+
+    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);
 }
 
 
@@ -972,7 +969,7 @@ void ClipItem::paint(QPainter *painter,
         painter->drawRect(mapped.adjusted(0.5, 0.5, -0.5, -0.5));
     }
     else {
-        painter->drawRect(mapped.adjusted(0, 0, -0.5, -0.5));
+        painter->drawRect(mapped.adjusted(0, 0, -0.5, 0));
     }
 }
 
@@ -1778,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)
@@ -1847,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();