[vlmc-devel] commit: WorkflowRenderer: Load effects from the project file. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri Jul 30 00:38:28 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Jul 30 00:28:46 2010 +0200| [600469665820076493d29823ae88b12ae3d46bd6] | committer: Hugo Beauzée-Luyssen 

WorkflowRenderer: Load effects from the project file.

Removed forgotten debug.

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

 src/Gui/timeline/Timeline.h        |    2 +-
 src/Project/ProjectManager.cpp     |    1 +
 src/Renderer/WorkflowRenderer.cpp  |   41 ++++++++++++++++++++++++++++++-----
 src/Renderer/WorkflowRenderer.h    |    2 +-
 src/Workflow/MainWorkflow.cpp      |    2 +-
 src/Workflow/VideoClipWorkflow.cpp |    1 -
 6 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/src/Gui/timeline/Timeline.h b/src/Gui/timeline/Timeline.h
index 200b334..74ea59b 100644
--- a/src/Gui/timeline/Timeline.h
+++ b/src/Gui/timeline/Timeline.h
@@ -54,7 +54,7 @@ public:
     TracksRuler*        tracksRuler() { return m_tracksRuler; }
     /// Return a pointer to the Timeline instance (singleton).
     static Timeline*    getInstance() { return m_instance; }
-    const WorkflowRenderer    *renderer() const { return m_renderer; }
+    WorkflowRenderer    *renderer() { return m_renderer; }
 
     void                save( QXmlStreamWriter& project ) const;
     void                load( const QDomElement &root );
diff --git a/src/Project/ProjectManager.cpp b/src/Project/ProjectManager.cpp
index 13e75c3..b47059a 100644
--- a/src/Project/ProjectManager.cpp
+++ b/src/Project/ProjectManager.cpp
@@ -150,6 +150,7 @@ ProjectManager::loadProject( const QString& fileName )
     //Load settings first, as it contains some informations about the workspace.
     SettingsManager::getInstance()->load( root );
     SettingsManager::getInstance()->setValue( "general/Workspace", fInfo.absolutePath(), SettingsManager::Project );
+    Timeline::getInstance()->renderer()->loadProject( root );
     Library::getInstance()->loadProject( root );
 }
 
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index a3b4047..5d19693 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -20,12 +20,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <QtDebug>
-#include <QThread>
-#include <QWaitCondition>
 //Allow PRId64 to be defined:
 #define __STDC_FORMAT_MACROS
-#include <inttypes.h>
+
+#include "WorkflowRenderer.h"
 
 #include "Clip.h"
 #include "EffectInstance.h"
@@ -34,10 +32,15 @@
 #include "SettingsManager.h"
 #include "VLCMedia.h"
 #include "VLCMediaPlayer.h"
-#include "WorkflowRenderer.h"
 #include "Workflow/Types.h"
 #include "timeline/Timeline.h"
 
+#include <QDomElement>
+#include <QtDebug>
+#include <QThread>
+#include <QWaitCondition>
+#include <inttypes.h>
+
 WorkflowRenderer::WorkflowRenderer() :
             m_mainWorkflow( MainWorkflow::getInstance() ),
             m_media( NULL ),
@@ -391,7 +394,6 @@ void
 WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
 {
     EffectInstance  *effectInstance = effect->createInstance();
-    qDebug() << "width:" << m_width << m_height;
     QWriteLocker    lock( m_effectsLock );
     m_effects.push_back( new EffectsEngine::EffectHelper( effectInstance, start, end ) );
 }
@@ -407,6 +409,33 @@ WorkflowRenderer::saveProject( QXmlStreamWriter &project ) const
     project.writeEndElement();
 }
 
+void
+WorkflowRenderer::loadProject( const QDomElement &project )
+{
+    QDomElement     renderer = project.firstChildElement( "renderer" );
+    if ( renderer.isNull() == true )
+        return ;
+    QDomElement     effects = renderer.firstChildElement( "effects" );
+    if ( effects.isNull() == true )
+        return ;
+    QDomElement     effect = effects.firstChildElement( "effect" );
+    while ( effect.isNull() == false )
+    {
+        if ( effect.hasAttribute( "name" ) == true &&
+             effect.hasAttribute( "start" ) == true &&
+             effect.hasAttribute( "end" ) == true )
+        {
+            Effect  *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
+            if ( e != NULL )
+                appendEffect( e, effect.attribute( "start" ).toLongLong(),
+                              effect.attribute( "end" ).toLongLong() );
+            else
+                qCritical() << "Renderer: Can't load effect" << effect.attribute( "name" );
+        }
+        effect = effect.nextSibling().toElement();
+    }
+}
+
 /////////////////////////////////////////////////////////////////////
 /////SLOTS :
 /////////////////////////////////////////////////////////////////////
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index 85e84ed..b93a6d3 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -134,7 +134,7 @@ class   WorkflowRenderer : public GenericRenderer
         void                appendEffect( Effect* effect, qint64 start = 0, qint64 end = -1 );
 
         void                saveProject( QXmlStreamWriter &project ) const;
-
+        void                loadProject( const QDomElement& project );
     private:
         /**
          *  \brief          This is a subpart of the togglePlayPause( bool ) method
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index ebc44a3..b0f8b90 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -361,7 +361,7 @@ MainWorkflow::loadProject( const QDomElement &root )
                         if ( e != NULL )
                             addEffect( e, trackId, uuid, type );
                         else
-                            qCritical() << "Can't load effect" << effect.attribute( "name" );
+                            qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
                     }
                     effect = effect.nextSibling().toElement();
                 }
diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
index 9f1036c..ef4de1a 100644
--- a/src/Workflow/VideoClipWorkflow.cpp
+++ b/src/Workflow/VideoClipWorkflow.cpp
@@ -212,7 +212,6 @@ VideoClipWorkflow::flushComputedBuffers()
 bool
 VideoClipWorkflow::appendEffect( Effect *effect, qint64 start, qint64 end )
 {
-    qDebug() << "Adding effect:" << effect;
     if ( effect->type() != Effect::Filter )
     {
         qWarning() << "VideoClipWorkflow does not handle non filter effects.";



More information about the Vlmc-devel mailing list