]> git.sesse.net Git - vlc/blob - src/modules/modules.h
Remove vlc_symbols legacy.
[vlc] / src / modules / modules.h
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 $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 /* Number of tries before we unload an unused module */
25 #define MODULE_HIDE_DELAY 50
26
27 /*****************************************************************************
28  * module_bank_t: the module bank
29  *****************************************************************************
30  * This variable is accessed by any function using modules.
31  *****************************************************************************/
32 struct module_bank_t
33 {
34     VLC_COMMON_MEMBERS
35
36     int              i_usage;
37
38     vlc_bool_t       b_main;
39     vlc_bool_t       b_builtins;
40     vlc_bool_t       b_plugins;
41
42     /* Plugins cache */
43     vlc_bool_t     b_cache;
44     vlc_bool_t     b_cache_dirty;
45     vlc_bool_t     b_cache_delete;
46
47     int            i_cache;
48     module_cache_t **pp_cache;
49
50     int            i_loaded_cache;
51     module_cache_t **pp_loaded_cache;
52 };
53
54 /*****************************************************************************
55  * Module cache description structure
56  *****************************************************************************/
57 struct module_cache_t
58 {
59     /* Mandatory cache entry header */
60     char       *psz_file;
61     int64_t    i_time;
62     int64_t    i_size;
63     vlc_bool_t b_junk;
64
65     /* Optional extra data */
66     module_t *p_module;
67     vlc_bool_t b_used;
68 };
69
70
71 #if 0
72 #define MODULE_SHORTCUT_MAX 50
73
74 /* The module handle type. */
75 #if defined(HAVE_DL_DYLD)
76 #   if defined (HAVE_MACH_O_DYLD_H)
77 #       include <mach-o/dyld.h>
78 #   endif
79 typedef NSModule module_handle_t;
80 #elif defined(HAVE_IMAGE_H)
81 typedef int module_handle_t;
82 #elif defined(WIN32) || defined(UNDER_CE)
83 typedef void * module_handle_t;
84 #elif defined(HAVE_DL_DLOPEN)
85 typedef void * module_handle_t;
86 #elif defined(HAVE_DL_SHL_LOAD)
87 typedef shl_t module_handle_t;
88 #endif
89
90 /**
91  * Internal module descriptor
92  */
93 struct module_t
94 {
95     VLC_COMMON_MEMBERS
96
97     /*
98      * Variables set by the module to identify itself
99      */
100     const char *psz_shortname;                              /**< Module name */
101     const char *psz_longname;                   /**< Module descriptive name */
102     const char *psz_help;        /**< Long help string for "special" modules */
103
104     /*
105      * Variables set by the module to tell us what it can do
106      */
107     const char *psz_program; /**< Program name which will activate the module */
108
109     /** Shortcuts to the module */
110     const char *pp_shortcuts[ MODULE_SHORTCUT_MAX ];
111
112     const char    *psz_capability;                           /**< Capability */
113     int      i_score;                          /**< Score for the capability */
114     uint32_t i_cpu;                           /**< Required CPU capabilities */
115
116     vlc_bool_t b_unloadable;                        /**< Can we be dlclosed? */
117     vlc_bool_t b_reentrant;                           /**< Are we reentrant? */
118     vlc_bool_t b_submodule;                        /**< Is this a submodule? */
119
120     /* Callbacks */
121     int  ( * pf_activate )   ( vlc_object_t * );
122     void ( * pf_deactivate ) ( vlc_object_t * );
123
124     /*
125      * Variables set by the module to store its config options
126      */
127     module_config_t *p_config;             /* Module configuration structure */
128     size_t           confsize;            /* Number of module_config_t items */
129     unsigned int     i_config_items;        /* number of configuration items */
130     unsigned int     i_bool_items;            /* number of bool config items */
131
132     /*
133      * Variables used internally by the module manager
134      */
135     /* Plugin-specific stuff */
136     module_handle_t     handle;                             /* Unique handle */
137     char *              psz_filename;                     /* Module filename */
138
139     vlc_bool_t          b_builtin;  /* Set to true if the module is built in */
140     vlc_bool_t          b_loaded;        /* Set to true if the dll is loaded */
141 };
142 #endif
143
144
145 #define module_InitBank(a)     __module_InitBank(VLC_OBJECT(a))
146 void  __module_InitBank        ( vlc_object_t * );
147 #define module_LoadBuiltins(a) __module_LoadBuiltins(VLC_OBJECT(a))
148 void  __module_LoadBuiltins    ( vlc_object_t * );
149 #define module_LoadPlugins(a)  __module_LoadPlugins(VLC_OBJECT(a))
150 void  __module_LoadPlugins     ( vlc_object_t * );
151 #define module_EndBank(a)      __module_EndBank(VLC_OBJECT(a))
152 void  __module_EndBank         ( vlc_object_t * );
153 #define module_ResetBank(a)    __module_ResetBank(VLC_OBJECT(a))
154 void  __module_ResetBank       ( vlc_object_t * );