[vlmc-devel] commit: WorkflowRenderer: Initialize the effects at the right time. ( Hugo Beauzée-Luyssen )

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


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Jul 30 00:01:34 2010 +0200| [5c3a501a3b180e8553acb47bc002e6172411e0a4] | committer: Hugo Beauzée-Luyssen 

WorkflowRenderer: Initialize the effects at the right time.

Fixes a crash when starting the playback.

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

 src/EffectsEngine/EffectsEngine.cpp |   13 +++++++++++++
 src/EffectsEngine/EffectsEngine.h   |    1 +
 src/Renderer/WorkflowRenderer.cpp   |    4 +++-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/EffectsEngine/EffectsEngine.cpp b/src/EffectsEngine/EffectsEngine.cpp
index 5fd69c2..e7c5e00 100644
--- a/src/EffectsEngine/EffectsEngine.cpp
+++ b/src/EffectsEngine/EffectsEngine.cpp
@@ -179,3 +179,16 @@ EffectsEngine::saveEffects( const EffectList &effects, QXmlStreamWriter &project
     }
     project.writeEndElement();
 }
+
+void
+EffectsEngine::initEffects( const EffectList &effects, quint32 width, quint32 height )
+{
+    EffectsEngine::EffectList::const_iterator   it = effects.begin();
+    EffectsEngine::EffectList::const_iterator   ite = effects.end();
+
+    while ( it != ite )
+    {
+        (*it)->effect->init( width, height );
+        ++it;
+    }
+}
diff --git a/src/EffectsEngine/EffectsEngine.h b/src/EffectsEngine/EffectsEngine.h
index 70adbdb..558d292 100644
--- a/src/EffectsEngine/EffectsEngine.h
+++ b/src/EffectsEngine/EffectsEngine.h
@@ -56,6 +56,7 @@ class   EffectsEngine : public QObject, public Singleton<EffectsEngine>
         static void applyEffects( const EffectList &effects,
                                   Workflow::Frame *frame, qint64 currentFrame );
         static void saveEffects( const EffectList &effects, QXmlStreamWriter &project );
+        static void initEffects( const EffectList &effects, quint32 width, quint32 height );
 
     private:
         EffectsEngine();
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index 00142a0..573792c 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -117,6 +117,8 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
     sprintf( buffer, ":imem-data=%"PRId64, (intptr_t)m_esHandler );
     m_media->addOption( buffer );
     m_media->addOption( ":text-renderer dummy" );
+
+    EffectsEngine::initEffects( m_effects, width, height );
 }
 
 int
@@ -388,7 +390,7 @@ void
 WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
 {
     EffectInstance  *effectInstance = effect->createInstance();
-    effectInstance->init( m_width, m_height );
+    qDebug() << "width:" << m_width << m_height;
     QWriteLocker    lock( m_effectsLock );
     m_effects.push_back( new EffectsEngine::EffectHelper( effectInstance, start, end ) );
 }



More information about the Vlmc-devel mailing list