[vlmc-devel] Media: Mark WITH_GUI on Widget-related code
Yikai Lu
git at videolan.org
Tue Apr 12 15:56:34 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Apr 11 15:09:15 2016 +0900| [634af2e04642ae6047d74a0ce4147abb10dc482b] | committer: Hugo Beauzée-Luyssen
Media: Mark WITH_GUI on Widget-related code
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> https://code.videolan.org/videolan/vlmc/commit/634af2e04642ae6047d74a0ce4147abb10dc482b
---
src/Media/Media.cpp | 8 ++++++++
src/Media/Media.h | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index 9f708f1..0968d5b 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -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
diff --git a/src/Media/Media.h b/src/Media/Media.h
index b6d3ed6..a366fdb 100644
--- a/src/Media/Media.h
+++ b/src/Media/Media.h
@@ -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();
More information about the Vlmc-devel
mailing list