Skip to content
Snippets Groups Projects
Commit 634af2e0 authored by luyikei's avatar luyikei Committed by Hugo Beauzée-Luyssen
Browse files

Media: Mark WITH_GUI on Widget-related code


Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent fd7d8fb6
No related branches found
No related tags found
No related merge requests found
......@@ -55,13 +55,17 @@ const QString Media::AudioExtensions = "*.a52 *.aac *.ac3 *.aiff *.amr *.aob *
"*.wma *.wv *.xa *.xm";
const QString Media::streamPrefix = "stream://";
#ifdef WITH_GUI
QPixmap* Media::defaultSnapshot = nullptr;
#endif
Media::Media(const QString &path )
: m_source( nullptr )
, m_fileInfo( nullptr )
, m_baseClip( nullptr )
#ifdef WITH_GUI
, m_snapshotImage( nullptr )
#endif
{
setFilePath( path );
}
......@@ -131,12 +135,14 @@ Media::onMetaDataComputed()
m_fileType = Image;
else
m_fileType = Video;
#ifdef WITH_GUI
if ( m_source->snapshot() != nullptr )
{
Q_ASSERT( m_snapshotImage == nullptr );
m_snapshotImage = new QImage( m_source->snapshot(), 320, 180, QImage::Format_RGB32 );
emit snapshotAvailable();
}
#endif
}
else if ( m_source->hasAudio() )
m_fileType = Audio;
......@@ -169,6 +175,7 @@ Media::setFilePath( const QString &filePath )
MetaDataManager::instance()->computeMediaMetadata( this );
}
#ifdef WITH_GUI
QPixmap&
Media::snapshot()
{
......@@ -187,3 +194,4 @@ Media::snapshot()
Media::defaultSnapshot = new QPixmap( ":/images/vlmc" );
return *Media::defaultSnapshot;
}
#endif
......@@ -99,9 +99,10 @@ public:
QVariant toVariant() const;
#ifdef WITH_GUI
// This has to be called from the GUI thread.
QPixmap& snapshot();
#endif
protected:
Backend::ISource* m_source;
QString m_mrl;
......@@ -110,9 +111,11 @@ protected:
QString m_fileName;
Clip* m_baseClip;
#ifdef WITH_GUI
static QPixmap* defaultSnapshot;
QPixmap m_snapshot;
QImage* m_snapshotImage;
#endif
signals:
void metaDataComputed();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment