[vlmc-devel] commit: Metadata Worker: Don' t bother using VLC to compute an image snapshot. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Oct 31 19:52:14 CET 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Oct 31 19:45:55 2010 +0100| [10f220b1738f53454159a484a4b5151fb647b539] | committer: Hugo Beauzée-Luyssen 

Metadata Worker: Don't bother using VLC to compute an image snapshot.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=10f220b1738f53454159a484a4b5151fb647b539
---

 src/Gui/import/ImportController.cpp |    1 +
 src/Media/Media.cpp                 |    6 +++---
 src/Metadata/MetaDataWorker.cpp     |   13 +++++++++----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index a96f297..80a8590 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -144,6 +144,7 @@ ImportController::clipSelection( Clip* clip )
 void
 ImportController::importMedia( const QString &filePath )
 {
+    qDebug() << "Importing" << filePath;
     if ( Library::getInstance()->mediaAlreadyLoaded( filePath ) == true ||
          m_temporaryMedias->mediaAlreadyLoaded( filePath ) == true )
         return ;
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index b5f7414..53adbf4 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -295,10 +295,10 @@ Media::setFilePath( const QString &filePath )
     m_fileInfo = new QFileInfo( filePath );
     m_fileName = m_fileInfo->fileName();
     setFileType();
-    if ( m_fileType == Media::Video || m_fileType == Media::Audio )
+//    if ( m_fileType == Media::Video || m_fileType == Media::Audio )
         m_mrl = "file:///" + QUrl::toPercentEncoding( filePath, "/" );
-    else
-        m_mrl = "fake:///" + QUrl::toPercentEncoding( filePath, "/" );
+//    else
+//        m_mrl = "fake:///" + QUrl::toPercentEncoding( filePath, "/" );
     if ( m_vlcMedia )
         delete m_vlcMedia;
     m_vlcMedia = new LibVLCpp::Media( m_mrl );
diff --git a/src/Metadata/MetaDataWorker.cpp b/src/Metadata/MetaDataWorker.cpp
index aa890c7..7236d51 100644
--- a/src/Metadata/MetaDataWorker.cpp
+++ b/src/Metadata/MetaDataWorker.cpp
@@ -148,15 +148,20 @@ MetaDataWorker::metaDataAvailable()
     m_media->emitMetaDataComputed();
 #ifdef WITH_GUI
     //Setting time for snapshot :
-    if ( ( m_media->fileType() == Media::Video ||
-         m_media->fileType() == Media::Image ) && m_media->hasSnapshot() == false )
+    if ( m_media->fileType() == Media::Video && m_media->hasSnapshot() == false )
     {
         connect( m_mediaPlayer, SIGNAL( positionChanged( float ) ), this, SLOT( renderSnapshot() ) );
         m_mediaPlayer->setTime( m_mediaPlayer->getLength() / 3 );
+        return ;
+    }
+    else if ( m_media->fileType() == Media::Image && m_media->hasSnapshot() == false )
+    {
+        QPixmap *pixmap = new QPixmap( m_media->fileInfo()->absoluteFilePath() );
+        m_media->setSnapshot( pixmap );
+        m_media->emitSnapshotComputed();
     }
-    else
 #endif
-        finalize();
+    finalize();
 }
 
 #ifdef WITH_GUI



More information about the Vlmc-devel mailing list