]> git.sesse.net Git - vlc/blobdiff - src/misc/modules.c
* ./src/libvlc.c, ./include/main.h: the root of all objects is now
[vlc] / src / misc / modules.c
index 838903348826fe204a835b62f3815c74c691af5e..ecd1d58a4d5cd143c5dec4918fed7c728e60aee7 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Builtin and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.92 2002/08/21 17:31:58 sam Exp $
+ * $Id: modules.c,v 1.94 2002/10/03 13:21:55 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -123,8 +123,8 @@ void __module_InitBank( vlc_object_t *p_this )
 #endif
 
     /* Everything worked, attach the object */
-    p_this->p_vlc->p_module_bank = p_bank;
-    vlc_object_attach( p_bank, p_this->p_vlc );
+    p_this->p_libvlc->p_module_bank = p_bank;
+    vlc_object_attach( p_bank, p_this->p_libvlc );
 
     return;
 }
@@ -151,11 +151,11 @@ void __module_EndBank( vlc_object_t *p_this )
 {
     module_t * p_next;
 
-    vlc_object_detach( p_this->p_vlc->p_module_bank );
+    vlc_object_detach( p_this->p_libvlc->p_module_bank );
 
-    while( p_this->p_vlc->p_module_bank->i_children )
+    while( p_this->p_libvlc->p_module_bank->i_children )
     {
-        p_next = (module_t *)p_this->p_vlc->p_module_bank->pp_children[0];
+        p_next = (module_t *)p_this->p_libvlc->p_module_bank->pp_children[0];
 
         if( DeleteModule( p_next ) )
         {
@@ -169,7 +169,7 @@ void __module_EndBank( vlc_object_t *p_this )
         }
     }
 
-    vlc_object_destroy( p_this->p_vlc->p_module_bank );
+    vlc_object_destroy( p_this->p_libvlc->p_module_bank );
 
     return;
 }
@@ -588,7 +588,6 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
 static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
                                int i_maxdepth )
 {
-#define PLUGIN_EXT ".so"
     int    i_dirlen;
     DIR *  dir;
     char * psz_file;
@@ -613,7 +612,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
     while( (file = readdir( dir )) )
     {
         struct stat statbuf;
-        int i_len = strlen( file->d_name );
+        int i_len;
 
         /* Skip ".", ".." and anything starting with "." */
         if( !*file->d_name || *file->d_name == '.' )
@@ -621,6 +620,8 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
             continue;
         }
 
+        i_len = strlen( file->d_name );
+
         psz_file = malloc( i_dirlen + 1 /* / */ + i_len + 1 /* \0 */ );
         sprintf( psz_file, "%s/%s", psz_dir, file->d_name );
 
@@ -628,10 +629,10 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
         {
             AllocatePluginDir( p_this, psz_file, i_maxdepth - 1 );
         }
-        else if( i_len > strlen( PLUGIN_EXT )
-                  /* We only load files ending with ".so" */
-                  && !strncmp( file->d_name + i_len - strlen( PLUGIN_EXT ),
-                               PLUGIN_EXT, strlen( PLUGIN_EXT ) ) )
+        else if( i_len > strlen( LIBEXT )
+                  /* We only load files ending with LIBEXT */
+                  && !strncmp( file->d_name + i_len - strlen( LIBEXT ),
+                               LIBEXT, strlen( LIBEXT ) ) )
         {
             AllocatePluginFile( p_this, psz_file );
         }
@@ -679,7 +680,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file )
     /* We need to fill these since they may be needed by CallEntry() */
     p_module->psz_filename = psz_file;
     p_module->handle = handle;
-    p_module->p_symbols = &p_this->p_vlc->p_module_bank->symbols;
+    p_module->p_symbols = &p_this->p_libvlc->p_module_bank->symbols;
 
     /* Initialize the module: fill p_module->psz_object_name, default config */
     if( CallEntry( p_module ) != 0 )
@@ -700,7 +701,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file )
     /* msg_Dbg( p_this, "plugin \"%s\", %s",
                 p_module->psz_object_name, p_module->psz_longname ); */
 
-    vlc_object_attach( p_module, p_this->p_vlc->p_module_bank );
+    vlc_object_attach( p_module, p_this->p_libvlc->p_module_bank );
 
     return 0;
 }
@@ -805,7 +806,7 @@ static int AllocateBuiltinModule( vlc_object_t * p_this,
     /* msg_Dbg( p_this, "builtin \"%s\", %s",
                 p_module->psz_object_name, p_module->psz_longname ); */
 
-    vlc_object_attach( p_module, p_this->p_vlc->p_module_bank );
+    vlc_object_attach( p_module, p_this->p_libvlc->p_module_bank );
 
     return 0;
 }