Commit 367fecdf authored by luyikei's avatar luyikei

Add ThumbnailWorker

parent f357ed68
......@@ -37,6 +37,7 @@ vlmc_SOURCES = \
src/Workflow/Helper.cpp \
src/Workflow/MainWorkflow.cpp \
src/Workflow/SequenceWorkflow.cpp \
src/Workflow/ThumbnailWorker.cpp \
$(NULL)
vlmc_SOURCES += \
......@@ -100,6 +101,7 @@ vlmc_SOURCES += \
nodist_vlmc_SOURCES = \
src/Media/Clip.moc.cpp \
src/Workflow/SequenceWorkflow.moc.cpp \
src/Workflow/ThumbnailWorker.moc.cpp \
src/Services/YouTube/YouTubeService.moc.cpp \
src/EffectsEngine/EffectHelper.moc.cpp \
src/Workflow/Helper.moc.cpp \
......
#include "ThumbnailWorker.h"
#include <QPixmap>
#include <QUuid>
#include "Backend/MLT/MLTInput.h"
ThumbnailWorker::ThumbnailWorker( QObject* parent )
: QObject( parent )
{
}
void
ThumbnailWorker::run( const QString& uuid, const QString& filePath, qint64 pos, quint32 width, quint32 height )
{
Backend::MLT::MLTInput input( qPrintable( filePath ) );
input.setPosition( pos );
auto image = input.image( width, height );
QImage qImg( image, width, height,
QImage::Format_RGBA8888, []( void* buf ){ delete[] (uchar*) buf; } );
auto qPix = QPixmap::fromImage( qImg );
// Use Qt::DirectConnection or the pixmap will be deleted!
emit imageReady( uuid, pos, qPix );
}
#ifndef THUMBNAILWORKER_H
#define THUMBNAILWORKER_H
#include <QObject>
class QPixmap;
class ThumbnailWorker : public QObject
{
Q_OBJECT
public:
explicit ThumbnailWorker( QObject* parent = 0 );
signals:
void imageReady( const QString& uuid, qint64 pos, const QPixmap& pixmap );
public slots:
void run( const QString& uuid, const QString& filePath, qint64 pos, quint32 width, quint32 height );
};
#endif // THUMBNAILWORKER_H
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