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