+ return getImage(url, 0, width, height);
+}
+
+void KThumb::extractImage(int frame, int frame2) {
+ if (m_url.isEmpty() || !KdenliveSettings::videothumbnails() || m_producer == NULL) return;
+
+ const int twidth = (int)(KdenliveSettings::trackheight() * m_dar);
+ const int theight = KdenliveSettings::trackheight();
+
+ mlt_image_format format = mlt_image_yuv422;
+ if (m_producer->is_blank()) {
+ QPixmap pix(twidth, theight);
+ pix.fill(Qt::black);
+ emit thumbReady(frame, pix);
+ return;
+ }
+ Mlt::Frame *mltFrame;
+ if (frame != -1) {
+ //videoThumbProducer.getThumb(frame);
+ m_producer->seek(frame);
+ mltFrame = m_producer->get_frame();
+ if (frame2 != -1) m_producer->seek(frame2);
+ if (!mltFrame) {
+ kDebug() << "///// BROKEN FRAME";
+ QPixmap p(twidth, theight);
+ p.fill(Qt::red);
+ emit thumbReady(frame, p);
+ return;
+ } else {
+ int frame_width = 0;
+ int frame_height = 0;
+ mltFrame->set("normalised_height", theight);
+ mltFrame->set("normalised_width", twidth);
+ QPixmap pix(twidth, theight);
+ uint8_t *data = mltFrame->get_image(format, frame_width, frame_height, 0);
+ uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
+ mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
+
+ QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+
+ if (!image.isNull()) {
+ pix = QPixmap::fromImage(image.rgbSwapped());
+ } else
+ pix.fill(Qt::red);
+
+ mlt_pool_release(new_image);
+ delete mltFrame;
+ emit thumbReady(frame, pix);
+ }
+ } else if (frame2 != -1) m_producer->seek(frame2);
+ if (frame2 != -1) {
+ mltFrame = m_producer->get_frame();
+ if (!mltFrame) {
+ kDebug() << "///// BROKEN FRAME";
+ QPixmap p(twidth, theight);
+ p.fill(Qt::red);
+ emit thumbReady(frame, p);
+ return;
+ } else {
+ int frame_width = 0;
+ int frame_height = 0;
+ mltFrame->set("normalised_height", theight);
+ mltFrame->set("normalised_width", twidth);
+ QPixmap pix(twidth, theight);
+ uint8_t *data = mltFrame->get_image(format, frame_width, frame_height, 0);
+ uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
+ mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
+
+ QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+
+ if (!image.isNull()) {
+ pix = QPixmap::fromImage(image.rgbSwapped());
+ } else
+ pix.fill(Qt::red);
+
+ mlt_pool_release(new_image);
+ delete mltFrame;
+ emit thumbReady(frame2, pix);
+ }
+ }
+}
+
+QPixmap KThumb::extractImage(int frame, int width, int height) {
+ return getFrame(m_producer, frame, width, height);
+}
+
+//static
+QPixmap KThumb::getImage(KUrl url, int frame, int width, int height) {
+ Mlt::Profile profile((char*) KdenliveSettings::current_profile().data());