[vlmc-devel] commit: Effects: Clean things up a bit. ( Hugo Beauzée-Luyssen )

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


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Jul 27 20:55:00 2010 +0200| [075622d2e8c36f76c068296338d87f301db937de] | committer: Hugo Beauzée-Luyssen 

Effects: Clean things up a bit.

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

 src/EffectsEngine/Effect.cpp        |   18 ++----------------
 src/EffectsEngine/Effect.h          |    2 --
 src/EffectsEngine/EffectsEngine.cpp |    7 -------
 src/EffectsEngine/EffectsEngine.h   |    1 -
 src/Gui/MainWindow.cpp              |    3 +--
 src/Renderer/WorkflowRenderer.cpp   |    1 -
 src/Workflow/MainWorkflow.cpp       |    1 -
 src/Workflow/VideoClipWorkflow.cpp  |    1 -
 8 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/src/EffectsEngine/Effect.cpp b/src/EffectsEngine/Effect.cpp
index 330e3cc..7cef0f3 100644
--- a/src/EffectsEngine/Effect.cpp
+++ b/src/EffectsEngine/Effect.cpp
@@ -36,9 +36,9 @@ Effect::Effect( const QString &fileName ) :
 
 Effect::~Effect()
 {
+    m_f0r_deinit();
     if ( m_instance != NULL )
     {
-        m_f0r_deinit();
         m_f0r_destruct( m_instance );
     }
 }
@@ -63,6 +63,7 @@ Effect::load()
     //Initializing structures
     f0r_plugin_info_t   infos;
 
+    m_f0r_init();
     m_f0r_info( &infos );
     m_name = infos.name;
     m_desc = infos.explanation;
@@ -93,18 +94,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 )
-        {
-            m_f0r_deinit();
-            m_f0r_destruct( m_instance );
-        }
         m_instance = m_f0r_construct( width, height );
-        m_f0r_init();
         m_width = width;
         m_height = height;
     }
@@ -115,9 +107,3 @@ 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 22ee025..aae4df9 100644
--- a/src/EffectsEngine/Effect.h
+++ b/src/EffectsEngine/Effect.h
@@ -48,7 +48,6 @@ class Effect : public QLibrary
         Effect( const QString& fileName );
         virtual ~Effect();
 
-        void            setUsed( bool used );
         bool            load();
         const QString&  name() const;
         const QString&  description() const;
@@ -69,7 +68,6 @@ class Effect : public QLibrary
         quint32         m_width;
         quint32         m_height;
         Type            m_type;
-        bool            m_used;
 };
 
 #endif // EFFECT_H
diff --git a/src/EffectsEngine/EffectsEngine.cpp b/src/EffectsEngine/EffectsEngine.cpp
index 08b2e36..36778f7 100644
--- a/src/EffectsEngine/EffectsEngine.cpp
+++ b/src/EffectsEngine/EffectsEngine.cpp
@@ -48,13 +48,6 @@ EffectsEngine::EffectHelper::EffectHelper( Effect *_effect, qint64 _start, qint6
         uuid = _uuid;
 }
 
-void
-EffectsEngine::initAll( quint32 width, quint32 height )
-{
-    foreach ( Effect *e, m_effects )
-        e->init( width, height );
-}
-
 Effect*
 EffectsEngine::effect( const QString& name )
 {
diff --git a/src/EffectsEngine/EffectsEngine.h b/src/EffectsEngine/EffectsEngine.h
index cf2be67..82256a2 100644
--- a/src/EffectsEngine/EffectsEngine.h
+++ b/src/EffectsEngine/EffectsEngine.h
@@ -47,7 +47,6 @@ class   EffectsEngine : public QObject, public Singleton<EffectsEngine>
         };
         typedef QList<EffectHelper*>    EffectList;
 
-        void        initAll( quint32 width, quint32 height );
         Effect*     effect( const QString& name );
         bool        loadEffect( const QString& fileName );
         void        browseDirectory( const QString& path );
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index e0b8640..9b02c3b 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -427,13 +427,12 @@ MainWindow::initializeDockWidgets( void )
 {
     DockWidgetManager *dockManager = DockWidgetManager::getInstance();
 
-    //FIXME !!!
     EffectsList *effectsList = new EffectsList( this );
     dockManager->addDockedWidget( effectsList,
                                   QT_TRANSLATE_NOOP( "DockWidgetManager", "Effects List" ),
                                   Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures,
                                   Qt::LeftDockWidgetArea );
-
+    //FIXME !!!
     EffectsEngine::getInstance()->browseDirectory( "/usr/local/frei0r/lib/" );
 
     m_renderer = new WorkflowRenderer();
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index b533f5d..028117d 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -386,7 +386,6 @@ WorkflowRenderer::paramsHasChanged( quint32 width, quint32 height, double fps )
 void
 WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
 {
-    effect->setUsed( true );
     effect->init( m_width, m_height );
     QWriteLocker    lock( m_effectsLock );
     m_effects.push_back( new EffectsEngine::EffectHelper( effect, start, end ) );
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 10ee0a9..e4fdc2f 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -106,7 +106,6 @@ void
 MainWorkflow::startRender( quint32 width, quint32 height )
 {
     //Reinit the effects in case the width/height has change
-    EffectsEngine::getInstance()->initAll( width, height );
     m_renderStarted = true;
     m_width = width;
     m_height = height;
diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
index 833cce6..bd5855f 100644
--- a/src/Workflow/VideoClipWorkflow.cpp
+++ b/src/Workflow/VideoClipWorkflow.cpp
@@ -213,7 +213,6 @@ VideoClipWorkflow::appendEffect( Effect *effect, qint64 start, qint64 end )
         qWarning() << "VideoClipWorkflow does not handle non filter effects.";
         return false;
     }
-    effect->setUsed( true );
     effect->init( m_width, m_height );
     QWriteLocker    lock( m_effectsLock );
     m_effects.push_back( new EffectsEngine::EffectHelper( effect, start, end ) );



More information about the Vlmc-devel mailing list