* *
***************************************************************************/
-#include <qapplication.h>
-
#include <kio/netaccess.h>
#include <kdebug.h>
#include <klocale.h>
#define _G(y,u,v) (0x2568*(y) - 0x0c92*(v) - 0x1a1e*(u)) /0x2000
#define _B(y,u,v) (0x2568*(y) + 0x40cf*(v)) /0x2000
-KThumb::KThumb(ClipManager *clipManager, KUrl url, int width, int height, QObject * parent, const char *name): QObject(parent), m_clipManager(clipManager), m_url(url), m_width(width), m_height(height) {
+KThumb::KThumb(ClipManager *clipManager, KUrl url, QObject * parent, const char *name): QObject(parent), m_clipManager(clipManager), m_url(url) {
m_profile = new Mlt::Profile((char*) KdenliveSettings::current_profile().data());
QCryptographicHash context(QCryptographicHash::Sha1);
if (thumbProducer.isRunning()) thumbProducer.exit();
}
+void KThumb::updateClipUrl(KUrl url) {
+ m_url = url;
+}
//static
QPixmap KThumb::getImage(KUrl url, int width, int height) {
char *tmp = Render::decodedString(m_url.path());
Mlt::Producer m_producer(*m_profile, tmp);
delete[] tmp;
-
- QPixmap pix(m_width, m_height);
+ int twidth = (int)(KdenliveSettings::trackheight() * KdenliveSettings::project_display_ratio());
if (m_producer.is_blank()) {
- QPixmap pix(m_width, m_height);
+ QPixmap pix(twidth, KdenliveSettings::trackheight());
pix.fill(Qt::black);
emit thumbReady(frame, pix);
return;
}
if (frame != -1) {
- QPixmap pix = getFrame(&m_producer, frame, m_width, m_height);
+ QPixmap pix = getFrame(&m_producer, frame, twidth, KdenliveSettings::trackheight());
emit thumbReady(frame, pix);
}
if (frame2 != -1) {
- QPixmap pix = getFrame(&m_producer, frame2, m_width, m_height);
+ QPixmap pix = getFrame(&m_producer, frame2, twidth , KdenliveSettings::trackheight());
emit thumbReady(frame2, pix);
}
return pix;
}
return getFrame(&producer, frame, width, height);
+}
+QPixmap KThumb::getImage(QDomElement xml, int frame, int width, int height) {
+ Mlt::Profile profile((char*) KdenliveSettings::current_profile().data());
+ QPixmap pix(width, height);
+ QDomDocument doc;
+ QDomElement westley = doc.createElement("westley");
+ doc.appendChild(westley);
+ westley.appendChild(doc.importNode(xml, true));
+ char *tmp = Render::decodedString(doc.toString());
+ kDebug() << " - - - UPDATING THMB, XML: " << doc.toString();
+ Mlt::Producer producer(profile, "westley-xml", tmp);
+ delete[] tmp;
+
+ if (producer.is_blank()) {
+ pix.fill(Qt::black);
+ return pix;
+ }
+ return getFrame(&producer, frame, width, height);
}
QPixmap KThumb::getFrame(Mlt::Producer* producer, int frame, int width, int height) {
Mlt::Filter m_convert(profile, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
producer->attach(m_convert);
-
- producer->seek(frame);
+ if (frame > -1)
+ producer->seek(frame);
Mlt::Frame * m_frame = producer->get_frame();
mlt_image_format format = mlt_image_rgb24a;
QPixmap pix(width, height);