* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.29 2001/05/06 04:32:02 sam Exp $
+ * $Id: modules.c,v 1.31 2001/05/30 17:03:12 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
#include "common.h"
#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+#include "netutils.h"
+#include "modules.h"
+
+#include "stream_control.h"
+#include "input_ext-intf.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "audio_output.h"
+#include "interface.h"
#include "intf_msg.h"
-#include "modules.h"
+#include "intf_playlist.h"
+
#ifdef HAVE_DYNAMIC_PLUGINS
# include "modules_core.h"
#endif
#include "modules_builtin.h"
+#include "modules_export.h"
+
+#include "main.h"
-/* Local prototypes */
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
#ifdef HAVE_DYNAMIC_PLUGINS
static int AllocatePluginModule ( char * );
#endif
static int CallSymbol ( module_t *, char * );
#endif
+static module_symbols_t symbols;
+
/*****************************************************************************
* module_InitBank: create the module bank.
*****************************************************************************
p_module_bank->first = NULL;
vlc_mutex_init( &p_module_bank->lock );
+ /*
+ * Store the symbols to be exported
+ */
+ STORE_SYMBOLS( &symbols );
+
/*
* Check all the built-in modules
*/
psz_fullpath = *ppsz_path;
}
- intf_WarnMsgImm( 3, "module: browsing `%s'", psz_fullpath );
+ intf_WarnMsgImm( 1, "module: browsing `%s'", psz_fullpath );
if( (dir = opendir( psz_fullpath )) )
{
}
#endif /* HAVE_DYNAMIC_PLUGINS */
- intf_WarnMsg( 1, "module: module bank initialized" );
+ intf_WarnMsg( 3, "module: module bank initialized" );
return;
}
}
else
{
- intf_WarnMsg( 3, "module: hiding unused plugin module `%s'",
+ intf_WarnMsg( 1, "module: hiding unused plugin module `%s'",
p_module->psz_name );
HideModule( p_module );
if( p_bestmodule != NULL )
{
- intf_WarnMsg( 3, "module: locking module `%s'",
+ intf_WarnMsg( 1, "module: locking module `%s'",
p_bestmodule->psz_name );
}
* so there is no need to check the return value. */
UnlockModule( p_module );
- intf_WarnMsg( 3, "module: unlocking module `%s'", p_module->psz_name );
+ intf_WarnMsg( 1, "module: unlocking module `%s'", p_module->psz_name );
/* We release the global lock */
vlc_mutex_unlock( &p_module_bank->lock );
if( module_load( psz_filename, &handle ) )
{
/* The plugin module couldn't be opened */
- intf_WarnMsgImm( 3, "module warning: cannot open %s (%s)",
+ intf_WarnMsgImm( 1, "module warning: cannot open %s (%s)",
psz_filename, module_error() );
return( -1 );
}
/* We need to fill these since they may be needed by CallSymbol() */
p_module->is.plugin.psz_filename = psz_filename;
p_module->is.plugin.handle = handle;
+ p_module->p_symbols = &symbols;
/* Initialize the module : fill p_module->psz_name, etc. */
if( CallSymbol( p_module, "InitModule" ) != 0 )
*****************************************************************************/
static int CallSymbol( module_t * p_module, char * psz_name )
{
- typedef int ( symbol_t ) ( module_t * p_module );
- symbol_t * p_symbol;
+ int (* pf_symbol) ( module_t * p_module );
/* Try to resolve the symbol */
- p_symbol = module_getsymbol( p_module->is.plugin.handle, psz_name );
+ pf_symbol = module_getsymbol( p_module->is.plugin.handle, psz_name );
- if( !p_symbol )
+ if( pf_symbol == NULL )
{
/* We couldn't load the symbol */
- intf_WarnMsg( 3, "module warning: "
+ intf_WarnMsg( 1, "module warning: "
"cannot find symbol %s in module %s (%s)",
psz_name, p_module->is.plugin.psz_filename,
module_error() );
}
/* We can now try to call the symbol */
- if( p_symbol( p_module ) != 0 )
+ if( pf_symbol( p_module ) != 0 )
{
/* With a well-written module we shouldn't have to print an
* additional error message here, but just make sure. */