]> git.sesse.net Git - vlc/blobdiff - src/misc/modules.c
* Fixed the BeOS compile typo.
[vlc] / src / misc / modules.c
index 6ef1ebc1ad9b8054392d6823053f05e2549b864b..aad88dfc4af94f2ee16a2942cfc72d251c69c14a 100644 (file)
@@ -2,7 +2,7 @@
  * 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
@@ -79,6 +98,8 @@ static int HideModule   ( module_t * );
 static int CallSymbol   ( module_t *, char * );
 #endif
 
+static module_symbols_t symbols;
+
 /*****************************************************************************
  * module_InitBank: create the module bank.
  *****************************************************************************
@@ -105,6 +126,11 @@ void module_InitBank( void )
     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
      */
@@ -145,7 +171,7 @@ void module_InitBank( void )
             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 )) )
         {
@@ -187,7 +213,7 @@ void module_InitBank( void )
     }
 #endif /* HAVE_DYNAMIC_PLUGINS */
 
-    intf_WarnMsg( 1, "module: module bank initialized" );
+    intf_WarnMsg( 3, "module: module bank initialized" );
 
     return;
 }
@@ -263,7 +289,7 @@ void module_ManageBank( void )
             }
             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 );
 
@@ -352,7 +378,7 @@ module_t * module_Need( int i_capabilities, void *p_data )
 
     if( p_bestmodule != NULL )
     {
-        intf_WarnMsg( 3, "module: locking module `%s'",
+        intf_WarnMsg( 1, "module: locking module `%s'",
                       p_bestmodule->psz_name );
     }
 
@@ -375,7 +401,7 @@ void module_Unneed( module_t * p_module )
      * 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 );
@@ -404,7 +430,7 @@ static int AllocatePluginModule( char * psz_filename )
     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 );
     }
@@ -422,6 +448,7 @@ static int AllocatePluginModule( char * psz_filename )
     /* 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 )
@@ -834,16 +861,15 @@ static int HideModule( module_t * p_module )
  *****************************************************************************/
 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() );
@@ -851,7 +877,7 @@ static int CallSymbol( module_t * p_module, char * psz_name )
     }
 
     /* 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. */