Commit 61817460 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Hide module_t

parent 1b874401
...@@ -25,75 +25,6 @@ ...@@ -25,75 +25,6 @@
#error You are not libvlc or one of its plugins. You cannot include this file #error You are not libvlc or one of its plugins. You cannot include this file
#endif #endif
#if 1
/* FIXME: scheduled for privatization */
#define MODULE_SHORTCUT_MAX 50
/* The module handle type. */
#if defined(HAVE_DL_DYLD)
# if defined (HAVE_MACH_O_DYLD_H)
# include <mach-o/dyld.h>
# endif
typedef NSModule module_handle_t;
#elif defined(HAVE_IMAGE_H)
typedef int module_handle_t;
#elif defined(WIN32) || defined(UNDER_CE)
typedef void * module_handle_t;
#elif defined(HAVE_DL_DLOPEN)
typedef void * module_handle_t;
#elif defined(HAVE_DL_SHL_LOAD)
typedef shl_t module_handle_t;
#endif
/**
* Module descriptor
*/
struct module_t
{
VLC_COMMON_MEMBERS
/*
* Variables set by the module to identify itself
*/
const char *psz_shortname; /**< Module name */
const char *psz_longname; /**< Module descriptive name */
const char *psz_help; /**< Long help string for "special" modules */
/** Shortcuts to the module */
const char *pp_shortcuts[ MODULE_SHORTCUT_MAX ];
char *psz_capability; /**< Capability */
int i_score; /**< Score for the capability */
uint32_t i_cpu; /**< Required CPU capabilities */
vlc_bool_t b_unloadable; /**< Can we be dlclosed? */
vlc_bool_t b_reentrant; /**< Are we reentrant? */
vlc_bool_t b_submodule; /**< Is this a submodule? */
/* Callbacks */
int ( * pf_activate ) ( vlc_object_t * );
void ( * pf_deactivate ) ( vlc_object_t * );
/*
* Variables set by the module to store its config options
*/
module_config_t *p_config; /* Module configuration structure */
size_t confsize; /* Number of module_config_t items */
unsigned int i_config_items; /* number of configuration items */
unsigned int i_bool_items; /* number of bool config items */
/*
* Variables used internally by the module manager
*/
/* Plugin-specific stuff */
module_handle_t handle; /* Unique handle */
char * psz_filename; /* Module filename */
vlc_bool_t b_builtin; /* Set to true if the module is built in */
vlc_bool_t b_loaded; /* Set to true if the dll is loaded */
};
#endif
/***************************************************************************** /*****************************************************************************
* Exported functions. * Exported functions.
*****************************************************************************/ *****************************************************************************/
...@@ -109,6 +40,9 @@ VLC_EXPORT( vlc_bool_t, __module_Exists, ( vlc_object_t *, const char * ) ); ...@@ -109,6 +40,9 @@ VLC_EXPORT( vlc_bool_t, __module_Exists, ( vlc_object_t *, const char * ) );
VLC_EXPORT( module_t *, __module_FindName, ( vlc_object_t *, const char * ) ); VLC_EXPORT( module_t *, __module_FindName, ( vlc_object_t *, const char * ) );
VLC_EXPORT( void, module_Put, ( module_t *module ) ); VLC_EXPORT( void, module_Put, ( module_t *module ) );
VLC_EXPORT( module_config_t *, module_GetConfig, ( const module_t *, unsigned * ) );
VLC_EXPORT( void, module_PutConfig, ( module_config_t * ) );
/* Return a NULL terminated array with the names of the modules that have a /* Return a NULL terminated array with the names of the modules that have a
* certain capability. * certain capability.
......
...@@ -85,9 +85,15 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -85,9 +85,15 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
PrefsItemData *data = NULL; PrefsItemData *data = NULL;
QTreeWidgetItem *current_item = NULL; QTreeWidgetItem *current_item = NULL;
for (size_t i = 0; i < p_module->confsize; i++) unsigned confsize;
module_config_t *p_config;
p_config = module_GetConfig (p_module, &confsize);
for (size_t i = 0; i < confsize; i++)
{ {
const module_config_t *p_item = p_module->p_config + i; module_config_t *p_item = p_config + i;
const char *psz_help; const char *psz_help;
QIcon icon; QIcon icon;
switch( p_item->i_type ) switch( p_item->i_type )
...@@ -175,6 +181,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -175,6 +181,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
break; break;
} }
} }
module_PutConfig (p_config);
/* Build the tree of plugins */ /* Build the tree of plugins */
for( int i_index = 0; i_index < p_list->i_count; i_index++ ) for( int i_index = 0; i_index < p_list->i_count; i_index++ )
...@@ -184,15 +191,13 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -184,15 +191,13 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
// Main module excluded // Main module excluded
if( !strcmp( module_GetObjName( p_module ), "main" ) ) continue; if( !strcmp( module_GetObjName( p_module ), "main" ) ) continue;
/* Exclude submodules; they have no config options of their own */ unsigned i_subcategory = 0, i_category = 0, confsize;
if( p_module->b_submodule ) continue;
unsigned i_subcategory = 0, i_category = 0;
bool b_options = false; bool b_options = false;
module_config_t *p_config = module_GetConfig (p_module, &confsize);
for (size_t i = 0; i < p_module->confsize; i++) for (size_t i = 0; i < confsize; i++)
{ {
const module_config_t *p_item = p_module->p_config + i; const module_config_t *p_item = p_config + i;
if( p_item->i_type == CONFIG_CATEGORY ) if( p_item->i_type == CONFIG_CATEGORY )
i_category = p_item->value.i; i_category = p_item->value.i;
...@@ -205,6 +210,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -205,6 +210,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
if( b_options && i_category && i_subcategory ) if( b_options && i_category && i_subcategory )
break; break;
} }
module_PutConfig (p_config);
if( !b_options || i_category == 0 || i_subcategory == 0 ) continue; if( !b_options || i_category == 0 || i_subcategory == 0 ) continue;
// Locate the category item; // Locate the category item;
...@@ -241,12 +247,8 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -241,12 +247,8 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
if( !b_found ) continue; if( !b_found ) continue;
PrefsItemData *module_data = new PrefsItemData(); PrefsItemData *module_data = new PrefsItemData();
module_data->b_submodule = p_module->b_submodule;
module_data->i_type = TYPE_MODULE; module_data->i_type = TYPE_MODULE;
module_data->psz_name = strdup( module_GetObjName( p_module ) ); module_data->psz_name = strdup( module_GetObjName( p_module ) );
module_data->i_object_id = p_module->b_submodule ?
((module_t *)p_module->p_parent)->i_object_id :
p_module->i_object_id;
module_data->help.clear(); module_data->help.clear();
// TODO image // TODO image
QTreeWidgetItem *module_item = new QTreeWidgetItem(); QTreeWidgetItem *module_item = new QTreeWidgetItem();
...@@ -336,20 +338,17 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -336,20 +338,17 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if( data->i_type == TYPE_CATEGORY ) if( data->i_type == TYPE_CATEGORY )
return; return;
else if( data->i_type == TYPE_MODULE ) else if( data->i_type == TYPE_MODULE )
p_module = (module_t *) vlc_object_get( p_intf, data->i_object_id ); p_module = module_FindName( VLC_OBJECT(p_intf), data->psz_name );
else else
{ {
p_module = config_FindModule( VLC_OBJECT(p_intf), "main" ); p_module = module_FindName( VLC_OBJECT(p_intf), "main" );
assert( p_module ); assert( p_module );
vlc_object_yield( p_module );
} }
module_t *p_realmodule = p_module->b_submodule unsigned confsize;
? (module_t *)(p_module->p_parent) module_config_t *p_config = module_GetConfig (p_module, &confsize),
: p_module; *p_item = p_config,
*p_end = p_config + confsize;
module_config_t *p_item = p_realmodule->p_config;
module_config_t *p_end = p_item + p_realmodule->confsize;
if( data->i_type == TYPE_SUBCATEGORY || data->i_type == TYPE_CATSUBCAT ) if( data->i_type == TYPE_SUBCATEGORY || data->i_type == TYPE_CATSUBCAT )
{ {
...@@ -364,6 +363,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -364,6 +363,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
p_item++; p_item++;
} }
} }
module_PutConfig (p_config);
/* Widgets now */ /* Widgets now */
global_layout = new QVBoxLayout(); global_layout = new QVBoxLayout();
...@@ -380,11 +380,12 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -380,11 +380,12 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
} }
else else
{ {
const char *psz_help = module_GetHelp (p_module);
head = QString( qtr( module_GetLongName( p_module ) ) ); head = QString( qtr( module_GetLongName( p_module ) ) );
if( p_module->psz_help ) if( psz_help )
{ {
help.append( "\n" ); help.append( "\n" );
help.append( qtr( module_GetHelp( p_module ) ) ); help.append( qtr( psz_help ) );
} }
} }
...@@ -473,7 +474,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -473,7 +474,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
layout->addWidget( box, i_line, 0, 1, 2 ); layout->addWidget( box, i_line, 0, 1, 2 );
} }
vlc_object_release( p_module ); module_Put( p_module );
scrolled_area->setSizePolicy( QSizePolicy::Preferred,QSizePolicy::Fixed ); scrolled_area->setSizePolicy( QSizePolicy::Preferred,QSizePolicy::Fixed );
scrolled_area->setLayout( layout ); scrolled_area->setLayout( layout );
......
...@@ -51,7 +51,6 @@ public: ...@@ -51,7 +51,6 @@ public:
int i_object_id; int i_object_id;
int i_subcat_id; int i_subcat_id;
int i_type; int i_type;
bool b_submodule;
char *psz_name; char *psz_name;
QString name; QString name;
QString help; QString help;
......
...@@ -507,18 +507,23 @@ void ModuleConfigControl::finish( bool bycat ) ...@@ -507,18 +507,23 @@ void ModuleConfigControl::finish( bool bycat )
{ {
if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue; if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue;
for (size_t i = 0; i < p_parser->confsize; i++) unsigned confsize;
module_config_t *p_config;
p_config = module_GetConfig (p_parser, &confsize);
for (size_t i = 0; i < confsize; i++)
{ {
module_config_t *p_config = p_parser->p_config + i;
/* Hack: required subcategory is stored in i_min */ /* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY && const module_config_t *p_cfg = p_config + i;
p_config->value.i == p_item->min.i ) if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
p_cfg->value.i == p_item->min.i )
combo->addItem( qtr( module_GetLongName( p_parser )), combo->addItem( qtr( module_GetLongName( p_parser )),
QVariant( module_GetObjName( p_parser ) ) ); QVariant( module_GetObjName( p_parser ) ) );
if( p_item->value.psz && !strcmp( p_item->value.psz, if( p_item->value.psz && !strcmp( p_item->value.psz,
module_GetObjName( p_parser ) ) ) module_GetObjName( p_parser ) ) )
combo->setCurrentIndex( combo->count() - 1 ); combo->setCurrentIndex( combo->count() - 1 );
} }
module_PutConfig (p_config);
} }
else if( module_IsCapable( p_parser, p_item->psz_type ) ) else if( module_IsCapable( p_parser, p_item->psz_type ) )
{ {
...@@ -594,12 +599,7 @@ ModuleListConfigControl::~ModuleListConfigControl() ...@@ -594,12 +599,7 @@ ModuleListConfigControl::~ModuleListConfigControl()
cb->setToolTip( formatTooltip( qtr( module_GetLongName( p_parser ))));\ cb->setToolTip( formatTooltip( qtr( module_GetLongName( p_parser ))));\
cbl->checkBox = cb; \ cbl->checkBox = cb; \
\ \
int i = -1; \ cbl->psz_module = strdup( module_GetObjName( p_parser ) ); \
while( p_parser->pp_shortcuts[++i] != NULL); \
i--; \
\
cbl->psz_module = strdup( i>=0?p_parser->pp_shortcuts[i] \
: module_GetObjName( p_parser ) ); \
modules.push_back( cbl ); \ modules.push_back( cbl ); \
} }
...@@ -619,16 +619,20 @@ void ModuleListConfigControl::finish( bool bycat ) ...@@ -619,16 +619,20 @@ void ModuleListConfigControl::finish( bool bycat )
{ {
if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue; if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue;
for (size_t i = 0; i < p_parser->confsize; i++) unsigned confsize;
module_config_t *p_config = module_GetConfig (p_parser, &confsize);
for (size_t i = 0; i < confsize; i++)
{ {
module_config_t *p_config = p_parser->p_config + i; module_config_t *p_cfg = p_config + i;
/* Hack: required subcategory is stored in i_min */ /* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY && if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
p_config->value.i == p_item->min.i ) p_cfg->value.i == p_item->min.i )
{ {
CHECKBOX_LISTS; CHECKBOX_LISTS;
} }
} }
module_PutConfig (p_config);
} }
else if( module_IsCapable( p_parser, p_item->psz_type ) ) else if( module_IsCapable( p_parser, p_item->psz_type ) )
{ {
...@@ -1030,9 +1034,14 @@ void KeySelectorControl::finish() ...@@ -1030,9 +1034,14 @@ void KeySelectorControl::finish()
module_t *p_main = config_FindModule( p_this, "main" ); module_t *p_main = config_FindModule( p_this, "main" );
assert( p_main ); assert( p_main );
for (size_t i = 0; i < p_main->confsize; i++) unsigned confsize;
module_config_t *p_config;
p_config = module_GetConfig (p_main, &confsize);
for (size_t i = 0; i < confsize; i++)
{ {
module_config_t *p_item = p_main->p_config + i; module_config_t *p_item = p_config + i;
if( p_item->i_type & CONFIG_ITEM && p_item->psz_name && if( p_item->i_type & CONFIG_ITEM && p_item->psz_name &&
strstr( p_item->psz_name , "key-" ) && !EMPTY_STR( p_item->psz_text ) ) strstr( p_item->psz_name , "key-" ) && !EMPTY_STR( p_item->psz_text ) )
...@@ -1046,6 +1055,8 @@ void KeySelectorControl::finish() ...@@ -1046,6 +1055,8 @@ void KeySelectorControl::finish()
table->addTopLevelItem( treeItem ); table->addTopLevelItem( treeItem );
} }
} }
module_PutConfig (p_config);
table->resizeColumnToContents( 0 ); table->resizeColumnToContents( 0 );
CONNECT( table, itemClicked( QTreeWidgetItem *, int ), CONNECT( table, itemClicked( QTreeWidgetItem *, int ),
......
...@@ -76,7 +76,6 @@ struct module_cache_t ...@@ -76,7 +76,6 @@ struct module_cache_t
}; };
#if 0
#define MODULE_SHORTCUT_MAX 50 #define MODULE_SHORTCUT_MAX 50
/* The module handle type. */ /* The module handle type. */
...@@ -142,7 +141,6 @@ struct module_t ...@@ -142,7 +141,6 @@ struct module_t
vlc_bool_t b_builtin; /* Set to true if the module is built in */ vlc_bool_t b_builtin; /* Set to true if the module is built in */
vlc_bool_t b_loaded; /* Set to true if the dll is loaded */ vlc_bool_t b_loaded; /* Set to true if the dll is loaded */
}; };
#endif
#define module_InitBank(a) __module_InitBank(VLC_OBJECT(a)) #define module_InitBank(a) __module_InitBank(VLC_OBJECT(a))
......
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