[vlmc-devel] commit: MetadataWorker: Don't compute snapshot a second time. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sat Jul 3 17:21:50 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sat Jul  3 17:21:57 2010 +0200| [f65b96e9a406102080f21214fcfc9f31cee9ed85] | committer: Hugo Beauzée-Luyssen 

MetadataWorker: Don't compute snapshot a second time.

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

 src/Gui/media/GuiMedia.cpp      |    6 ++++++
 src/Gui/media/GuiMedia.h        |    1 +
 src/Metadata/MetaDataWorker.cpp |    4 ++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Gui/media/GuiMedia.cpp b/src/Gui/media/GuiMedia.cpp
index b8c6409..f944bcf 100644
--- a/src/Gui/media/GuiMedia.cpp
+++ b/src/Gui/media/GuiMedia.cpp
@@ -54,6 +54,12 @@ GUIMedia::snapshot() const
     return *GUIMedia::defaultSnapshot;
 }
 
+bool
+GUIMedia::hasSnapshot() const
+{
+    return ( m_snapshot != NULL );
+}
+
 void
 GUIMedia::emitSnapshotComputed()
 {
diff --git a/src/Gui/media/GuiMedia.h b/src/Gui/media/GuiMedia.h
index 5764329..19ac9c7 100644
--- a/src/Gui/media/GuiMedia.h
+++ b/src/Gui/media/GuiMedia.h
@@ -37,6 +37,7 @@ public:
     ~GUIMedia();
     void                        setSnapshot( QPixmap* snapshot );
     const QPixmap               &snapshot() const;
+    bool                        hasSnapshot() const;
     void                        emitSnapshotComputed();
 
 protected:
diff --git a/src/Metadata/MetaDataWorker.cpp b/src/Metadata/MetaDataWorker.cpp
index 4d8091a..cfc0db9 100644
--- a/src/Metadata/MetaDataWorker.cpp
+++ b/src/Metadata/MetaDataWorker.cpp
@@ -145,8 +145,8 @@ MetaDataWorker::metaDataAvailable()
     m_media->emitMetaDataComputed();
 #ifdef WITH_GUI
     //Setting time for snapshot :
-    if ( m_media->fileType() == Media::Video ||
-         m_media->fileType() == Media::Image )
+    if ( ( m_media->fileType() == Media::Video ||
+         m_media->fileType() == Media::Image ) && m_media->hasSnapshot() == false )
     {
         connect( m_mediaPlayer, SIGNAL( positionChanged( float ) ), this, SLOT( renderSnapshot() ) );
         m_mediaPlayer->setTime( m_mediaPlayer->getLength() / 3 );



More information about the Vlmc-devel mailing list