]> git.sesse.net Git - kdenlive/blobdiff - src/kthumb.cpp
Fix forcing some clip properties not always working correctly
[kdenlive] / src / kthumb.cpp
index 0ab4eab29767d444b2765584b30d3d4364f79a58..2c8ac9b7cfbe628d00b6088334e9e089ec456d5d 100644 (file)
@@ -108,13 +108,13 @@ QPixmap KThumb::getImage(KUrl url, int width, int height)
 void KThumb::extractImage(QList <int>frames)
 {
     if (!KdenliveSettings::videothumbnails() || m_producer == NULL) return;
-    m_clipManager->requestThumbs(m_id, frames);
+    m_clipManager->slotRequestThumbs(m_id, frames);
 }
 
 
 void KThumb::getThumb(int frame)
 {
-    const int theight = KdenliveSettings::trackheight();
+    const int theight = Kdenlive::DefaultThumbHeight;
     const int swidth = (int)(theight * m_ratio + 0.5);
     const int dwidth = (int)(theight * m_dar + 0.5);
     QImage img = getProducerFrame(frame, swidth, dwidth, theight);
@@ -133,7 +133,7 @@ QImage KThumb::extractImage(int frame, int width, int height)
 {
     if (m_producer == NULL) {
         QImage img(width, height, QImage::Format_ARGB32_Premultiplied);
-        img.fill(Qt::black);
+        img.fill(QColor(Qt::black).rgb());
         return img;
     }
     return getProducerFrame(frame, (int) (height * m_ratio + 0.5), width, height);
@@ -168,6 +168,9 @@ QImage KThumb::getProducerFrame(int framepos, int frameWidth, int displayWidth,
     QMutexLocker lock(&m_mutex);
     m_producer->seek(framepos);
     Mlt::Frame *frame = m_producer->get_frame();
+    /*frame->set("rescale.interp", "nearest");
+    frame->set("deinterlace_method", "onefield");
+    frame->set("top_field_first", -1 );*/
     QImage p = getFrame(frame, frameWidth, displayWidth, height);
     delete frame;
     return p;
@@ -226,8 +229,14 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int frameWidth, int displayWidth, int
         } else {
             image = image.scaled(displayWidth, height, Qt::IgnoreAspectRatio).rgbSwapped();
         }
-        p.fill(QColor(100, 100, 100, 70));
+#if QT_VERSION >= 0x040800
+       p.fill(QColor(100, 100, 100, 70));
         QPainter painter(&p);
+#else
+       p.fill(Qt::transparent);
+       QPainter painter(&p);
+       painter.fillRect(p.rect(), QColor(100, 100, 100, 70));
+#endif
         painter.drawImage(p.rect(), image);
         painter.end();
     } else
@@ -305,7 +314,7 @@ void KThumb::getThumbs(KUrl url, int startframe, int endframe, int width, int he
     if (url.isEmpty()) return;
     QPixmap image(width, height);
     Mlt::Producer m_producer(url.path().toUtf8().constData());
-    image.fill(Qt::black);
+    image.fill(QColor(Qt::black).rgb());
 
     if (m_producer.is_blank()) {
  emit thumbReady(startframe, image);