[vlmc-devel] Workflow: Imeplement addEffect

Yikai Lu git at videolan.org
Thu Jul 28 14:39:20 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Jul 28 18:01:00 2016 +0900| [8b6524ed707025dc7ca4654118addf066ac8f99b] | committer: Yikai Lu

Workflow: Imeplement addEffect

> https://code.videolan.org/videolan/vlmc/commit/8b6524ed707025dc7ca4654118addf066ac8f99b
---

 src/Workflow/MainWorkflow.cpp | 27 +++++++++++++++++++++++++++
 src/Workflow/MainWorkflow.h   |  3 +++
 2 files changed, 30 insertions(+)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 41caab8..88f5a84 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -30,6 +30,7 @@
 #include "Backend/MLT/MLTMultiTrack.h"
 #include "Backend/MLT/MLTTrack.h"
 #include "Renderer/AbstractRenderer.h"
+#include "EffectsEngine/EffectHelper.h"
 #ifdef WITH_GUI
 #include "Gui/WorkflowFileRendererDialog.h"
 #endif
@@ -304,6 +305,32 @@ MainWorkflow::linkClips( const QString& uuidA, const QString& uuidB )
                 }
 }
 
+QString
+MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId )
+{
+    EffectHelper* newEffect = nullptr;
+
+    try
+    {
+        newEffect = new EffectHelper( effectId );
+    }
+    catch( Backend::InvalidServiceException& e )
+    {
+        return QStringLiteral( "" );
+    }
+
+    for ( auto clip : m_clips )
+        if ( clip->uuid().toString() == clipUuid )
+        {
+            Commands::trigger( new Commands::Effect::Add(
+                                   std::shared_ptr<EffectHelper>( newEffect ), clip->input() )
+                               );
+            return newEffect->uuid().toString();
+        }
+
+    return QStringLiteral( "" );
+}
+
 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 f7a5400..8bc5169 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -161,6 +161,9 @@ class   MainWorkflow : public QObject
         Q_INVOKABLE
         void                    linkClips( const QString& uuidA, const QString& uuidB );
 
+        Q_INVOKABLE
+        QString                 addEffect( const QString& clipUuid, const QString& effectId );
+
         bool                    startRenderToFile( const QString& outputFileName, quint32 width, quint32 height,
                                                    double fps, const QString& ar, quint32 vbitrate, quint32 abitrate,
                                                    quint32 nbChannels, quint32 sampleRate );



More information about the Vlmc-devel mailing list