Commit 8b34292a authored by Hugo Beauzée-Luyssen's avatar 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.
parent 60ad44a0
......@@ -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()
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment