[vlmc-devel] [PATCH 04/14] Media: Mark WITH_GUI on Widget-related code

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Apr 12 13:43:21 CEST 2016


On 04/11/2016 08:09 AM, Yikai Lu wrote:
> ---
>   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();
>

Good enough for now. Hopefully this part of code will go away with the 
new medialibrary.


More information about the Vlmc-devel mailing list