Permalink
Browse files

Make mythgallery use mythpreviewgen for movie thumbs

We'd like to eradicate mplayer completely, and since this is now an externally
available function, let's use it.  Seems to work well.
  • Loading branch information...
1 parent 6b2bdae commit 00cace0892e744fbb6915048b3dda480eec3f583 @Beirdo Beirdo committed Jan 3, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −4 mythplugins/mythgallery/mythgallery/thumbgenerator.cpp
@@ -281,6 +281,8 @@ void ThumbGenerator::loadDir(QImage& image, const QFileInfo& fi)
void ThumbGenerator::loadFile(QImage& image, const QFileInfo& fi)
{
+ static int sequence = 0;
+
if (GalleryUtil::IsMovie(fi.filePath()))
{
bool thumbnailCreated = false;
@@ -297,14 +299,21 @@ void ThumbGenerator::loadFile(QImage& image, const QFileInfo& fi)
if (tmpDir.exists())
{
- QString cmd = "mplayer -nosound -frames 1 -vo png:z=6 \"" +
- fi.absoluteFilePath() + "\"";
- MythSystem ms(cmd, kMSRunShell);
+ QString thumbFile = QString("%1.png")
+ .arg(++sequence,8,10,QChar('0'));
+
+ QString cmd = "mythpreviewgen";
+ QStringList args;
+ args << logPropagateArgs.split(" ", QString::SkipEmptyParts);
+ args << "--infile" << '"' + fi.absoluteFilePath() + '"';
+ args << "--outfile" << '"' + tmpDir.filePath(thumbFile) + '"';
+
+ MythSystem ms(cmd, args, kMSRunShell);
ms.SetDirectory(tmpDir.absolutePath());
ms.Run();
if (ms.Wait() == GENERIC_EXIT_OK)
{
- QFileInfo thumb(tmpDir.filePath("00000001.png"));
+ QFileInfo thumb(tmpDir.filePath(thumbFile));
if (thumb.exists())
{
QImage img(thumb.absoluteFilePath());

0 comments on commit 00cace0

Please sign in to comment.