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 * ...@@ -55,13 +55,17 @@ const QString Media::AudioExtensions = "*.a52 *.aac *.ac3 *.aiff *.amr *.aob *
"*.wma *.wv *.xa *.xm"; "*.wma *.wv *.xa *.xm";
const QString Media::streamPrefix = "stream://"; const QString Media::streamPrefix = "stream://";
#ifdef WITH_GUI
QPixmap* Media::defaultSnapshot = nullptr; QPixmap* Media::defaultSnapshot = nullptr;
#endif
Media::Media(const QString &path ) Media::Media(const QString &path )
: m_source( nullptr ) : m_source( nullptr )
, m_fileInfo( nullptr ) , m_fileInfo( nullptr )
, m_baseClip( nullptr ) , m_baseClip( nullptr )
#ifdef WITH_GUI
, m_snapshotImage( nullptr ) , m_snapshotImage( nullptr )
#endif
{ {
setFilePath( path ); setFilePath( path );
} }
...@@ -131,12 +135,14 @@ Media::onMetaDataComputed() ...@@ -131,12 +135,14 @@ Media::onMetaDataComputed()
m_fileType = Image; m_fileType = Image;
else else
m_fileType = Video; m_fileType = Video;
#ifdef WITH_GUI
if ( m_source->snapshot() != nullptr ) if ( m_source->snapshot() != nullptr )
{ {
Q_ASSERT( m_snapshotImage == nullptr ); Q_ASSERT( m_snapshotImage == nullptr );
m_snapshotImage = new QImage( m_source->snapshot(), 320, 180, QImage::Format_RGB32 ); m_snapshotImage = new QImage( m_source->snapshot(), 320, 180, QImage::Format_RGB32 );
emit snapshotAvailable(); emit snapshotAvailable();
} }
#endif
} }
else if ( m_source->hasAudio() ) else if ( m_source->hasAudio() )
m_fileType = Audio; m_fileType = Audio;
...@@ -169,6 +175,7 @@ Media::setFilePath( const QString &filePath ) ...@@ -169,6 +175,7 @@ Media::setFilePath( const QString &filePath )
MetaDataManager::instance()->computeMediaMetadata( this ); MetaDataManager::instance()->computeMediaMetadata( this );
} }
#ifdef WITH_GUI
QPixmap& QPixmap&
Media::snapshot() Media::snapshot()
{ {
...@@ -187,3 +194,4 @@ Media::snapshot() ...@@ -187,3 +194,4 @@ Media::snapshot()
Media::defaultSnapshot = new QPixmap( ":/images/vlmc" ); Media::defaultSnapshot = new QPixmap( ":/images/vlmc" );
return *Media::defaultSnapshot; return *Media::defaultSnapshot;
} }
#endif
...@@ -99,9 +99,10 @@ public: ...@@ -99,9 +99,10 @@ public:
QVariant toVariant() const; QVariant toVariant() const;
#ifdef WITH_GUI
// This has to be called from the GUI thread. // This has to be called from the GUI thread.
QPixmap& snapshot(); QPixmap& snapshot();
#endif
protected: protected:
Backend::ISource* m_source; Backend::ISource* m_source;
QString m_mrl; QString m_mrl;
...@@ -110,9 +111,11 @@ protected: ...@@ -110,9 +111,11 @@ protected:
QString m_fileName; QString m_fileName;
Clip* m_baseClip; Clip* m_baseClip;
#ifdef WITH_GUI
static QPixmap* defaultSnapshot; static QPixmap* defaultSnapshot;
QPixmap m_snapshot; QPixmap m_snapshot;
QImage* m_snapshotImage; QImage* m_snapshotImage;
#endif
signals: signals:
void metaDataComputed(); 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