]> git.sesse.net Git - vlc/blobdiff - src/modules/modules.c
module_GetHelp
[vlc] / src / modules / modules.c
index a31840f7e38c06b0fc05fa1f5b482409c2dfead6..2189bc52155c9c4a5fd011e38dad7399ad430dcd 100644 (file)
@@ -25,6 +25,7 @@
  *****************************************************************************/
 
 #include <vlc/vlc.h>
+#include "../libvlc.h"
 
 /* Some faulty libcs have a broken struct dirent when _FILE_OFFSET_BITS
  * is set to 64. Don't try to be cleverer. */
@@ -84,6 +85,7 @@
 #include "vlc_stream.h"
 #include "vlc_access.h"
 #include "vlc_demux.h"
+#include "vlc_codec.h"
 
 #include "vlc_vout.h"
 #include "vlc_vout_synchro.h"
@@ -194,13 +196,6 @@ void __module_InitBank( vlc_object_t *p_this )
     p_bank->b_cache = p_bank->b_cache_dirty =
         p_bank->b_cache_delete = VLC_FALSE;
 
-    /*
-     * Store the symbols to be exported
-     */
-#if defined (HAVE_DYNAMIC_PLUGINS) && !defined (HAVE_SHARED_LIBVLC)
-    STORE_SYMBOLS( &p_bank->symbols );
-#endif
-
     /* Everything worked, attach the object */
     p_libvlc_global->p_module_bank = p_bank;
     vlc_object_attach( p_bank, p_libvlc_global );
@@ -388,6 +383,38 @@ void __module_LoadPlugins( vlc_object_t * p_this )
 #endif
 }
 
+/*****************************************************************************
+ * module_IsCapable: checks whether a module implements a capability.
+ *****************************************************************************/
+vlc_bool_t module_IsCapable( const module_t *m, const char *cap )
+{
+    return !strcmp( m->psz_capability, cap );
+}
+
+/*****************************************************************************
+ * module_GetObjName: internal name of a module.
+ *****************************************************************************/
+const char *module_GetObjName( const module_t *m )
+{
+    return m->psz_object_name;
+}
+
+/*****************************************************************************
+ * module_GetName: human-friendly name of a module.
+ *****************************************************************************/
+const char *module_GetName( const module_t *m, vlc_bool_t long_name )
+{
+    if( long_name && ( m->psz_longname != NULL) )
+        return m->psz_longname;
+    
+    return m->psz_shortname ?: m->psz_object_name;
+}
+
+const char *module_GetHelp( const module_t *m )
+{
+    return m->psz_help;
+}
+
 /*****************************************************************************
  * module_Need: return the best module function, given a capability list.
  *****************************************************************************
@@ -484,7 +511,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
         p_module = (module_t *)p_all->p_values[i_which_module].p_object;
 
         /* Test that this module can do what we need */
-        if( strcmp( p_module->psz_capability, psz_capability ) )
+        if( !module_IsCapable( p_module, psz_capability ) )
         {
             /* Don't recurse through the sub-modules because vlc_list_find()
              * will list them anyway. */
@@ -1204,7 +1231,7 @@ static void UndupModule( module_t *p_module )
     }
 
     free( (void*)p_module->psz_object_name );
-    free( (void*)p_module->psz_capability );
+    free( p_module->psz_capability );
     free( (void*)p_module->psz_shortname );
     free( (void*)p_module->psz_longname );
     free( (void*)p_module->psz_help );
@@ -2205,9 +2232,6 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache,
 
     p_cache->pf_activate = p_module->pf_activate;
     p_cache->pf_deactivate = p_module->pf_deactivate;
-#ifndef HAVE_SHARED_LIBVLC
-    p_cache->p_symbols = p_module->p_symbols;
-#endif
     p_cache->handle = p_module->handle;
 
     for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ )
@@ -2216,9 +2240,6 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache,
         module_t *p_cchild = (module_t*)p_cache->pp_children[i_submodule];
         p_cchild->pf_activate = p_child->pf_activate;
         p_cchild->pf_deactivate = p_child->pf_deactivate;
-#ifndef HAVE_SHARED_LIBVLC
-        p_cchild->p_symbols = p_child->p_symbols;
-#endif
     }
 
     p_cache->b_loaded = VLC_TRUE;