Commit 075622d2 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Effects: Clean things up a bit.

parent c14bb4cc
......@@ -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;
}
......@@ -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
......@@ -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 )
{
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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 ) );
......
......@@ -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;
......
......@@ -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 ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment