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 ...@@ -179,3 +179,16 @@ EffectsEngine::saveEffects( const EffectList &effects, QXmlStreamWriter &project
} }
project.writeEndElement(); 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> ...@@ -56,6 +56,7 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
static void applyEffects( const EffectList &effects, static void applyEffects( const EffectList &effects,
Workflow::Frame *frame, qint64 currentFrame ); Workflow::Frame *frame, qint64 currentFrame );
static void saveEffects( const EffectList &effects, QXmlStreamWriter &project ); static void saveEffects( const EffectList &effects, QXmlStreamWriter &project );
static void initEffects( const EffectList &effects, quint32 width, quint32 height );
private: private:
EffectsEngine(); EffectsEngine();
......
...@@ -117,6 +117,8 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps ) ...@@ -117,6 +117,8 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
sprintf( buffer, ":imem-data=%"PRId64, (intptr_t)m_esHandler ); sprintf( buffer, ":imem-data=%"PRId64, (intptr_t)m_esHandler );
m_media->addOption( buffer ); m_media->addOption( buffer );
m_media->addOption( ":text-renderer dummy" ); m_media->addOption( ":text-renderer dummy" );
EffectsEngine::initEffects( m_effects, width, height );
} }
int int
...@@ -388,7 +390,7 @@ void ...@@ -388,7 +390,7 @@ void
WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end ) WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
{ {
EffectInstance *effectInstance = effect->createInstance(); EffectInstance *effectInstance = effect->createInstance();
effectInstance->init( m_width, m_height ); qDebug() << "width:" << m_width << m_height;
QWriteLocker lock( m_effectsLock ); QWriteLocker lock( m_effectsLock );
m_effects.push_back( new EffectsEngine::EffectHelper( effectInstance, start, end ) ); 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