[vlmc-devel] commit: Effects: Don't init an effect when it is unused. ( Hugo Beauzée-Luyssen )

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


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Jul 26 13:01:30 2010 +0200| [21ee39e1a90560b3bf3fe25d661ea810756c8c96] | committer: Hugo Beauzée-Luyssen 

Effects: Don't init an effect when it is unused.

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

 src/EffectsEngine/Effect.cpp      |    9 +++++++++
 src/EffectsEngine/Effect.h        |    2 ++
 src/Gui/MainWindow.cpp            |    2 +-
 src/Renderer/WorkflowRenderer.cpp |    1 +
 4 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/EffectsEngine/Effect.cpp b/src/EffectsEngine/Effect.cpp
index 3464456..330e3cc 100644
--- a/src/EffectsEngine/Effect.cpp
+++ b/src/EffectsEngine/Effect.cpp
@@ -93,6 +93,9 @@ Effect::type() const
 void
 Effect::init( quint32 width, quint32 height )
 {
+    //Don't init if the effect is not currently used.
+    if ( m_used == false )
+        return ;
     if ( width != m_width || height != m_height )
     {
         if ( m_instance != NULL )
@@ -112,3 +115,9 @@ Effect::process( double time, const quint32 *input, quint32 *output ) const
 {
     m_f0r_update( m_instance, time, input, output );
 }
+
+void
+Effect::setUsed( bool used )
+{
+    m_used = used;
+}
diff --git a/src/EffectsEngine/Effect.h b/src/EffectsEngine/Effect.h
index aae4df9..22ee025 100644
--- a/src/EffectsEngine/Effect.h
+++ b/src/EffectsEngine/Effect.h
@@ -48,6 +48,7 @@ class Effect : public QLibrary
         Effect( const QString& fileName );
         virtual ~Effect();
 
+        void            setUsed( bool used );
         bool            load();
         const QString&  name() const;
         const QString&  description() const;
@@ -68,6 +69,7 @@ class Effect : public QLibrary
         quint32         m_width;
         quint32         m_height;
         Type            m_type;
+        bool            m_used;
 };
 
 #endif // EFFECT_H
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 72ae83e..a9af970 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -426,7 +426,7 @@ void
 MainWindow::initializeDockWidgets( void )
 {
     //FIXME !!!
-    EffectsEngine::getInstance()->browseDirectory( "/usr/lib/frei0r-1" );
+    EffectsEngine::getInstance()->browseDirectory( "/usr/local/frei0r/lib/" );
 
     m_renderer = new WorkflowRenderer();
     m_renderer->initializeRenderer();
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index a6989b9..abb1ad3 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -429,6 +429,7 @@ WorkflowRenderer::paramsHasChanged( quint32 width, quint32 height, double fps )
 void
 WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
 {
+    effect->setUsed( true );
     m_effects.push_back( new EffectsEngine::EffectHelper( effect, start, end ) );
 }
 



More information about the Vlmc-devel mailing list