[vlmc-devel] commit: Store the ClipWorkflow inside the ClipHelper ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Aug 26 23:03:07 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Aug 26 00:25:32 2010 +0200| [cc3bdb656a623fe1bfe78d2548fe241fe1aa4da7] | committer: Hugo Beauzée-Luyssen 

Store the ClipWorkflow inside the ClipHelper

This will ease effect related stuff.

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

 src/Workflow/ClipHelper.cpp    |   19 ++++++++++++++++---
 src/Workflow/ClipHelper.h      |   12 ++++++++----
 src/Workflow/MainWorkflow.cpp  |   34 ++++++++++++++++++----------------
 src/Workflow/TrackWorkflow.cpp |    1 +
 4 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/src/Workflow/ClipHelper.cpp b/src/Workflow/ClipHelper.cpp
index 83b8851..07d716f 100644
--- a/src/Workflow/ClipHelper.cpp
+++ b/src/Workflow/ClipHelper.cpp
@@ -26,9 +26,10 @@
 
 ClipHelper::ClipHelper( Clip* clip, qint64 begin /*= -1*/, qint64 end /*= -1*/,
                         const QString& uuid /*= QString()*/ ) :
-        m_clip( clip ),
-        m_begin( begin ),
-        m_end( end )
+    m_clip( clip ),
+    m_begin( begin ),
+    m_end( end ),
+    m_clipWorkflow( NULL )
 {
     if ( begin == -1 )
         m_begin = clip->begin();
@@ -73,3 +74,15 @@ ClipHelper::length() const
 {
     return m_end - m_begin;
 }
+
+ClipWorkflow*
+ClipHelper::clipWorkflow()
+{
+    return m_clipWorkflow;
+}
+
+void
+ClipHelper::setClipWorkflow( ClipWorkflow* cw )
+{
+    m_clipWorkflow = cw;
+}
diff --git a/src/Workflow/ClipHelper.h b/src/Workflow/ClipHelper.h
index e7b4203..52d4643 100644
--- a/src/Workflow/ClipHelper.h
+++ b/src/Workflow/ClipHelper.h
@@ -24,6 +24,7 @@
 #define CLIPHELPER_H
 
 class   Clip;
+class   ClipWorkflow;
 
 #include <QObject>
 #include <QUuid>
@@ -60,12 +61,15 @@ class   ClipHelper : public QObject
         {
             return m_uuid;
         }
+        ClipWorkflow    *clipWorkflow();
+        void            setClipWorkflow( ClipWorkflow* cw );
 
     private:
-        Clip*       m_clip;
-        qint64      m_begin;
-        qint64      m_end;
-        QUuid       m_uuid;
+        Clip*           m_clip;
+        qint64          m_begin;
+        qint64          m_end;
+        QUuid           m_uuid;
+        ClipWorkflow*   m_clipWorkflow;
 
     signals:
         void        lengthUpdated();
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index e819684..b6d0a61 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -26,6 +26,7 @@
 #include "vlmc.h"
 #include "Clip.h"
 #include "ClipHelper.h"
+#include "ClipWorkflow.h"
 #include "Library.h"
 #include "MainWorkflow.h"
 #include "TrackWorkflow.h"
@@ -329,28 +330,29 @@ MainWorkflow::loadProject( const QDomElement &root )
                 ClipHelper  *ch = new ClipHelper( c, begin.toLongLong(),
                                                   end.toLongLong(), chUuid );
                 addClip( ch, trackId, startFrame.toLongLong(), type, true );
-            }
 
-            QDomElement     effects = clip.firstChildElement( "effects" );
-            if ( effects.isNull() == false )
-            {
-                QDomElement effect = effects.firstChildElement( "effect" );
-                while ( effect.isNull() == false )
+                QDomElement     effects = clip.firstChildElement( "effects" );
+                if ( effects.isNull() == false )
                 {
-                    if ( effect.hasAttribute( "name" ) == true &&
-                         effect.hasAttribute( "start" ) == true &&
-                         effect.hasAttribute( "end" ) == true )
+                    QDomElement effect = effects.firstChildElement( "effect" );
+                    while ( effect.isNull() == false )
                     {
-                        Effect  *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
-                        if ( e != NULL )
-                            addEffect( e, trackId, uuid, type );
-                        else
-                            qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
+                        if ( effect.hasAttribute( "name" ) == true &&
+                             effect.hasAttribute( "start" ) == true &&
+                             effect.hasAttribute( "end" ) == true )
+                        {
+                            Effect  *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
+                            qint64  start = effect.attribute( "start" ).toLongLong();
+                            qint64  end = effect.attribute( "end" ).toLongLong();
+                            if ( e != NULL )
+                                ch->clipWorkflow()->appendEffect( e, start, end );
+                            else
+                                qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
+                        }
+                        effect = effect.nextSiblingElement();
                     }
-                    effect = effect.nextSiblingElement();
                 }
             }
-
             clip = clip.nextSiblingElement();
         }
         elem = elem.nextSiblingElement();
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index 43418d5..2192b26 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -79,6 +79,7 @@ TrackWorkflow::addClip( ClipHelper* ch, qint64 start )
     }
     else
         cw = new AudioClipWorkflow( ch );
+    ch->setClipWorkflow( cw );
     addClip( cw, start );
 }
 



More information about the Vlmc-devel mailing list