Commit d144b005 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Merge branch 'master' into chouquette_sound_workflow

parents aee3da4e a71770ce
......@@ -202,6 +202,7 @@ void SettingsManager::loadDefaultsSettings()
{
if ( !SettingsManager::m_defaultLoaded )
{
SettingsManager::m_defaultLoaded = true;
VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" );
ProjectSettingsDefault::load( "default" );
......@@ -214,7 +215,6 @@ SettingsManager* SettingsManager::getInstance()
SettingsManager* ret = QSingleton<SettingsManager>::getInstance();
if ( !SettingsManager::m_defaultLoaded )
{
SettingsManager::m_defaultLoaded = true;
SettingsManager::loadDefaultsSettings();
}
return ret;
......
......@@ -20,126 +20,28 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include "EffectsEngine.h"
/**
* \file EffectsEngine.cpp
* \author Vincent Carrubba
* This file contains the EffectsEngine class implementation
*/
// CTOR & DTOR
#include "EffectsEngine.h"
#include "EffectNodeFactory.h"
#include "LightVideoFrame.h"
#include "InSlot.hpp"
#include "OutSlot.hpp"
#include <iostream>
#include <QReadWriteLock>
#include <QtDebug>
EffectsEngine::EffectsEngine( void ) : m_patch( NULL ), m_bypassPatch( NULL ), m_enabled( true ), m_processedInBypassPatch( false )
EffectsEngine::EffectsEngine( void ) : m_patch( NULL ),
m_bypassPatch( NULL ),
m_enabled( true ),
m_processedInBypassPatch( false )
{
//
//
// CREATION OF THE PATCH
//
//
if ( EffectNode::createRootNode( "RootNode" ) == false )
qDebug() << "RootNode creation failed!!!!!!!!!!";
else
{
quint32 i;
EffectNode* tmp;
qDebug() << "RootNode successfully created!";
m_patch = EffectNode::getRootNode( "RootNode" );
// CREATION DU ROOTNODE ET DE SES SLOTS
for ( i = 0 ; i < 64; ++i)
m_patch->createStaticVideoInput();
m_patch->createStaticVideoOutput();
if ( m_patch->createChild( "libVLMC_MixerEffectPlugin" ) == true )
{
tmp = m_patch->getChild( 1 );
for ( i = 0 ; i < 64; ++i)
if ( tmp->connectChildStaticVideoInputToParentStaticVideoOutput( ( i + 1 ), ( i + 1 ) ) == false )
qDebug() << "The connection of the intput " << i << " of the mixer with the internal " << i << " output of the RootNode failed!";
else
qDebug() << "The connection of the intput " << i << " of the mixer with the internal " << i << " output of the RootNode successed!";
// // RECUP LE MIXER ET CONNECTE SA SORTIE 1 A L'INTERNAL INPUT DU ROOT NODE
// tmp = m_patch->getChild( 1 );
// if ( tmp->connectChildStaticVideoOutputToParentStaticVideoInput( 1, 1 ) == false )
// qDebug() << "The connection of the mixer output with the BypassRootNode internal input failed!";
// else
// qDebug() << "The connection of the mixer output with the BypassRootNode internal input successed!";
m_patch->createChild( "libVLMC_BlitInRectangleEffectPlugin" );
m_patch->createChild( "libVLMC_InvertRNBEffectPlugin" );
// RECUP LE MIXER ET CONNECTE SA SORTIE 1 A L'ENTREE 2 DU BLIT
tmp = m_patch->getChild( 1 );
if ( tmp->connectStaticVideoOutputToStaticVideoInput( 1, 2, "dst" ) == false )
qDebug() << "The connection of the mixer output with the second input of the blit failed!";
else
qDebug() << "The connection of the mixer output with the second input of the blit successed!";
// RECUP LE BLIT ET CONNECT SA SORTIE 2 A L'INTERNAL INPUT DU ROOT NODE
tmp = m_patch->getChild( 2 );
if ( tmp->connectChildStaticVideoOutputToParentStaticVideoInput( "res", 1 ) == false )
qDebug() << "The connection of the second output of the blit with the BypassRootNode internal input failed!";
else
qDebug() << "The connection of the second output of the blit with the BypassRootNode internal input successed!";
// CONNECT SA SORTIE 1 A SA L'ENTREE 1 DE L'INVERSEUR DE BLEU ET DE ROUGE
if ( tmp->connectStaticVideoOutputToStaticVideoInput( "aux", 3, 1 ) == false )
qDebug() << "The connection of the first output of the blit with the RNBInvert input failed!";
else
qDebug() << "The connection of the first output of the blit with the RNBInvert input successed!";
// CONNECT LA SORTIE DE L'INVERSEUR A L'ENTREE SRC DU BLIT
tmp = m_patch->getChild( 3 );
if ( tmp->connectStaticVideoOutputToStaticVideoInput( 1, 2, 1 ) == false )
qDebug() << "The connection of the RNBInvert output with the first input of the blit failed!";
else
qDebug() << "The connection of the RNBInvert output with the first input of the blit successed!";
}
else
qDebug() << "There's not the video mixer plugin, so the connection with it cannot exist in the RootNode";
}
//
//
// CREATION OF THE BYPASS PATCH
//
//
if ( EffectNode::createRootNode( "BypassRootNode" ) == false )
qDebug() << "BypassRootNode creation failed!!!!!!!!!!";
else
{
quint32 i;
EffectNode* tmp;
qDebug() << "BypassRootNode successfully created!";
// CREATION DU BYPASSROOTNODE ET DE SES SLOTS
m_bypassPatch = EffectNode::getRootNode( "BypassRootNode" );
for ( i = 0 ; i < 64; ++i)
m_bypassPatch->createStaticVideoInput();
m_bypassPatch->createStaticVideoOutput();
if ( m_bypassPatch->createChild( "libVLMC_MixerEffectPlugin" ) == true )
{
tmp = m_bypassPatch->getChild( 1 );
for ( i = 0 ; i < 64; ++i)
if ( tmp->connectChildStaticVideoInputToParentStaticVideoOutput( ( i + 1 ), ( i + 1 ) ) == false )
qDebug() << "The connection of the intput " << i << " of the mixer with the internal " << i << " output of the BypassRootNode failed!";
else
qDebug() << "The connection of the intput " << i << " of the mixer with the internal " << i << " output of the BypassRootNode successed!";
// RECUP LE MIXER ET CONNECTE SA SORTIE 1 A L'INTERNAL INPUT DU ROOT NODE
tmp = m_bypassPatch->getChild( 1 );
if ( tmp->connectChildStaticVideoOutputToParentStaticVideoInput( 1, 1 ) == false )
qDebug() << "The connection of the mixer output with the BypassRootNode internal input failed!";
else
qDebug() << "The connection of the mixer output with the BypassRootNode internal input successed!";
}
else
qDebug() << "There's not the video mixer plugin, so the connection with it cannot exist in the BypassRootNode";
}
makePatch();
makeBypassPatch();
}
EffectsEngine::~EffectsEngine()
......@@ -150,6 +52,134 @@ EffectsEngine::~EffectsEngine()
EffectNode::deleteRootNode( "BypassRootNode" );
}
void
EffectsEngine::makePatch( void )
{
if ( EffectNode::createRootNode( "RootNode" ) == false )
qDebug() << "RootNode creation failed!!!!!!!!!!";
else
{
quint32 i;
EffectNode* tmp;
qDebug() << "RootNode successfully created!";
m_patch = EffectNode::getRootNode( "RootNode" );
// CREATION DU ROOTNODE ET DE SES SLOTS
for ( i = 0 ; i < 64; ++i)
m_patch->createStaticVideoInput();
m_patch->createStaticVideoOutput();
if ( m_patch->createChild( "libVLMC_MixerEffectPlugin" ) == true )
{
tmp = m_patch->getChild( 1 );
for ( i = 1 ; i <= 64; ++i)
if ( tmp->connectChildStaticVideoInputToParentStaticVideoOutput( i, i ) == false )
qDebug() << "The connection of the input "
<< i << " of the mixer with the internal "
<< i << " output of the RootNode failed!";
else
qDebug() << "The connection of the input "
<< i << " of the mixer with the internal "
<< i << " output of the RootNode successed!";
// // RECUP LE MIXER ET CONNECTE SA SORTIE 1 A L'INTERNAL INPUT DU ROOT NODE
// tmp = m_patch->getChild( 1 );
// if ( tmp->connectChildStaticVideoOutputToParentStaticVideoInput( 1, 1 ) == false )
// qDebug() << "The connection of the mixer output with the BypassRootNode internal input failed!";
// else
// qDebug() << "The connection of the mixer output with the BypassRootNode internal input successed!";
m_patch->createChild( "libVLMC_BlitInRectangleEffectPlugin" );
m_patch->createChild( "libVLMC_InvertRNBEffectPlugin" );
// RECUP LE MIXER ET CONNECTE SA SORTIE 1 A L'ENTREE 2 DU BLIT
tmp = m_patch->getChild( 1 );
if ( tmp->connectStaticVideoOutputToStaticVideoInput( 1, 2, "dst" ) == false )
qDebug() << "The connection of the mixer output"
<< "with the second input of the blit failed!";
else
qDebug() << "The connection of the mixer output"
<< "with the second input of the blit successed!";
// RECUP LE BLIT ET CONNECT SA SORTIE 2 A L'INTERNAL INPUT DU ROOT NODE
tmp = m_patch->getChild( 2 );
if ( tmp->connectChildStaticVideoOutputToParentStaticVideoInput( "res", 1 ) == false )
qDebug() << "The connection of the second output of the blit"
<< "with the BypassRootNode internal input failed!";
else
qDebug() << "The connection of the second output of the blit"
<< "with the BypassRootNode internal input successed!";
// CONNECT SA SORTIE 1 A SA L'ENTREE 1 DE L'INVERSEUR DE BLEU ET DE ROUGE
if ( tmp->connectStaticVideoOutputToStaticVideoInput( "aux", 3, 1 ) == false )
qDebug() << "The connection of the first output of the blit"
<< "with the RNBInvert input failed!";
else
qDebug() << "The connection of the first output of the blit"
<< "with the RNBInvert input successed!";
// CONNECT LA SORTIE DE L'INVERSEUR A L'ENTREE SRC DU BLIT
tmp = m_patch->getChild( 3 );
if ( tmp->connectStaticVideoOutputToStaticVideoInput( 1, 2, 1 ) == false )
qDebug() << "The connection of the RNBInvert output"
<< "with the first input of the blit failed!";
else
qDebug() << "The connection of the RNBInvert output"
<< "with the first input of the blit successed!";
}
else
qDebug() << "There's not the video mixer plugin,"
<< "so the connection with it cannot exist in the RootNode";
}
}
void
EffectsEngine::makeBypassPatch( void )
{
if ( EffectNode::createRootNode( "BypassRootNode" ) == false )
qDebug() << "BypassRootNode creation failed!!!!!!!!!!";
else
{
quint32 i;
EffectNode* tmp;
qDebug() << "BypassRootNode successfully created!";
// CREATION DU BYPASSROOTNODE ET DE SES SLOTS
m_bypassPatch = EffectNode::getRootNode( "BypassRootNode" );
for ( i = 0 ; i < 64; ++i)
m_bypassPatch->createStaticVideoInput();
m_bypassPatch->createStaticVideoOutput();
if ( m_bypassPatch->createChild( "libVLMC_MixerEffectPlugin" ) == true )
{
tmp = m_bypassPatch->getChild( 1 );
for ( i = 1 ; i <= 64; ++i)
if ( tmp->connectChildStaticVideoInputToParentStaticVideoOutput( i, i ) == false )
qDebug() << "The connection of the intput "
<< i << " of the mixer with the internal "
<< i << " output of the BypassRootNode failed!";
else
qDebug() << "The connection of the intput "
<< i << " of the mixer with the internal "
<< i << " output of the BypassRootNode successed!";
// RECUP LE MIXER ET CONNECTE SA SORTIE 1 A L'INTERNAL INPUT DU ROOT NODE
tmp = m_bypassPatch->getChild( 1 );
if ( tmp->connectChildStaticVideoOutputToParentStaticVideoInput( 1, 1 ) == false )
qDebug() << "The connection of the mixer output"
<< "with the BypassRootNode internal input failed!";
else
qDebug() << "The connection of the mixer output"
<< "with the BypassRootNode internal input successed!";
}
else
qDebug() << "There's not the video mixer plugin,"
<< "so the connection with it cannot exist in the BypassRootNode";
}
}
void
EffectsEngine::setVideoInput( quint32 inId, const LightVideoFrame & frame )
{
......
......@@ -20,45 +20,150 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/**
* \file EffectsEngine.h
* \author Vincent Carrubba
* This file contains the EffectsEngine class definition and declaration
*/
#ifndef EFFECTSENGINE_H_
#define EFFECTSENGINE_H_
#include "EffectNodeFactory.h"
#include <QtGlobal>
#include <QHash>
#include <iostream>
#include <QReadWriteLock>
#include "LightVideoFrame.h"
#include "InSlot.hpp"
#include "OutSlot.hpp"
#include "EffectNodeFactory.h"
class EffectNode;
class LightVideoFrame;
class QReadWriteLock;
/**
* \class EffectsEngine
* \brief This is top-level class of the effects engine
* It provide a simple set of methods to send audio and video
* to the effects engine, render it and finally get the result
* It's thread-safe.
* The inputs methods, the render and the outputs methods are
* called a each video frame
*/
class EffectsEngine
{
public:
// CTOR & DTOR
/**
* \brief EffectsEngine constructor
*/
EffectsEngine( void );
/**
* \brief EffectsEngine destructor
*/
~EffectsEngine();
/** \brief Patch maker
* This method instantiates a root EffectNode named "RootNode",
* creates a mixer effect as subchild in it and connects
* both to getter to allow audio and video goiny through
* the effects engine.
* It's used by the effects engine, when it's enabled.
*/
void makePatch( void );
/**
*\brief BypassPatch maker
* This method instantiates a root EffectNode named "BypassRootNode",
* it happends the sames things like in void EffectsEngine::makePatch()
* but the created root EffectNode will never be modified by the GUI.
* It's used by the effects engine, when it's disabled.
*/
void makeBypassPatch( void );
/**
* \brief Enable the effects engine
* This method enable the effects engine by setting
* m_enabled to true ( and so tell the effects engine to use the root EffectNode
* named "RootNode")
*/
void enable( void );
/**
* \brief Disable the effects engine
* This method disable the effects engine by setting
* m_enabled to false ( and so tell the effects engine to use the root EffectNode
* named "BypassRootNode")
*/
void disable( void );
/**
* \brief Render the audio/video with effects
* If the patch used by inputs methods is "RootNode", it will call the
* render method of the root EffectNode called "RootNode"
* else, it will call the render method of the root EffectNode
* called "BypassRootNode"
*/
void render( void );
/**
* \brief Get the video result of the output with id outId
* \param outId : this is the id of the video output
* \return This method return the result track contained in the ouput
* with id outId
* If the patch used by input method is "RootNode", it will get
* the video frame of the output with id outId of the EffectNode
* called "RootNode",
* else, it will do the same thing but with the EffectNode
* called "BypassRootNode"
*/
const LightVideoFrame & getVideoOutput( quint32 outId ) const;
/**
* \brief Send the video frame in input with id inId
* \bug If the effects engine enable state is changed beetween
* two call of this method, there will be crap
* \param inId : this is the id of the video input
* \param frame : this is the frame to send to the input with id inId
* If the effects engine is enable, it will give the video frame to the
* input with the id inId of the EffectNode called "RootNode"
* else, it will give the video frame to the input with the id inId
* of the EffectNode called "BypassRootNode"
*/
void setVideoInput( quint32 inId, const LightVideoFrame & frame );
private:
EffectsEngine( void
/* quint32 nbinputs, quint32 nboutputs */);
~EffectsEngine();
/**
* \var mutable QReadWriteLock m_rwl
* This variable is use to permit Thread-safety
*/
mutable QReadWriteLock m_rwl;
void enable( void );
void disable( void );
/**
* \var EffectNodeFactory m_enf
* it permit to manage and store EffectNodes
*/
EffectNodeFactory m_enf;
const LightVideoFrame & getVideoOutput( quint32 outId ) const;
void render( void );
void setVideoInput( quint32 inId, const LightVideoFrame & frame );
/**
* \var EffectNode* m_patch
* This is the root node/patch used when the effects engine is enabled
*/
EffectNode* m_patch;
/**
* \var EffectNode* m_bypassPatch
* This is the root node/patch used when the effects engine is disabled
*/
EffectNode* m_bypassPatch;
private:
/**
* \var bool m_enabled
* This var is used to tell the inputs methods to send
* their datas to m_patch if it's set to true, else
* to m_bypassPatch
*/
bool m_enabled;
/**
* \var EffectNode* m_processedInBypassPatch
* This var is used to tell the render and the outputs methods
* to work on m_bypassPatch if it's set to true, else on m_patch
*/
bool m_processedInBypassPatch;
mutable QReadWriteLock m_rwl;
EffectNodeFactory m_enf;
EffectNode* m_patch;
EffectNode* m_bypassPatch;
bool m_enabled;
bool m_processedInBypassPatch;
};
#endif // EFFECTSENGINE_H_
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