Commit 94a45f31 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EffectsEngine: Merging EffectList and MixerList.

parent 7601f776
...@@ -179,7 +179,7 @@ EffectsEngine::saveFilters( const EffectList &effects, QXmlStreamWriter &project ...@@ -179,7 +179,7 @@ EffectsEngine::saveFilters( const EffectList &effects, QXmlStreamWriter &project
} }
void void
EffectsEngine::initFilters( const EffectList &effects, quint32 width, quint32 height ) EffectsEngine::initEffects( const EffectList &effects, quint32 width, quint32 height )
{ {
EffectsEngine::EffectList::const_iterator it = effects.begin(); EffectsEngine::EffectList::const_iterator it = effects.begin();
EffectsEngine::EffectList::const_iterator ite = effects.end(); EffectsEngine::EffectList::const_iterator ite = effects.end();
...@@ -192,38 +192,23 @@ EffectsEngine::initFilters( const EffectList &effects, quint32 width, quint32 he ...@@ -192,38 +192,23 @@ EffectsEngine::initFilters( const EffectList &effects, quint32 width, quint32 he
} }
EffectsEngine::EffectHelper* EffectsEngine::EffectHelper*
EffectsEngine::getMixer( const MixerList &mixers, qint64 currentFrame ) EffectsEngine::getMixer( const EffectList &mixers, qint64 currentFrame )
{ {
MixerList::const_iterator it = mixers.constBegin(); EffectList::const_iterator it = mixers.constBegin();
MixerList::const_iterator ite = mixers.constEnd(); EffectList::const_iterator ite = mixers.constEnd();
while ( it != ite ) while ( it != ite )
{ {
if ( it.key() <= currentFrame && currentFrame <= it.value()->end ) if ( (*it)->start <= currentFrame && currentFrame <= (*it)->end )
{ {
Q_ASSERT( it.value()->effect->effect()->type() == Effect::Mixer2 ); Q_ASSERT( (*it)->effect->effect()->type() == Effect::Mixer2 );
return it.value(); return (*it);
} }
++it; ++it;
} }
return NULL; return NULL;
} }
void
EffectsEngine::initMixers( const MixerList &mixers, quint32 width, quint32 height )
{
if ( mixers.size() <= 0 )
return ;
EffectsEngine::MixerList::const_iterator it = mixers.constBegin();
EffectsEngine::MixerList::const_iterator ite = mixers.constEnd();
while ( it != ite )
{
it.value()->effect->init( width, height );
++it;
}
}
void void
EffectsEngine::loadEffects() EffectsEngine::loadEffects()
{ {
......
...@@ -69,23 +69,20 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine> ...@@ -69,23 +69,20 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
QUuid uuid; QUuid uuid;
}; };
typedef QList<EffectHelper*> EffectList; typedef QList<EffectHelper*> EffectList;
typedef QHash<qint64, EffectHelper*> MixerList;
static const quint32 MaxFramesForMixer = 3; static const quint32 MaxFramesForMixer = 3;
Effect* effect( const QString& name ); Effect* effect( const QString& name );
bool loadEffect( const QString& fileName ); bool loadEffect( const QString& fileName );
void loadEffects(); void loadEffects();
static void initEffects( const EffectList &effects, quint32 width, quint32 height );
//Filters methods: //Filters methods:
static quint32 *applyFilters( const EffectList &effects, static quint32 *applyFilters( const EffectList &effects,
const Workflow::Frame *frame, qint64 currentFrame, double time ); const Workflow::Frame *frame, qint64 currentFrame, double time );
static void saveFilters( const EffectList &effects, QXmlStreamWriter &project ); static void saveFilters( const EffectList &effects, QXmlStreamWriter &project );
static void initFilters( const EffectList &effects, quint32 width, quint32 height );
//Mixers methods: //Mixers methods:
static EffectHelper *getMixer( const MixerList& mixers, qint64 currentFrame ); static EffectHelper *getMixer( const EffectList &mixers, qint64 currentFrame );
static void initMixers( const MixerList& mixers, quint32 width,
quint32 height );
private: private:
EffectsEngine(); EffectsEngine();
......
...@@ -245,7 +245,7 @@ void WorkflowRenderer::startPreview() ...@@ -245,7 +245,7 @@ void WorkflowRenderer::startPreview()
setupRenderer( m_width, m_height, m_outputFps ); setupRenderer( m_width, m_height, m_outputFps );
} }
QReadLocker lock( m_effectsLock ); QReadLocker lock( m_effectsLock );
EffectsEngine::initFilters( m_filters, m_width, m_height ); EffectsEngine::initEffects( m_filters, m_width, m_height );
//Deactivating vlc's keyboard inputs. //Deactivating vlc's keyboard inputs.
m_mediaPlayer->setKeyInput( false ); m_mediaPlayer->setKeyInput( false );
......
...@@ -576,8 +576,8 @@ TrackWorkflow::initRender( quint32 width, quint32 height, double fps ) ...@@ -576,8 +576,8 @@ TrackWorkflow::initRender( quint32 width, quint32 height, double fps )
++it; ++it;
} }
QReadLocker lock2( m_effectsLock ); QReadLocker lock2( m_effectsLock );
EffectsEngine::initMixers( m_mixers, width, height ); EffectsEngine::initEffects( m_mixers, width, height );
EffectsEngine::initFilters( m_filters, width, height ); EffectsEngine::initEffects( m_filters, width, height );
} }
bool bool
......
...@@ -113,7 +113,7 @@ class TrackWorkflow : public QObject ...@@ -113,7 +113,7 @@ class TrackWorkflow : public QObject
private: private:
QMap<qint64, ClipWorkflow*> m_clips; QMap<qint64, ClipWorkflow*> m_clips;
QReadWriteLock *m_effectsLock; QReadWriteLock *m_effectsLock;
EffectsEngine::MixerList m_mixers; EffectsEngine::EffectList m_mixers;
EffectsEngine::EffectList m_filters; EffectsEngine::EffectList m_filters;
/** /**
......
...@@ -104,7 +104,7 @@ VideoClipWorkflow::initVlcOutput() ...@@ -104,7 +104,7 @@ VideoClipWorkflow::initVlcOutput()
m_vlcMedia->addOption( buffer ); m_vlcMedia->addOption( buffer );
QReadLocker lock( m_effectsLock ); QReadLocker lock( m_effectsLock );
EffectsEngine::initFilters( m_filters, m_width, m_height ); EffectsEngine::initEffects( m_filters, m_width, m_height );
} }
void* void*
......
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