From 8162ac871e04677ae702847814b232ab1c6e7c8f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Tue, 3 Mar 2009 09:48:50 +0000 Subject: [PATCH] Improve selection of thumbnail (take a random image in the first 20 seconds) svn path=/branches/KDE4/; revision=3088 --- thumbnailer/westleypreview.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/thumbnailer/westleypreview.cpp b/thumbnailer/westleypreview.cpp index 69f8d187..c6679bfc 100644 --- a/thumbnailer/westleypreview.cpp +++ b/thumbnailer/westleypreview.cpp @@ -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; } -- 2.39.2