Commit 75ef793c authored by luyikei's avatar luyikei

ThumbnailWorker: Take an absolute position of a clip

parent 46cadb56
......@@ -189,10 +189,10 @@ Rectangle {
if ( uuid === "videoUuid" || uuid === "audioUuid" )
return;
if ( thumbnailProvider.hasImage( uuid, 0 ) )
updateThumbnail( 0 );
if ( thumbnailProvider.hasImage( uuid, begin ) )
updateThumbnail( begin );
else
workflow.takeThumbnail( uuid, 0 );
workflow.takeThumbnail( uuid, begin );
}
Component.onDestruction: {
......
......@@ -650,7 +650,7 @@ Rectangle {
target: thumbnailProvider
onImageReady: {
var clipItem = findClipItem( uuid );
clipItem.updateThumbnail( 0 );
clipItem.updateThumbnail( clipItem.begin );
}
}
}
......
......@@ -304,8 +304,7 @@ MainWorkflow::takeThumbnail( const QString& uuid, quint32 pos )
{
auto clip = m_sequenceWorkflow->clip( uuid );
auto worker = new ThumbnailWorker( uuid, clip->media()->fileInfo()->absoluteFilePath(),
clip->begin(), pos, clip->input()->width(),
clip->input()->height() );
pos, clip->input()->width(), clip->input()->height() );
auto t = new QThread;
worker->moveToThread( t );
connect( t, &QThread::started, worker, &ThumbnailWorker::run );
......
......@@ -6,12 +6,10 @@
#include "Backend/MLT/MLTInput.h"
ThumbnailWorker::ThumbnailWorker( const QString& uuid, const QString& filePath,
qint64 begin, qint64 pos, quint32 width,
quint32 height, QObject* parent )
qint64 pos, quint32 width, quint32 height, QObject* parent )
: QObject( parent )
, m_uuid( uuid )
, m_filePath( filePath )
, m_begin( begin )
, m_pos( pos )
, m_width( width )
, m_height( height )
......@@ -23,7 +21,6 @@ void
ThumbnailWorker::run()
{
Backend::MLT::MLTInput input( qPrintable( m_filePath ) );
input.setBegin( m_begin );
input.setPosition( m_pos );
auto image = input.image( m_width, m_height );
QImage qImg( image, m_width, m_height,
......
......@@ -10,8 +10,7 @@ class ThumbnailWorker : public QObject
Q_OBJECT
public:
explicit ThumbnailWorker( const QString& uuid, const QString& filePath,
qint64 begin, qint64 pos, quint32 width,
quint32 height , QObject* parent = 0 );
qint64 pos, quint32 width, quint32 height , QObject* parent = 0 );
signals:
void imageReady( const QString& uuid, qint64 pos, const QPixmap& pixmap );
......@@ -22,7 +21,6 @@ public slots:
private:
QString m_uuid;
QString m_filePath;
qint64 m_begin;
qint64 m_pos;
quint32 m_width;
quint32 m_height;
......
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