1 /*****************************************************************************
2 * modules.h : Module management functions.
3 *****************************************************************************
4 * Copyright (C) 2001 the VideoLAN team
5 * $Id: modules.h 17958 2006-11-22 17:13:24Z courmisch $
7 * Authors: Samuel Hocevar <sam@zoy.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /* Number of tries before we unload an unused module */
25 #define MODULE_HIDE_DELAY 50
27 /*****************************************************************************
28 * module_bank_t: the module bank
29 *****************************************************************************
30 * This variable is accessed by any function using modules.
31 *****************************************************************************/
37 #ifndef HAVE_SHARED_LIBVLC
38 module_symbols_t symbols;
42 vlc_bool_t b_builtins;
47 vlc_bool_t b_cache_dirty;
48 vlc_bool_t b_cache_delete;
51 module_cache_t **pp_cache;
54 module_cache_t **pp_loaded_cache;
57 /*****************************************************************************
58 * Module cache description structure
59 *****************************************************************************/
62 /* Mandatory cache entry header */
68 /* Optional extra data */
75 #define MODULE_SHORTCUT_MAX 50
77 /* The module handle type. */
78 #if defined(HAVE_DL_DYLD)
79 # if defined (HAVE_MACH_O_DYLD_H)
80 # include <mach-o/dyld.h>
82 typedef NSModule module_handle_t;
83 #elif defined(HAVE_IMAGE_H)
84 typedef int module_handle_t;
85 #elif defined(WIN32) || defined(UNDER_CE)
86 typedef void * module_handle_t;
87 #elif defined(HAVE_DL_DLOPEN)
88 typedef void * module_handle_t;
89 #elif defined(HAVE_DL_SHL_LOAD)
90 typedef shl_t module_handle_t;
94 * Internal module descriptor
101 * Variables set by the module to identify itself
103 const char *psz_shortname; /**< Module name */
104 const char *psz_longname; /**< Module descriptive name */
105 const char *psz_help; /**< Long help string for "special" modules */
108 * Variables set by the module to tell us what it can do
110 const char *psz_program; /**< Program name which will activate the module */
112 /** Shortcuts to the module */
113 const char *pp_shortcuts[ MODULE_SHORTCUT_MAX ];
115 const char *psz_capability; /**< Capability */
116 int i_score; /**< Score for the capability */
117 uint32_t i_cpu; /**< Required CPU capabilities */
119 vlc_bool_t b_unloadable; /**< Can we be dlclosed? */
120 vlc_bool_t b_reentrant; /**< Are we reentrant? */
121 vlc_bool_t b_submodule; /**< Is this a submodule? */
124 int ( * pf_activate ) ( vlc_object_t * );
125 void ( * pf_deactivate ) ( vlc_object_t * );
128 * Variables set by the module to store its config options
130 module_config_t *p_config; /* Module configuration structure */
131 size_t confsize; /* Number of module_config_t items */
132 unsigned int i_config_items; /* number of configuration items */
133 unsigned int i_bool_items; /* number of bool config items */
136 * Variables used internally by the module manager
138 /* Plugin-specific stuff */
139 module_handle_t handle; /* Unique handle */
140 char * psz_filename; /* Module filename */
142 vlc_bool_t b_builtin; /* Set to true if the module is built in */
143 vlc_bool_t b_loaded; /* Set to true if the dll is loaded */
145 #ifndef HAVE_SHARED_LIBVLC
146 /* Legacy symbols table */
147 module_symbols_t *p_symbols;
153 #define module_InitBank(a) __module_InitBank(VLC_OBJECT(a))
154 void __module_InitBank ( vlc_object_t * );
155 #define module_LoadBuiltins(a) __module_LoadBuiltins(VLC_OBJECT(a))
156 void __module_LoadBuiltins ( vlc_object_t * );
157 #define module_LoadPlugins(a) __module_LoadPlugins(VLC_OBJECT(a))
158 void __module_LoadPlugins ( vlc_object_t * );
159 #define module_EndBank(a) __module_EndBank(VLC_OBJECT(a))
160 void __module_EndBank ( vlc_object_t * );
161 #define module_ResetBank(a) __module_ResetBank(VLC_OBJECT(a))
162 void __module_ResetBank ( vlc_object_t * );