[vlmc-devel] MetaDataWorker: Remove now useless wrapper finalize() and failure()

Hugo Beauzée-Luyssen git at videolan.org
Sun Sep 23 16:40:54 CEST 2012


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Sep 23 16:38:37 2012 +0300| [8b34292aacd39eeee46c8d02828f759c09cdaff3] | committer: Hugo Beauzée-Luyssen

MetaDataWorker: Remove now useless wrapper finalize() and failure()

There's nothing much to do than emit the signal, so just emit it.
The deletion of the instance is now done automaticaly when the thread
has finished it's computing, so we don't need to call deleteLater()
manually.

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

 src/Metadata/MetaDataWorker.cpp |   22 +++++-----------------
 src/Metadata/MetaDataWorker.h   |    4 +---
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/src/Metadata/MetaDataWorker.cpp b/src/Metadata/MetaDataWorker.cpp
index 23932cd..c7e2f81 100644
--- a/src/Metadata/MetaDataWorker.cpp
+++ b/src/Metadata/MetaDataWorker.cpp
@@ -79,7 +79,7 @@ MetaDataWorker::run()
     {
         qWarning() << "Got" << (res == LibVLCpp::MediaPlayer::Timeout ? "timeout" : "failure")
                       << "while launching metadata processing";
-        failure();
+        emit failed( m_media );
     }
     else
         metaDataAvailable();
@@ -143,7 +143,7 @@ MetaDataWorker::metaDataAvailable()
         return ;
     }
 #endif
-    finalize();
+    emit computed();
 }
 
 #ifdef WITH_GUI
@@ -166,12 +166,13 @@ MetaDataWorker::computeSnapshot()
     {
         qWarning() << "Got" << (res == LibVLCpp::MediaPlayer::Timeout ? "timeout" : "failure")
                       << "while launching metadata processing";
-        failure();
+        emit failed( m_media );
         return ;
     }
 
     QTemporaryFile tmp;
     tmp.open();
+    // the snapshot file will be removed when processed by the media.
     tmp.setAutoRemove( false );
 
     // Although this function is synchrone, we have to be in the main thread to
@@ -180,22 +181,9 @@ MetaDataWorker::computeSnapshot()
              m_media, SLOT( snapshotReady( const char* ) ),
              Qt::QueuedConnection );
     m_mediaPlayer->takeSnapshot( tmp.fileName().toUtf8().constData(), 0, 0 );
-    finalize();
-}
-#endif
-
-void
-MetaDataWorker::finalize()
-{
     emit computed();
 }
-
-void
-MetaDataWorker::failure()
-{
-    emit failed( m_media );
-    deleteLater();
-}
+#endif
 
 //void
 //MetaDataWorker::prepareAudioSpectrumComputing()
diff --git a/src/Metadata/MetaDataWorker.h b/src/Metadata/MetaDataWorker.h
index a7506f6..f18c469 100644
--- a/src/Metadata/MetaDataWorker.h
+++ b/src/Metadata/MetaDataWorker.h
@@ -52,7 +52,6 @@ class MetaDataWorker : public QThread
     private:
 //        void                        prepareAudioSpectrumComputing();
 //        void                        addAudioValue( int value );
-        void                        finalize();
 
     private:
         void                        metaDataAvailable();
@@ -71,9 +70,8 @@ class MetaDataWorker : public QThread
 
         unsigned char*              m_audioBuffer;
 
-    private slots:
+//    private slots:
 //        void    generateAudioSpectrum();
-        void    failure();
 
     signals:
         void    computed();



More information about the Vlmc-devel mailing list