Commit 4676be87 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EffectUser: Add support for adding ClipHelper.

Adding a signal when adding an effect.
parent c16cf1e3
......@@ -40,6 +40,7 @@ EffectUser::EffectUser() :
EffectUser::~EffectUser()
{
cleanEffects();
delete m_effectsLock;
}
......@@ -48,19 +49,24 @@ EffectUser::addEffect( Effect *effect, qint64 start /*= 0*/, qint64 end /*= -1*/
{
//FIXME: Check it the effect type is supported
EffectInstance *effectInstance = effect->createInstance();
if ( m_isRendering == true )
effectInstance->init( m_width, m_height );
EffectHelper *ret = new EffectHelper( effectInstance, start, end );
addEffect( ret );
return ret;
}
void
EffectUser::addEffect( EffectHelper *effectHelper )
{
if ( m_isRendering == true )
effectHelper->effectInstance()->init( m_width, m_height );
QWriteLocker lock( m_effectsLock );
if ( effect->type() == Effect::Filter )
m_filters.push_back( ret );
if ( effectHelper->effectInstance()->effect()->type() == Effect::Filter )
m_filters.push_back( effectHelper );
else
m_mixers.push_back( ret );
return ret;
m_mixers.push_back( effectHelper );
emit effectAdded( effectHelper );
}
quint32*
EffectUser::applyFilters( const Workflow::Frame* frame,
qint64 currentFrame, double time )
......@@ -302,3 +308,14 @@ EffectUser::moveEffect( EffectHelper *helper, qint64 newPos )
}
qWarning() << "Can't find effect" << helper->uuid();
}
void
EffectUser::cleanEffects()
{
QWriteLocker lock( m_effectsLock );
qDeleteAll( m_filters );
qDeleteAll( m_mixers );
m_filters.clear();
m_mixers.clear();
}
......@@ -43,12 +43,14 @@ class EffectUser : public QObject
* \param effect The effect instance. Can be either mixer or filter.
*/
EffectHelper *addEffect( Effect *effect, qint64 start = 0, qint64 end = -1 );
void addEffect( EffectHelper *effect );
void moveEffect( EffectHelper *helper, qint64 newPos );
void removeEffect( EffectHelper *helper );
const EffectsEngine::EffectList &effects( Effect::Type type ) const;
void removeEffect( Effect::Type type, quint32 idx );
void swapFilters( quint32 idx, quint32 idx2 );
quint32 count( Effect::Type type ) const;
void cleanEffects();
protected:
EffectUser();
......@@ -81,6 +83,7 @@ class EffectUser : public QObject
EffectsEngine::EffectList m_filters;
signals:
void effectAdded( EffectHelper *helper );
void effectMoved( EffectHelper *helper, qint64 newPos );
void effectRemoved( EffectHelper *helper );
};
......
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