[vlmc-devel] commit: Workflow: When adding an effect, return its instance. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Wed Aug 25 00:40:13 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Aug 25 00:09:27 2010 +0200| [116530f8815f08086c753d5630e48f4e374a0387] | committer: Hugo Beauzée-Luyssen 

Workflow: When adding an effect, return its instance.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=116530f8815f08086c753d5630e48f4e374a0387
---

 src/Workflow/MainWorkflow.cpp  |    9 ++++-----
 src/Workflow/MainWorkflow.h    |    5 +++--
 src/Workflow/TrackHandler.cpp  |    4 ++--
 src/Workflow/TrackHandler.h    |    2 +-
 src/Workflow/TrackWorkflow.cpp |    5 +++--
 src/Workflow/TrackWorkflow.h   |    2 +-
 6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 3eea18e..d5f3c58 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -26,7 +26,6 @@
 #include "vlmc.h"
 #include "Clip.h"
 #include "ClipHelper.h"
-#include "EffectsEngine/EffectsEngine.h"
 #include "Library.h"
 #include "MainWorkflow.h"
 #include "TrackWorkflow.h"
@@ -82,10 +81,10 @@ MainWorkflow::addClip( ClipHelper *clipHelper, unsigned int trackId,
         emit clipAdded( clipHelper, trackId, start, trackType );
 }
 
-void
-MainWorkflow::addEffect( Effect *effect, quint32 trackId, const QUuid &uuid, Workflow::TrackType type )
+EffectsEngine::FilterHelper*
+MainWorkflow::addFilter( Effect *effect, quint32 trackId, const QUuid &uuid, Workflow::TrackType type )
 {
-    m_tracks[type]->addEffect( effect, trackId, uuid );
+    return m_tracks[type]->addEffect( effect, trackId, uuid );
 }
 
 void
@@ -344,7 +343,7 @@ MainWorkflow::loadProject( const QDomElement &root )
                     {
                         Effect  *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
                         if ( e != NULL )
-                            addEffect( e, trackId, uuid, type );
+                            addFilter( e, trackId, uuid, type );
                         else
                             qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
                     }
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index de599e4..c360e15 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -24,6 +24,7 @@
 #ifndef MAINWORKFLOW_H
 #define MAINWORKFLOW_H
 
+#include "EffectsEngine.h"
 #include "Singleton.hpp"
 #include <QXmlStreamWriter>
 #include "Types.h"
@@ -74,8 +75,8 @@ class   MainWorkflow : public QObject, public Singleton<MainWorkflow>
                                  Workflow::TrackType type, bool informGui );
 
 
-        void            addEffect( Effect* effect, quint32 trackId, const QUuid &uuid,
-                                   Workflow::TrackType type );
+        EffectsEngine::FilterHelper     *addFilter( Effect* effect, quint32 trackId,
+                                                    const QUuid &uuid, Workflow::TrackType type );
 
         /**
          *  \brief      Initialize the workflow for the render.
diff --git a/src/Workflow/TrackHandler.cpp b/src/Workflow/TrackHandler.cpp
index 6a8f2f9..0f1a6ab 100644
--- a/src/Workflow/TrackHandler.cpp
+++ b/src/Workflow/TrackHandler.cpp
@@ -59,10 +59,10 @@ TrackHandler::addClip( ClipHelper* ch, unsigned int trackId, qint64 start )
         m_length = m_tracks[trackId]->getLength();
 }
 
-void
+EffectsEngine::FilterHelper*
 TrackHandler::addEffect( Effect *effect, quint32 trackId, const QUuid &uuid )
 {
-    m_tracks[trackId]->addEffect( effect, uuid );
+    return m_tracks[trackId]->addEffect( effect, uuid );
 }
 
 void
diff --git a/src/Workflow/TrackHandler.h b/src/Workflow/TrackHandler.h
index 34671df..6056cf0 100644
--- a/src/Workflow/TrackHandler.h
+++ b/src/Workflow/TrackHandler.h
@@ -48,7 +48,7 @@ class   TrackHandler : public QObject
          */
         void            addClip( ClipHelper* clip, unsigned int trackId, qint64 start );
 
-        void            addEffect( Effect *effect, quint32 trackId, const QUuid &uuid );
+        EffectsEngine::FilterHelper     *addEffect( Effect *effect, quint32 trackId, const QUuid &uuid );
         /**
          *  Returns the number of tracks in this handler
          */
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index de8a899..39fd4e1 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -90,7 +90,7 @@ TrackWorkflow::addClip( ClipWorkflow* cw, qint64 start )
     computeLength();
 }
 
-void
+EffectsEngine::FilterHelper*
 TrackWorkflow::addEffect( Effect *effect, const QUuid &uuid )
 {
     QMap<qint64, ClipWorkflow*>::const_iterator     it = m_clips.begin();
@@ -99,9 +99,10 @@ TrackWorkflow::addEffect( Effect *effect, const QUuid &uuid )
     while ( it != end )
     {
         if ( it.value()->getClipHelper()->clip()->fullId() == uuid )
-            it.value()->appendEffect( effect );
+            return it.value()->appendEffect( effect );
         ++it;
     }
+    return NULL;
 }
 
 //Must be called from a thread safe method (m_clipsLock locked)
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index b7a431b..78bdcb1 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -59,7 +59,7 @@ class   TrackWorkflow : public QObject
         ClipWorkflow*                           removeClipWorkflow( const QUuid& id );
         void                                    addClip( ClipHelper*, qint64 start );
         void                                    addClip( ClipWorkflow*, qint64 start );
-        void                                    addEffect( Effect *effect, const QUuid &uuid );
+        EffectsEngine::FilterHelper             *addEffect( Effect *effect, const QUuid &uuid );
         qint64                                  getClipPosition( const QUuid& uuid ) const;
         ClipHelper                              *getClipHelper( const QUuid& uuid );
 



More information about the Vlmc-devel mailing list