Commit e7fe15c7 authored by Vincent Carrubba's avatar Vincent Carrubba

Use new in/out methods of the effects engine

parent cda38969
......@@ -27,7 +27,7 @@
#include <iostream>
EffectsEngine::EffectsEngine( void ) : m_patch( NULL ), m_bypassPatch( NULL )
EffectsEngine::EffectsEngine( void ) : m_patch( NULL ), m_bypassPatch( NULL ), m_enabled( true ), m_processedInBypassPatch( false )
{
//
//
......@@ -168,16 +168,41 @@ EffectNode const * EffectsEngine::operator*( void ) const
//
//
const LightVideoFrame &
EffectsEngine::getVideoOutput( quint32 outId ) const
void
EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame )
{
return (*m_patch->getInternalStaticVideoInput( outId ));
QWriteLocker wl( &m_rwl );
if ( m_enabled == true )
{
m_processedInBypassPatch = false;
(*m_patch->getInternalStaticVideoOutput( inId )) << frame;
}
else
{
m_processedInBypassPatch = true;
(*m_bypassPatch->getInternalStaticVideoOutput( inId )) << frame;
}
}
void
EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame )
EffectsEngine::render( void )
{
(*m_patch->getInternalStaticVideoOutput( inId )) << frame;
QWriteLocker wl( &m_rwl );
if ( m_processedInBypassPatch == false )
m_patch->render();
else
m_bypassPatch->render();
}
const LightVideoFrame &
EffectsEngine::getVideoOutput( quint32 outId ) const
{
QReadLocker rl( &m_rwl );
if ( m_processedInBypassPatch == false )
return (*m_patch->getInternalStaticVideoInput( outId ));
return (*m_bypassPatch->getInternalStaticVideoInput( outId ));
}
// BYPASSING
......@@ -185,11 +210,13 @@ EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame )
void
EffectsEngine::enable( void )
{
return ;
QWriteLocker wl( &m_rwl );
m_enabled = true;
}
void
EffectsEngine::disable( void )
{
return ;
QWriteLocker wl( &m_rwl );
m_enabled = false;
}
......@@ -54,6 +54,7 @@ class EffectsEngine
void disable( void );
const LightVideoFrame & getVideoOutput( quint32 outId ) const;
void render( void );
void setVideoInput( quint32 inId, const LightVideoFrame & frame );
private:
......@@ -62,6 +63,8 @@ class EffectsEngine
EffectNodeFactory m_enf;
EffectNode* m_patch;
EffectNode* m_bypassPatch;
bool m_enabled;
bool m_processedInBypassPatch;
};
#endif // EFFECTSENGINE_H_
......@@ -218,8 +218,8 @@ MainWorkflow::OutputBuffers* MainWorkflow::getSynchroneOutput()
// qDebug() << "Waiting for sync output";
m_synchroneRenderWaitCondition->wait( m_synchroneRenderWaitConditionMutex );
// qDebug() << "Got it";
(*m_effectEngine)->render();
LightVideoFrame const & tmp = (*((*m_effectEngine)->getInternalStaticVideoInput( 1 )) );
m_effectEngine->render();
LightVideoFrame const & tmp = m_effectEngine->getVideoOutput( 1 );
if (tmp->nboctets == 0 )
m_outputBuffers->video = MainWorkflow::blackOutput;
else
......
......@@ -112,7 +112,7 @@ void TrackHandler::getOutput( qint64 currentFrame )
m_tracks[i]->simulateBlackOutputRender();
}
else
(*((*m_effectEngine)->getInternalStaticVideoOutput( i + 1 ))) << *TrackHandler::nullOutput;
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
continue ;
}
++m_nbTracksToRender;
......@@ -303,9 +303,9 @@ void TrackHandler::tracksRenderCompleted( unsigned int trackId )
{
LightVideoFrame* buff = reinterpret_cast<LightVideoFrame*>( m_tracks[trackId]->getSynchroneOutput() );
if ( buff == NULL )
(*((*m_effectEngine)->getInternalStaticVideoOutput( trackId + 1 ))) << *TrackHandler::nullOutput;
m_effectEngine->setVideoInput( trackId + 1, *TrackHandler::nullOutput );
else
(*((*m_effectEngine)->getInternalStaticVideoOutput( trackId + 1 ))) << *buff;
m_effectEngine->setVideoInput( trackId + 1, *buff);
}
else
{
......
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