- Mlt::Filter m_convert(*m_profile, "avcolour_space");
- m_convert.set("forced", mlt_image_rgb24a);
- m_producer.attach(m_convert);
- if (frame != -1) {
- m_producer.seek(frame);
- m_frame = m_producer.get_frame();
- if (m_frame && m_frame->is_valid()) {
- uint8_t *thumb = m_frame->get_image(format, m_width, m_height);
- QImage image(thumb, m_width, m_height, QImage::Format_ARGB32);
- if (!image.isNull()) {
- pix = pix.fromImage(image);
- } else pix.fill(Qt::black);
+
+ 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();