Commit c18f9a71 authored by Vincent Carrubba's avatar Vincent Carrubba

Some modifications to improve the EffectsEngine poc stability

parent 9569337e
......@@ -107,10 +107,10 @@ void EffectsEngine::patchEffects( void )
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], tmp );
}
( m_effects[0] )->connectOutput( QString( "out" ) , m_effects[1], QString( "in" ) );
( m_effects[1] )->connect( QString( "out" ), m_videoOutputs[0] );
m_effects[0]->connectOutput( QString( "out" ) , m_effects[1], QString( "in" ) );
m_effects[1]->connect( QString( "out" ), m_videoOutputs[0] );
return ;
}
......@@ -93,8 +93,8 @@ void MixerEffect::render( void )
const VideoFrame& lvf = static_cast<VideoFrame>( static_cast<LightVideoFrame>( ( it.value() ) ) );
if ( lvf.rvf.raw != NULL )
{
m_videoOutputs["out"] << lvf;
return ;
m_videoOutputs["out"] << lvf;
return ;
}
++it;
}
......
......@@ -25,6 +25,7 @@
#define OUTSLOT_HPP_
#include "InSlot.hpp"
#include <QtDebug>
template<typename T>
class OutSlot
......@@ -37,6 +38,8 @@ public:
// CTOR & DTOR
OutSlot();
OutSlot(OutSlot const &);
OutSlot& operator=(OutSlot const &);
~OutSlot();
// STREAMING
......@@ -66,9 +69,8 @@ private:
typename InSlot<T>::OUTTYPE m_type;
InSlot<T>* m_connectedTo;
T* m_pipe;
T m_junk;
T* m_pipe;
};
/////////////////////////
......@@ -80,6 +82,32 @@ private:
template<typename T>
OutSlot<T>::OutSlot() : m_type( InSlot<T>::NORMAL ), m_connectedTo( NULL ), m_pipe( &m_junk )
{
qDebug() << "HAYA : " << this->m_pipe;
qDebug() << "HAYA : " << &(this->m_junk)
<< "\n" ;
}
template<typename T>
OutSlot<T>::OutSlot(OutSlot<T> const & tocopy) : m_type( tocopy.m_type ),
m_connectedTo( NULL ),
m_pipe( &m_junk )
{
qDebug() << "copy ctor";
qDebug() << "m_pipe : " << this->m_pipe;
qDebug() << "&m_junk : " << &(this->m_junk)
<< "\n" ;
}
template<typename T>
OutSlot<T>& OutSlot<T>::operator=(OutSlot<T> const & tocopy)
{
qDebug() << "HAIE GALLE sur OutSlot";
qDebug() << "m_pipe : " << this->m_pipe;
qDebug() << "&m_junk : " << &(this->m_junk)
<< "\n" ;
m_type = tocopy.m_type;
m_connectedTo = NULL;
m_pipe = &m_junk;
}
template<typename T>
......@@ -92,6 +120,10 @@ OutSlot<T>::~OutSlot()
template<typename T>
OutSlot<T>& OutSlot<T>::operator=( T const & val )
{
qDebug() << "HAIE GALLE sur type T";
qDebug() << "m_pipe : " << this->m_pipe;
qDebug() << "&m_junk : " << &(this->m_junk)
<< "\n" ;
(*m_pipe) = val;
return ( *this );
}
......@@ -99,6 +131,10 @@ OutSlot<T>& OutSlot<T>::operator=( T const & val )
template<typename T>
OutSlot<T>& OutSlot<T>::operator<<( T const & val )
{
qDebug() << "CHEUVEU ROND";
qDebug() << "m_pipe : " << this->m_pipe;
qDebug() << "&m_junk : " << &(this->m_junk)
<< "\n" ;
(*m_pipe) = val;
return (*this);
}
......@@ -111,7 +147,13 @@ bool OutSlot<T>::connect( InSlot<T>& toconnect )
if ( m_connectedTo != NULL )
return ( false );
if ( toconnect.connect( (*this) ) == false)
{
return ( false );
}
qDebug() << "CONNECT";
qDebug() << "m_pipe : " << this->m_pipe;
qDebug() << "&m_junk : " << &(this->m_junk)
<< "\n" ;
return ( true );
}
......
......@@ -15,21 +15,21 @@ PouetEffect::~PouetEffect()
{
}
void PouetEffect::render( void )
void PouetEffect::render( void )
{
static qint32 nbp = -1;
quint32 i;
LightVideoFrame tmp;
( m_videoInputs["in"] ) >> tmp;
if (tmp.rvf.raw != NULL)
{
for ( i = 0; i < tmp.nbpixels; ++i )
{
tmp.rvf.pixel[i].Red = 0;
tmp.rvf.pixel[i].Blue = 0;
}
(m_videoOutputs["out"]) << tmp;
}
if (tmp.rvf.raw != NULL)
{
for ( i = 0; i < tmp.nbpixels; ++i )
{
tmp.rvf.pixel[i].Red = 0;
tmp.rvf.pixel[i].Blue = 0;
}
(m_videoOutputs["out"]) << tmp;
}
return ;
}
#include "VideoFrame.h"
#include <QtDebug>
VideoFrame::~VideoFrame()
{
......@@ -49,23 +50,31 @@ VideoFrame & VideoFrame::operator=( VideoFrame const & tocopy )
}
else
{
qDebug() << __LINE__;
if ( tocopy.rvf.raw != NULL )
{
qDebug() << __LINE__;
if ( this->nboctets != tocopy.nboctets )
{
qDebug() << __LINE__ << "\n"
<< "this pixels = " << this->nbpixels
<< "tocopy pixels = " << tocopy.nbpixels;
delete [] this->rvf.raw;
this->rvf.raw = new quint8[tocopy.nboctets];
this->nboctets = tocopy.nboctets;
this->nbpixels = tocopy.nboctets / Pixel::NbComposantes;
qDebug() << __LINE__;
}
quint32 i;
qDebug() << __LINE__;
for ( i = 0; i < this->nboctets; ++i )
this->rvf.raw[i] = tocopy.rvf.raw[i];
qDebug() << __LINE__;
}
else
{
delete [] this->rvf.raw;
delete [] this->rvf.raw;
this->rvf.raw = NULL;
this->nboctets = 0;
this->nbpixels = 0;
......
......@@ -4,25 +4,17 @@
int main(void)
{
// quint32 i;
EffectsEngine ee;
VideoFrame vf1((quint8*)"123456789", 9);
VideoFrame vf2((quint8*)"ABCDEFGHI", 9);
ee.setInputFrame(vf1, 0);
ee.setInputFrame(vf2, 1);
ee.render();
std::cout << "result : " << ee.getOutputFrame(0).rvf.raw << std::endl;
// VideoFrame nvf((quint8*)"1234abcdABCD", 12);
// for ( i = 0; i < nvf.nbpixels; ++i )
// {
// std::cout << "Pixel[" << i << "].Red = " << nvf.rvf.pixel[i].Red << std::endl;
// std::cout << "Pixel[" << i << "].Green = " << nvf.rvf.pixel[i].Green << std::endl;
// std::cout << "Pixel[" << i << "].Blue = " << nvf.rvf.pixel[i].Blue << std::endl;
// }
quint32 i;
LightVideoFrame f;
QHash<int, OutSlot<LightVideoFrame> > qh;
InSlot<LightVideoFrame> in;
for (i = 0; i < 30; ++i)
{
qh[i];
}
qh[0].connect(in);
// qh[0] << f;
// qh[1] = f;
return (0);
}
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