Commit d5ecb040 authored by Vincent Carrubba's avatar Vincent Carrubba

Modifying plugin loading system to have a a Q_CLASSINFO as plugin name and not the filename

parent 7285a400
......@@ -26,6 +26,7 @@
#include <IEffectPluginCreator.h>
#include <QDebug>
#include <QMetaClassInfo>
EffectPluginTypeLoader::EffectPluginTypeLoader( void ) : m_iepc( NULL )
{
......@@ -35,16 +36,26 @@ EffectPluginTypeLoader::~EffectPluginTypeLoader()
{
}
IEffectPlugin* EffectPluginTypeLoader::createIEffectPluginInstance( void ) const
IEffectPlugin*
EffectPluginTypeLoader::createIEffectPluginInstance( void ) const
{
if ( m_iepc != NULL )
return m_iepc->createIEffectPluginInstance();
return NULL;
}
bool EffectPluginTypeLoader::load( const QString & fileName )
QString
EffectPluginTypeLoader::pluginName( void ) const
{
return m_pluginName;
}
bool
EffectPluginTypeLoader::load( const QString & fileName )
{
QObject* tmp;
int pnindex;
m_qpl.setFileName( fileName );
tmp = m_qpl.instance();
......@@ -61,5 +72,11 @@ bool EffectPluginTypeLoader::load( const QString & fileName )
<< "the loaded class isn't IEffectPluginCreator* !";
return false;
}
if ( ( pnindex = tmp->metaObject()->indexOfClassInfo( "PLUGINNAME" ) ) == -1 )
{
qDebug() << "The Plugin hasn't a PLUGINNAME MetaClassInfo!";
return false;
}
m_pluginName = tmp->metaObject()->classInfo( pnindex ).value();
return true;
}
......@@ -38,6 +38,7 @@ public:
EffectPluginTypeLoader( void );
~EffectPluginTypeLoader();
QString pluginName( void ) const;
IEffectPlugin* createIEffectPluginInstance( void ) const;
bool load( const QString & fileName );
......@@ -45,6 +46,7 @@ private:
QPluginLoader m_qpl;
IEffectPluginCreator* m_iepc;
QString m_pluginName;
};
#endif // EFFECTPLUGINTYPELOADER_H_
......@@ -54,12 +54,13 @@ EffectPluginTypeManager::EffectPluginTypeManager( void ) : m_higherFreeId( 2 )
tmpEptl = new EffectPluginTypeLoader();
if ( tmpEptl->load( list.at( i ).absoluteFilePath() ) == true )
{
m_eptlByName[ list.at( i ).baseName() ] = tmpEptl;
m_eptlByName[ tmpEptl->pluginName() ] = tmpEptl;
m_eptlById[ m_higherFreeId ] = tmpEptl;
m_nameById[ m_higherFreeId ] = list.at( i ).baseName();
m_nameById[ m_higherFreeId ] = tmpEptl->pluginName();
++m_higherFreeId;
tmpEptl = NULL;
qDebug() << list.at( i ).fileName() << " loaded.";
qDebug() << "---> Plugin name : " << tmpEptl->pluginName();
tmpEptl = NULL;
}
else
qDebug() << list.at( i ).fileName() << " can't be loaded!";
......
......@@ -72,7 +72,7 @@ EffectsEngine::makePatch( void )
m_patch->createStaticVideoOutput();
if ( m_patch->createChild( "libVLMC_MixerEffectPlugin" ) == true )
if ( m_patch->createChild( "Mixer" ) == true )
{
tmp = m_patch->getChild( 1 );
for ( i = 1 ; i <= 64; ++i)
......@@ -93,8 +93,8 @@ EffectsEngine::makePatch( void )
// qDebug() << "The connection of the mixer output with the BypassRootNode internal input successed!";
m_patch->createChild( "libVLMC_BlitInRectangleEffectPlugin" );
m_patch->createChild( "libVLMC_InvertRNBEffectPlugin" );
m_patch->createChild( "BlitInRectangle" );
m_patch->createChild( "InvertRNB" );
// 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 )
......@@ -116,10 +116,10 @@ EffectsEngine::makePatch( void )
// 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!";
<< "with the InvertRNB input failed!";
else
qDebug() << "The connection of the first output of the blit"
<< "with the RNBInvert input successed!";
<< "with the InvertRNB input successed!";
// CONNECT LA SORTIE DE L'INVERSEUR A L'ENTREE SRC DU BLIT
tmp = m_patch->getChild( 3 );
......@@ -154,7 +154,7 @@ EffectsEngine::makeBypassPatch( void )
m_bypassPatch->createStaticVideoInput();
m_bypassPatch->createStaticVideoOutput();
if ( m_bypassPatch->createChild( "libVLMC_MixerEffectPlugin" ) == true )
if ( m_bypassPatch->createChild( "Mixer" ) == true )
{
tmp = m_bypassPatch->getChild( 1 );
for ( i = 1 ; i <= 64; ++i)
......
......@@ -34,6 +34,7 @@ class BlitInRectangleEffectPluginCreator : public QObject, public IEffectPlugi
{
Q_OBJECT;
Q_INTERFACES( IEffectPluginCreator );
Q_CLASSINFO( "PLUGINNAME", "BlitInRectangle" );
public:
IEffectPlugin* createIEffectPluginInstance( void );
};
......
......@@ -34,6 +34,7 @@ class GreenFilterEffectPluginCreator : public QObject, public IEffectPluginCre
{
Q_OBJECT;
Q_INTERFACES( IEffectPluginCreator );
Q_CLASSINFO( "PLUGINNAME", "GreenFilter" );
public:
IEffectPlugin* createIEffectPluginInstance( void );
};
......
......@@ -34,6 +34,7 @@ class InvertRNBEffectPluginCreator : public QObject, public IEffectPluginCreat
{
Q_OBJECT;
Q_INTERFACES( IEffectPluginCreator );
Q_CLASSINFO( "PLUGINNAME", "InvertRNB" );
public:
IEffectPlugin* createIEffectPluginInstance( void );
};
......
......@@ -23,9 +23,10 @@
#include "MixerEffectPluginCreator.h"
IEffectPlugin* MixerEffectPluginCreator::createIEffectPluginInstance( void )
IEffectPlugin*
MixerEffectPluginCreator::createIEffectPluginInstance( void )
{
return (new MixerEffectPlugin());
return new MixerEffectPlugin();
}
Q_EXPORT_PLUGIN2( MixerEffectPluginCreator, MixerEffectPluginCreator )
......@@ -32,8 +32,9 @@
class MixerEffectPluginCreator : public QObject, public IEffectPluginCreator
{
Q_OBJECT
Q_INTERFACES( IEffectPluginCreator )
Q_OBJECT;
Q_INTERFACES( IEffectPluginCreator );
Q_CLASSINFO("PLUGINNAME", "Mixer");
public:
IEffectPlugin* createIEffectPluginInstance( 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