[vlmc-devel] MainWorkflow: Implement takeThumbnail

Yikai Lu git at videolan.org
Tue Aug 16 03:37:05 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Aug 15 20:23:41 2016 -0500| [76f98d82d620f1296208339639176858758adcae] | committer: Yikai Lu

MainWorkflow: Implement takeThumbnail

> https://code.videolan.org/videolan/vlmc/commit/76f98d82d620f1296208339639176858758adcae
---

 src/Workflow/MainWorkflow.cpp | 12 ++++++++++++
 src/Workflow/MainWorkflow.h   |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 8b3b9ca..4e4ca0f 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -50,6 +50,7 @@
 #include "Tools/RendererEventWatcher.h"
 #include "Tools/OutputEventWatcher.h"
 #include "Workflow/Types.h"
+#include "ThumbnailWorker.h"
 
 #include <QMutex>
 
@@ -298,6 +299,17 @@ MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId )
     return QStringLiteral( "" );
 }
 
+void
+MainWorkflow::takeThumbnail( const QString& uuid, quint32 pos )
+{
+    ThumbnailWorker worker;
+    connect( &worker, &ThumbnailWorker::imageReady, this, &MainWorkflow::thumbnailUpdated, Qt::DirectConnection );
+    auto clip = m_sequenceWorkflow->clip( uuid );
+    worker.run( uuid, clip->media()->fileInfo()->absoluteFilePath(),
+                clip->begin() + pos, clip->input()->width(),
+                clip->input()->height() );
+}
+
 bool
 MainWorkflow::startRenderToFile( const QString &outputFileName, quint32 width, quint32 height,
                                  double fps, const QString &ar, quint32 vbitrate, quint32 abitrate,
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index 6d8429c..dc03677 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -153,6 +153,9 @@ class   MainWorkflow : public QObject
         Q_INVOKABLE
         QString                 addEffect( const QString& clipUuid, const QString& effectId );
 
+        Q_INVOKABLE
+        void                    takeThumbnail( const QString& uuid, quint32 pos );
+
         bool                    startRenderToFile( const QString& outputFileName, quint32 width, quint32 height,
                                                    double fps, const QString& ar, quint32 vbitrate, quint32 abitrate,
                                                    quint32 nbChannels, quint32 sampleRate );
@@ -258,6 +261,8 @@ class   MainWorkflow : public QObject
         void                    clipUnlinked( const QString& uuidA, const QString& uuidB );
 
         void                    effectsUpdated( const QString& clipUuid );
+
+        void                    thumbnailUpdated( const QString& uuid, quint32 pos, const QPixmap& pixmap );
 };
 
 #endif // MAINWORKFLOW_H



More information about the Vlmc-devel mailing list