]> git.sesse.net Git - kdenlive/commitdiff
Improve selection of thumbnail (take a random image in the first 20 seconds)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 3 Mar 2009 09:48:50 +0000 (09:48 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 3 Mar 2009 09:48:50 +0000 (09:48 +0000)
svn path=/branches/KDE4/; revision=3088

thumbnailer/westleypreview.cpp

index 69f8d187e7304d04f49ef1daea4c1fb37f8f7504..c6679bfcd18ae2de788bebcf88051b3d5aad0d00 100644 (file)
@@ -127,19 +127,19 @@ bool WestleyPreview::create(const QString &path, int width, int height, QImage &
     }
 
     if (pix.depth() != 32)
-        img = pix.convertToFormat(QImage::Format_RGB32);
+       img = pix.convertToFormat( QImage::Format_RGB32 );
     else img = pix;
     return true;
 }
 
 QImage WestleyPreview::getFrame(const QString &path) {
     QStringList args;
-#define START ((fileinfo.seconds*15)/100)
-#define END ((fileinfo.seconds*70)/100)
+    const int START = 25;
+    const int RANGE = 500;
     args.clear();
     args << playerBin << "\"" + path + "\"";
 
-    unsigned long start = (unsigned long)(START + (m_rand->getDouble() * (END - START)));
+    unsigned long start = (unsigned long)(START + (m_rand->getDouble() * RANGE));
     args << QString("in=%1").arg(start) << QString("out=%1").arg(start) << "-consumer";
 
     KTemporaryFile temp;
@@ -175,7 +175,8 @@ uint WestleyPreview::imageVariance(QImage image) {
     return delta / STEPS;
 }
 
-ThumbCreator::Flags WestleyPreview::flags() const {
+ThumbCreator::Flags WestleyPreview::flags() const
+{
     return None;
 }