]> git.sesse.net Git - kdenlive/commitdiff
Fix timeline video thumbnail aspect ratio
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 29 Jul 2008 20:02:02 +0000 (20:02 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 29 Jul 2008 20:02:02 +0000 (20:02 +0000)
svn path=/branches/KDE4/; revision=2349

src/kthumb.cpp
src/kthumb.h

index a881ec606480b04db78a844032658f8292c40663..b43098b71f9e4ab3f1bcd86ba96dc966379484a8 100644 (file)
@@ -132,9 +132,7 @@ void MyThread::run() {
 #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, QObject * parent, const char *name): QObject(parent), m_clipManager(clipManager), m_url(url), m_producer(NULL) {
-
-    m_profile = new Mlt::Profile((char*) KdenliveSettings::current_profile().data());
+KThumb::KThumb(ClipManager *clipManager, KUrl url, QObject * parent, const char *name): QObject(parent), m_clipManager(clipManager), m_url(url), m_producer(NULL), m_dar(1) {
     QCryptographicHash context(QCryptographicHash::Sha1);
     context.addData((KFileItem(m_url, "text/plain", S_IFREG).timeString() + m_url.fileName()).toAscii().data());
     m_thumbFile = KGlobal::dirs()->saveLocation("tmp" , "kdenlive") + context.result().toHex() + ".thumb";
@@ -142,12 +140,12 @@ KThumb::KThumb(ClipManager *clipManager, KUrl url, QObject * parent, const char
 }
 
 KThumb::~KThumb() {
-    if (m_profile) delete m_profile;
     if (thumbProducer.isRunning()) thumbProducer.exit();
 }
 
 void KThumb::setProducer(Mlt::Producer *producer) {
     m_producer = producer;
+    m_dar = producer->profile()->dar();
 }
 
 void KThumb::updateClipUrl(KUrl url) {
@@ -167,7 +165,7 @@ void KThumb::extractImage(int frame, int frame2) {
     Mlt::Producer producer(*m_profile, "westley-xml", tmp);
     delete[] tmp;*/
 
-    int twidth = (int)(KdenliveSettings::trackheight() * m_profile->dar());
+    int twidth = (int)(KdenliveSettings::trackheight() * m_dar);
     if (m_producer->is_blank()) {
         QPixmap pix(twidth, KdenliveSettings::trackheight());
         pix.fill(Qt::black);
index 0c312205781be30072792b8c9e5595de62d900b0..e6bed31e760df1881c4022224554e4e9bdad900d 100644 (file)
@@ -96,7 +96,7 @@ private:
     MyThread thumbProducer;
     KUrl m_url;
     QString m_thumbFile;
-    Mlt::Profile *m_profile;
+    double m_dar;
     Mlt::Producer *m_producer;
     ClipManager *m_clipManager;