Commit 91c417ab authored by chouquette's avatar chouquette Committed by Ludovic Fauvet

Modules public representation is now initialized.

Module now also have an internal representation that allows us to keep
data private. Don't know if this will be used though, but i'd rather do
this now than three month from now :)
parent eee8eb0d
......@@ -36,6 +36,23 @@ Module::~Module()
delete m_moduleInstance;
}
void Module::initInternalPtr()
{
m_p_module = new vlmc_module_internal_t;
m_p_module->public_module.f_ratio = 0;
m_p_module->public_module.psz_name = NULL;
m_p_module->public_module.p_callbacks = new vlmc_callback_t;
m_p_module->public_module.p_callbacks->pf_open = NULL;
m_p_module->public_module.p_callbacks->pf_close = NULL;
m_p_module->public_module.p_callbacks->pf_process = NULL;
m_p_module->public_module.p_output = new vlmc_output_t;
m_p_module->public_module.p_output->i_height = 0;
m_p_module->public_module.p_output->i_width = 0;
m_p_module->public_module.p_output->p_buffer = NULL;
}
bool Module::initialize()
{
m_entryPoint = reinterpret_cast<vlmc_module_entrypoint_t>( m_moduleInstance->resolve( "vlmc_module_entrypoint" ) );
......@@ -44,7 +61,13 @@ bool Module::initialize()
qDebug() << "Can't find module entry point";
return false;
}
m_entryPoint( NULL );
initInternalPtr();
m_entryPoint( reinterpret_cast<vlmc_module_t*>( m_p_module ) );
if ( m_p_module->public_module.psz_name == NULL )
{
qDebug() << "No name set. Invalid module";
return false;
}
return true;
}
......
......@@ -38,10 +38,14 @@ public:
static bool isLibrary( const QString& fileName );
private:
void initInternalPtr();
private:
QString m_name;
QLibrary* m_moduleInstance;
vlmc_module_entrypoint_t m_entryPoint;
vlmc_module_internal_t* m_p_module;
};
#endif // MODULE_H
......@@ -32,6 +32,11 @@ extern "C"
typedef vlmc_return_type_t (*vlmc_module_entrypoint_t)( vlmc_module_t* );
typedef struct
{
vlmc_module_t public_module;
} vlmc_module_internal_t;
#ifdef __cplusplus
}
#endif
......
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