Commit 81220a1f authored by Vincent Carrubba's avatar Vincent Carrubba

Replacing the QHashs by OutSlot* to improve stability

parent 9501a130
......@@ -108,15 +108,13 @@ void EffectsEngine::unloadEffects( void )
void EffectsEngine::patchEffects( void )
{
quint32 i;
QString tmp;
QReadLocker lock( m_inputLock );
for ( i = 0; i < 64; ++i )
{
tmp = "track" + QString::number(i);
m_effects[0]->connect( m_videoInputs[i], tmp );
m_effects[0]->connect( m_videoInputs[i], i );
}
m_effects[0]->connectOutput( QString( "out" ) , m_effects[1], QString( "in" ) );
m_effects[1]->connect( QString( "out" ), m_videoOutputs[0] );
m_effects[0]->connectOutput( 0 , m_effects[1], 0 );
m_effects[1]->connect( 0, m_videoOutputs[0] );
return ;
}
......@@ -3,39 +3,37 @@
GenericEffect::GenericEffect( char const * videoinputs[], quint32 const nbvideoinputs,
char const * videooutputs[], quint32 const nbvideooutputs)
{
quint32 i;
for (i = 0; i < nbvideoinputs; ++i)
m_videoInputs[videoinputs[i]];
for (i = 0; i < nbvideooutputs; ++i)
m_videoOutputs[videooutputs[i]];
m_videoInputs = new InSlot<LightVideoFrame>[nbvideoinputs];
m_videoOutputs = new OutSlot<LightVideoFrame>[nbvideooutputs];
}
GenericEffect::~GenericEffect()
{
delete m_videoInputs;
delete m_videoOutputs;
}
// CONNECTIONS BETWEEN GENERICEFFECTS
void GenericEffect::connectOutput( QString const & outName, GenericEffect* destEffect, QString const & inName)
void GenericEffect::connectOutput( quint32 outIndex, GenericEffect* destEffect, quint32 inIndex)
{
// THINK TO CHECK IF THE SLOTS EXISTS BY CALLING THE PRIVATES METHODS!!!
( m_videoOutputs[outName] ).connect( destEffect->m_videoInputs[inName] );
( m_videoOutputs[outIndex] ).connect( destEffect->m_videoInputs[inIndex] );
return ;
}
// CONNECTIONS DETWEEN GENERICEFFECT & OUTSLOT/INSLOT
void GenericEffect::connect( OutSlot<LightVideoFrame> & out, QString const & inName )
void GenericEffect::connect( OutSlot<LightVideoFrame> & out, quint32 inIndex )
{
out.connect( m_videoInputs[inName] );
out.connect( m_videoInputs[inIndex] );
return ;
}
void GenericEffect::connect( QString const & outName, InSlot<LightVideoFrame> & in )
void GenericEffect::connect( quint32 outIndex, InSlot<LightVideoFrame> & in )
{
( m_videoOutputs[outName] ).connect( in );
( m_videoOutputs[outIndex] ).connect( in );
return ;
}
......
......@@ -49,15 +49,15 @@ class GenericEffect
/* void connectDynOutToStatIn( GenericEffect* destinationeffect, QString const & inslotname ); */
/* void connectDynOutToDynIn( GenericEffect* destinationeffect ); */
void connectOutput( QString const & outName, GenericEffect* destEffect, QString const & inName );
void connectOutput( quint32 outIndex, GenericEffect* destEffect, quint32 inIndex );
/* void connectStatOutToDynIn( QString const & outslotname, GenericEffect* destinationeffect ); */
//
// CONNECTIONS BETWEEN GENERICEFFECT & OUTSLOTS/INSLOTS
//
void connect( OutSlot<LightVideoFrame> & out, QString const & inName );
void connect( QString const & outName, InSlot<LightVideoFrame> & in);
void connect( OutSlot<LightVideoFrame> & out, quint32 inIndex );
void connect( quint32 outIndex, InSlot<LightVideoFrame> & in);
private:
......@@ -78,8 +78,8 @@ class GenericEffect
protected:
// QString m_name;
QHash< QString, InSlot<LightVideoFrame> > m_videoInputs;
QHash< QString, OutSlot<LightVideoFrame> > m_videoOutputs;
InSlot<LightVideoFrame>* m_videoInputs;
OutSlot<LightVideoFrame>* m_videoOutputs;
/* QHash< QString, InSlot<SoundSampleFrame> > m_soundInputs; */
/* QHash< QString, OutSlot<SoundSampleFrame> >m_soundOutputs; */
/* QHash< QString, InSlot<LightVideoFrame> > m_controlInputs; */
......
......@@ -83,19 +83,16 @@ MixerEffect::~MixerEffect()
void MixerEffect::render( void )
{
QHash< QString, InSlot<LightVideoFrame> >::iterator it = m_videoInputs.begin();
QHash< QString, InSlot<LightVideoFrame> >::iterator end = m_videoInputs.end();
quint32 i;
while ( it != end )
for ( i = 0; i < 64; ++i )
{
const LightVideoFrame& lvf = it.value();
const LightVideoFrame& lvf = m_videoInputs[i];
if ( lvf->frame.octets != NULL )
{
m_videoOutputs["out"] << lvf;
m_videoOutputs[0] << lvf;
return ;
}
++it;
}
return ;
}
......@@ -21,7 +21,7 @@ void PouetEffect::render( void )
quint32 i;
LightVideoFrame tmp;
( m_videoInputs["in"] ) >> tmp;
( m_videoInputs[0] ) >> tmp;
if (tmp->frame.octets != NULL)
{
if (m_enabled)
......@@ -30,7 +30,7 @@ void PouetEffect::render( void )
tmp->frame.pixels[i].Red = 0;
tmp->frame.pixels[i].Blue = 0;
}
(m_videoOutputs["out"]) << tmp;
(m_videoOutputs[0]) << tmp;
}
return ;
}
......
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