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

Media: Expose the thumbnail as a path to the ML one

parent c9a9d16b
......@@ -47,7 +47,8 @@ ClipProperty::ClipProperty( Clip* clip, QWidget *parent ) :
setWindowTitle( m_clip->media()->title() + " " + tr( "properties" ) );
//Snapshot
ui->snapshotLabel->setPixmap( m_clip->media()->snapshot().scaled( 128, 128, Qt::KeepAspectRatio ) );
QPixmap snapshot( m_clip->media()->snapshot() );
ui->snapshotLabel->setPixmap( snapshot.scaled( 128, 128, Qt::KeepAspectRatio ) );
//Metatags
const QPushButton* button = ui->buttonBox->button( QDialogButtonBox::Apply );
Q_ASSERT( button != nullptr);
......
......@@ -59,10 +59,6 @@ const QString Media::AudioExtensions = "*.a52 *.aac *.ac3 *.aiff *.amr *.aob *
"*.wma *.wv *.xa *.xm";
const QString Media::streamPrefix = "stream://";
#ifdef HAVE_GUI
QPixmap* Media::defaultSnapshot = nullptr;
#endif
Media::Media( medialibrary::MediaPtr media, const QUuid& uuid /* = QUuid() */ )
: m_input( nullptr )
, m_mlMedia( media )
......@@ -201,26 +197,11 @@ Media::fromVariant( const QVariant& v )
return media;
}
#ifdef HAVE_GUI
QPixmap&
QString
Media::snapshot()
{
if ( Media::defaultSnapshot == nullptr )
Media::defaultSnapshot = new QPixmap( ":/images/vlmc" );
if ( m_snapshot.isNull() == true ) {
int height = 200;
int width = height * m_input->aspectRatio();
m_input->setPosition( m_input->length() / 3 );
QImage img( m_input->image( width, height ), width, height,
QImage::Format_RGBA8888, []( void* buf ){ delete[] (uchar*) buf; } );
m_input->setPosition( 0 );
m_snapshot.convertFromImage( img );
}
return m_snapshot.isNull() ? *Media::defaultSnapshot : m_snapshot;
return QString::fromStdString( m_mlMedia->thumbnail() );
}
#endif
QSharedPointer<Clip>
Media::loadSubclip( const QVariantMap& m )
......
......@@ -46,11 +46,6 @@
#include <medialibrary/IMedia.h>
#include <medialibrary/IFile.h>
#ifdef HAVE_GUI
#include <QPixmap>
#include <QImage>
#endif
namespace Backend
{
class IInput;
......@@ -109,10 +104,7 @@ public:
static QSharedPointer<Media> fromVariant( const QVariant& v );
#ifdef HAVE_GUI
// This has to be called from the GUI thread.
QPixmap& snapshot();
#endif
QString snapshot();
private:
QSharedPointer<Clip> loadSubclip( const QVariantMap& m );
......@@ -124,11 +116,6 @@ protected:
Clip* m_baseClip;
QHash<QUuid, QSharedPointer<Clip>> m_clips;
#ifdef HAVE_GUI
static QPixmap* defaultSnapshot;
QPixmap m_snapshot;
#endif
signals:
/**
* \brief This signal should be emitted to tell a new sublip have been added
......
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