-QPixmap KThumb::getFrame(Mlt::Producer* producer, int frame, int width, int height) {
- Mlt::Profile profile((char*) KdenliveSettings::current_profile().data());
- Mlt::Filter m_convert(profile, "avcolour_space");
- m_convert.set("forced", mlt_image_rgb24a);
- producer->attach(m_convert);
+ const uchar* imagedata = frame->get_image(format, ow, oh);
+ QImage image(ow, oh, QImage::Format_ARGB32_Premultiplied);
+ memcpy(image.bits(), imagedata, ow * oh * 4);//.byteCount());
+
+ //const uchar* imagedata = frame->get_image(format, ow, oh);
+ //QImage image(imagedata, ow, oh, QImage::Format_ARGB32_Premultiplied);
+
+ if (!image.isNull()) {
+ if (ow > (2 * displayWidth)) {
+ // there was a scaling problem, do it manually
+ image = image.scaled(displayWidth, height).rgbSwapped();
+ } else {
+ image = image.scaled(displayWidth, height, Qt::IgnoreAspectRatio).rgbSwapped();
+ }
+ p.fill(QColor(Qt::black).rgb());
+ QPainter painter(&p);
+ painter.drawImage(p.rect(), image);
+ painter.end();
+ } else
+ p.fill(QColor(Qt::red).rgb());
+ return p;
+}