]> git.sesse.net Git - kdenlive/commitdiff
Use project aspect ratio for clip properties dialog thumbnail, fix problem with extra...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 29 May 2009 23:30:13 +0000 (23:30 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 29 May 2009 23:30:13 +0000 (23:30 +0000)
svn path=/trunk/kdenlive/; revision=3449

src/clipproperties.cpp
src/dvdwizardvob.cpp
src/kthumb.cpp
src/markerdialog.cpp
src/renderer.cpp

index 5b767fb0bb30368af8d6a0b254131747ed6c66f2..adb51fa4e5cb6df880ca75ffb1b24053a80140ea 100644 (file)
@@ -214,8 +214,9 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
             m_view.clip_fps->setText(props.value("fps"));
         if (props.contains("aspect_ratio"))
             m_view.clip_ratio->setText(props.value("aspect_ratio"));
-
-        QPixmap pix = m_clip->thumbProducer()->getImage(url, m_clip->getClipThumbFrame(), 240, 180);
+        int width = 180.0 * KdenliveSettings::project_display_ratio();
+        if (width % 2 == 1) width++;
+        QPixmap pix = m_clip->thumbProducer()->getImage(url, m_clip->getClipThumbFrame(), width, 180);
         m_view.clip_thumb->setPixmap(pix);
         if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(AUDIOTAB);
     } else {
index 071a574f26675a24a97e73857f2e11b615805cdf..a0a90cd3f8dc0d448da9dd10345901b9020bdc4c 100644 (file)
@@ -123,7 +123,9 @@ void DvdWizardVob::slotAddVobFile(KUrl url, const QString &chapters)
     delete[] tmp;
 
     if (producer->is_blank() == false) {
-        pix = KThumb::getFrame(producer, 0, 60, 45);
+        int width = 45.0 * profile.dar();
+        if (width % 2 == 1) width++;
+        pix = KThumb::getFrame(producer, 0, width, 45);
         item->setIcon(0, pix);
         int playTime = producer->get_playtime();
         item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
@@ -183,7 +185,7 @@ void DvdWizardVob::changeFormat()
         delete[] tmp;
 
         if (producer->is_blank() == false) {
-            //pix = KThumb::getFrame(producer, 0, 180, 135);
+            //pix = KThumb::getFrame(producer, 0, 135 * profile.dar(), 135);
             //item->setIcon(0, pix);
             item->setText(1, Timecode::getStringTimecode(producer->get_playtime(), profile.fps()));
         }
index a8ce5ca539419240f7c6a1dfc0009cbb76ec0155..1b6d97672083069645799ae73e3658019af70c68 100644 (file)
@@ -272,11 +272,13 @@ QPixmap KThumb::extractImage(int frame, int width, int height)
 //static
 QPixmap KThumb::getImage(KUrl url, int frame, int width, int height)
 {
-    Mlt::Profile profile((char*) KdenliveSettings::current_profile().data());
+    char *tmp = Render::decodedString(KdenliveSettings::current_profile());
+    Mlt::Profile profile(tmp);
+    delete[] tmp;
     QPixmap pix(width, height);
     if (url.isEmpty()) return pix;
 
-    char *tmp = Render::decodedString(url.path());
+    tmp = Render::decodedString(url.path());
     //"<mlt><playlist><producer resource=\"" + url.path() + "\" /></playlist></mlt>");
     //Mlt::Producer producer(profile, "xml-string", tmp);
     Mlt::Producer *producer = new Mlt::Producer(profile, tmp);
index 1994c6c8ed78ec0c853ba8e1817d434f91cb8713..7fd788439be7808e0b8e8f1ba32df06908c7e445 100644 (file)
@@ -53,8 +53,9 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, cons
         //char *tmp = doc.toString().toUtf8().data();
         m_producer = new Mlt::Producer(*m_profile, "xml-string", doc.toString().toUtf8().data());
         //delete[] tmp;
-
-        QPixmap p((int)(100 * m_dar), 100);
+        int width = 100.0 * m_dar;
+        if (width % 2 == 1) width++;
+        QPixmap p(width, 100);
         QString colour = clip->getProperty("colour");
         switch (m_clip->clipType()) {
         case VIDEO:
@@ -64,7 +65,7 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, cons
             connect(this, SIGNAL(updateThumb()), m_previewTimer, SLOT(start()));
         case IMAGE:
         case TEXT:
-            p = KThumb::getFrame(m_producer, t.time().frames(m_fps), (int)(100 * m_dar), 100);
+            p = KThumb::getFrame(m_producer, t.time().frames(m_fps), width, 100);
             break;
         case COLOR:
             colour = colour.replace(0, 2, "#");
@@ -104,7 +105,9 @@ void MarkerDialog::slotUpdateThumb()
 {
     m_previewTimer->stop();
     int pos = m_tc.getFrameCount(m_view.marker_position->text(), m_fps);
-    QPixmap p = KThumb::getFrame(m_producer, pos, (int)(100 * m_dar), 100);
+    int width = 100.0 * m_dar;
+    if (width % 2 == 1) width++;
+    QPixmap p = KThumb::getFrame(m_producer, pos, width, 100);
     if (!p.isNull()) m_view.clip_thumb->setPixmap(p);
     else kDebug() << "!!!!!!!!!!!  ERROR CREATING THUMB";
 }
index 0ef31973056f3c4b109a1065234f9c710afed426..9698084d8de5aeb9c1bf0c9c079ebc711f4fe118 100644 (file)
@@ -269,7 +269,7 @@ QPixmap Render::extractFrame(int frame_position, int width, int height)
     if (width == -1) {
         width = renderWidth();
         height = renderHeight();
-    }
+    } else if (width % 2 == 1) width++;
     QPixmap pix(width, height);
     if (!m_mltProducer) {
         pix.fill(Qt::black);