]> git.sesse.net Git - kdenlive/commitdiff
don't use proxy when exporting frame:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 23 Apr 2011 21:13:18 +0000 (21:13 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 23 Apr 2011 21:13:18 +0000 (21:13 +0000)
http://www.kdenlive.org/mantis/view.php?id=2096

svn path=/trunk/kdenlive/; revision=5549

src/monitor.cpp
src/renderer.cpp
src/renderer.h
src/titlewidget.cpp

index 0c2e057c1a3f8849e9bc63cef36a8de5e86ee34f..96be7c035602ef7976de92fe4342f945b33481cb 100644 (file)
@@ -566,7 +566,13 @@ void Monitor::slotSetThumbFrame()
 
 void Monitor::slotExtractCurrentFrame()
 {
-    QImage frame = render->extractFrame(render->seekFramePosition());
+    QImage frame;
+    // check if we are using a proxy
+    if (m_currentClip && !m_currentClip->getProperty("proxy").isEmpty() && m_currentClip->getProperty("proxy") != "-") {
+        // using proxy, use original clip url to get frame
+        frame = render->extractFrame(render->seekFramePosition(), m_currentClip->fileURL().path());
+    }
+    else frame = render->extractFrame(render->seekFramePosition());
     KFileDialog *fs = new KFileDialog(KUrl(), "image/png", this);
     fs->setOperationMode(KFileDialog::Saving);
     fs->setMode(KFile::File);
index 646c5611802a116faeca0bdfc81dbb2fa00d1d08..68ed54592c38b6bba386bc3a5076ee89538d0655 100644 (file)
@@ -406,14 +406,26 @@ int Render::renderHeight() const
     return m_mltProfile->height();
 }
 
-QImage Render::extractFrame(int frame_position, int width, int height)
+QImage Render::extractFrame(int frame_position, QString path, int width, int height)
 {
     if (width == -1) {
         width = renderWidth();
         height = renderHeight();
     } else if (width % 2 == 1) width++;
 
-    if (!m_mltProducer) {
+    if (!path.isEmpty()) {
+        Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile, path.toUtf8().constData());
+        if (producer) {
+            if (producer->is_valid()) {
+                QImage img = KThumb::getFrame(producer, frame_position, width, height);
+                delete producer;
+                return img;
+            }
+            else delete producer;
+        }
+    }
+    
+    if (!m_mltProducer || !path.isEmpty()) {
         QImage pix(width, height, QImage::Format_RGB32);
         pix.fill(Qt::black);
         return pix;
index 69626224bb5bb16c53b7968fd655d60c153b11b1..e6ab0b8fc124082ba62f8f1c15c0a27b29702a2b 100644 (file)
@@ -131,7 +131,7 @@ Q_OBJECT public:
     void stop(const GenTime & startTime);
     int volume() const;
 
-    QImage extractFrame(int frame_position, int width = -1, int height = -1);
+    QImage extractFrame(int frame_position, QString path = QString(), int width = -1, int height = -1);
 
     /** @brief Plays the scene starting from a specific time.
      * @param startTime time to start playing the scene from */
index e9ac9175dcfe2a5281f0b62e2b3c1d5951a887f6..7af47ac43256cebdc82613b1a4cd61ad5e9788e3 100644 (file)
@@ -782,7 +782,7 @@ void TitleWidget::displayBackgroundFrame()
         p.end();
         m_frameImage->setPixmap(bg);
     } else {
-        m_frameImage->setPixmap(QPixmap::fromImage(m_render->extractFrame((int) m_render->seekPosition().frames(m_render->fps()), m_frameWidth / 2, m_frameHeight / 2)));
+        m_frameImage->setPixmap(QPixmap::fromImage(m_render->extractFrame((int) m_render->seekPosition().frames(m_render->fps()), QString(), m_frameWidth / 2, m_frameHeight / 2)));
     }
 }