Commit 5c3a501a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

WorkflowRenderer: Initialize the effects at the right time.

Fixes a crash when starting the playback.
parent 876a7b7e
......@@ -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;
}
}
......@@ -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();
......
......@@ -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 ) );
}
......
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