[vlmc-devel] commit: VideoClipWorkflow: Save the effects to the project file. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Wed Jul 28 00:22:10 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Jul 28 00:12:51 2010 +0200| [37cf34be90bf45d0697ff263f006f83c2982420c] | committer: Hugo Beauzée-Luyssen 

VideoClipWorkflow: Save the effects to the project file.

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

 src/EffectsEngine/EffectInstance.cpp |    4 ++--
 src/EffectsEngine/EffectInstance.h   |    2 +-
 src/Workflow/ClipWorkflow.h          |    4 ++++
 src/Workflow/VideoClipWorkflow.cpp   |   21 +++++++++++++++++++++
 src/Workflow/VideoClipWorkflow.h     |    1 +
 5 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/EffectsEngine/EffectInstance.cpp b/src/EffectsEngine/EffectInstance.cpp
index edef16e..1007432 100644
--- a/src/EffectsEngine/EffectInstance.cpp
+++ b/src/EffectsEngine/EffectInstance.cpp
@@ -55,8 +55,8 @@ EffectInstance::process( double time, const quint32 *input, quint32 *output ) co
     m_effect->m_f0r_update( m_instance, time, input, output );
 }
 
-const Effect*
-EffectInstance::effect() const
+Effect*
+EffectInstance::effect()
 {
     return m_effect;
 }
diff --git a/src/EffectsEngine/EffectInstance.h b/src/EffectsEngine/EffectInstance.h
index 8a75fcd..3ffed25 100644
--- a/src/EffectsEngine/EffectInstance.h
+++ b/src/EffectsEngine/EffectInstance.h
@@ -33,7 +33,7 @@ class EffectInstance
     public:
         void            init( quint32 width, quint32 height );
         void            process( double time, const quint32* input, quint32* output ) const;
-        const Effect*   effect() const;
+        Effect*         effect();
 
     private:
         EffectInstance( Effect *effect );
diff --git a/src/Workflow/ClipWorkflow.h b/src/Workflow/ClipWorkflow.h
index 17cc96f..42aeb24 100644
--- a/src/Workflow/ClipWorkflow.h
+++ b/src/Workflow/ClipWorkflow.h
@@ -198,6 +198,10 @@ class   ClipWorkflow : public QObject
         void                    stopRenderer();
 
         void                    save( QXmlStreamWriter& project ) const;
+        virtual void            saveEffects( QXmlStreamWriter& ) const
+        {
+            //Empty implementation, as some clipworkflow does not have effects for now.
+        }
 
     private:
         void                    setState( State state );
diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
index e5737b9..ccfd973 100644
--- a/src/Workflow/VideoClipWorkflow.cpp
+++ b/src/Workflow/VideoClipWorkflow.cpp
@@ -222,6 +222,27 @@ VideoClipWorkflow::appendEffect( Effect *effect, qint64 start, qint64 end )
 }
 
 void
+VideoClipWorkflow::saveEffects( QXmlStreamWriter &project ) const
+{
+    QReadLocker lock( m_effectsLock );
+    if ( m_effects.size() <= 0 )
+        return ;
+    EffectsEngine::EffectList::const_iterator   it = m_effects.begin();
+    EffectsEngine::EffectList::const_iterator   ite = m_effects.end();
+    project.writeStartElement( "effects" );
+    while ( it != ite )
+    {
+        project.writeStartElement( "effect" );
+        project.writeAttribute( "name", (*it)->effect->effect()->name() );
+        project.writeAttribute( "start", QString::number( (*it)->start ) );
+        project.writeAttribute( "end", QString::number( (*it)->end ) );
+        project.writeEndElement();
+        ++it;
+    }
+    project.writeEndElement();
+}
+
+void
 VideoClipWorkflow::setTime( qint64 time )
 {
     {
diff --git a/src/Workflow/VideoClipWorkflow.h b/src/Workflow/VideoClipWorkflow.h
index 09d9079..76ec5bf 100644
--- a/src/Workflow/VideoClipWorkflow.h
+++ b/src/Workflow/VideoClipWorkflow.h
@@ -54,6 +54,7 @@ class   VideoClipWorkflow : public ClipWorkflow
         virtual void            *getOutput( ClipWorkflow::GetMode mode );
         virtual bool            appendEffect( Effect *effect, qint64 start = 0, qint64 end = -1 );
         virtual void            setTime( qint64 time );
+        virtual void            saveEffects( QXmlStreamWriter &project ) const;
 
         static const quint32    nbBuffers = 3 * 30; //3 seconds with an average fps of 30
 



More information about the Vlmc-devel mailing list