Commit 10f220b1 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

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

parent 03b7f973
......@@ -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 ;
......
......@@ -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 );
......
......@@ -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
......
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