[vlmc-devel] ThumbnailWorker: Fix emitting a wrong position

Yikai Lu git at videolan.org
Mon Aug 22 05:50:27 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Aug 21 22:49:34 2016 -0500| [46cadb56fe77654f3e302ec48269f82cd39c9a4c] | committer: Yikai Lu

ThumbnailWorker: Fix emitting a wrong position

> https://code.videolan.org/videolan/vlmc/commit/46cadb56fe77654f3e302ec48269f82cd39c9a4c
---

 src/Workflow/MainWorkflow.cpp    | 2 +-
 src/Workflow/ThumbnailWorker.cpp | 6 +++++-
 src/Workflow/ThumbnailWorker.h   | 5 ++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index d265e38..d7ac322 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -304,7 +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->begin(), pos, clip->input()->width(),
                                        clip->input()->height() );
     auto t = new QThread;
     worker->moveToThread( t );
diff --git a/src/Workflow/ThumbnailWorker.cpp b/src/Workflow/ThumbnailWorker.cpp
index 9635f4c..923cda7 100644
--- a/src/Workflow/ThumbnailWorker.cpp
+++ b/src/Workflow/ThumbnailWorker.cpp
@@ -5,10 +5,13 @@
 
 #include "Backend/MLT/MLTInput.h"
 
-ThumbnailWorker::ThumbnailWorker( const QString& uuid, const QString& filePath, qint64 pos, quint32 width, quint32 height, QObject* parent )
+ThumbnailWorker::ThumbnailWorker( const QString& uuid, const QString& filePath,
+                                  qint64 begin, 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 )
@@ -20,6 +23,7 @@ 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,
diff --git a/src/Workflow/ThumbnailWorker.h b/src/Workflow/ThumbnailWorker.h
index 7c32bc5..ab302aa 100644
--- a/src/Workflow/ThumbnailWorker.h
+++ b/src/Workflow/ThumbnailWorker.h
@@ -9,7 +9,9 @@ class ThumbnailWorker : public QObject
 {
     Q_OBJECT
 public:
-    explicit ThumbnailWorker( const QString& uuid, const QString& filePath, qint64 pos, quint32 width, quint32 height , QObject* parent = 0 );
+    explicit ThumbnailWorker( const QString& uuid, const QString& filePath,
+                              qint64 begin, qint64 pos, quint32 width,
+                              quint32 height , QObject* parent = 0 );
 
 signals:
     void    imageReady( const QString& uuid, qint64 pos, const QPixmap& pixmap );
@@ -20,6 +22,7 @@ public slots:
 private:
     QString     m_uuid;
     QString     m_filePath;
+    qint64      m_begin;
     qint64      m_pos;
     quint32     m_width;
     quint32     m_height;



More information about the Vlmc-devel mailing list