]> git.sesse.net Git - vlc/blob - src/modules/modules.h
Remove write-only module_bank_t.b_cache_dirty
[vlc] / src / modules / modules.h
1 /*****************************************************************************
2  * modules.h : Module management functions.
3  *****************************************************************************
4  * Copyright (C) 2001 the VideoLAN team
5  * $Id$
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 #ifndef LIBVLC_MODULES_H
25 # define LIBVLC_MODULES_H 1
26
27 typedef struct module_cache_t module_cache_t;
28
29 /*****************************************************************************
30  * module_bank_t: the module bank
31  *****************************************************************************
32  * This variable is accessed by any function using modules.
33  *****************************************************************************/
34 typedef struct module_bank_t
35 {
36     unsigned         i_usage;
37
38     /* Plugins cache */
39     bool             b_cache;
40
41     int            i_cache;
42     module_cache_t **pp_cache;
43
44     int            i_loaded_cache;
45     module_cache_t **pp_loaded_cache;
46
47     module_t       *head;
48 } module_bank_t;
49
50 /*****************************************************************************
51  * Module cache description structure
52  *****************************************************************************/
53 struct module_cache_t
54 {
55     /* Mandatory cache entry header */
56     char  *path;
57     time_t mtime;
58     off_t  size;
59
60     /* Optional extra data */
61     module_t *p_module;
62 };
63
64
65 #define MODULE_SHORTCUT_MAX 20
66
67 /* The module handle type. */
68 #if defined(HAVE_DL_DYLD) && !defined(__x86_64__)
69 #   if defined (HAVE_MACH_O_DYLD_H)
70 #       include <mach-o/dyld.h>
71 #   endif
72 typedef NSModule module_handle_t;
73 #elif defined(HAVE_IMAGE_H)
74 typedef int module_handle_t;
75 #elif defined(WIN32) || defined(UNDER_CE) || defined(__SYMBIAN32__)
76 typedef void * module_handle_t;
77 #elif defined(HAVE_DL_DLOPEN)
78 typedef void * module_handle_t;
79 #elif defined(HAVE_DL_SHL_LOAD)
80 typedef shl_t module_handle_t;
81 #endif
82
83 /**
84  * Internal module descriptor
85  */
86 struct module_t
87 {
88     char       *psz_object_name;
89     gc_object_t vlc_gc_data;
90
91     module_t   *next;
92     module_t   *parent;
93     module_t   *submodule;
94     unsigned    submodule_count;
95
96     /** Shortcuts to the module */
97     unsigned    i_shortcuts;
98     char        **pp_shortcuts;
99
100     /*
101      * Variables set by the module to identify itself
102      */
103     char *psz_shortname;                              /**< Module name */
104     char *psz_longname;                   /**< Module descriptive name */
105     char *psz_help;        /**< Long help string for "special" modules */
106
107     char    *psz_capability;                                 /**< Capability */
108     int      i_score;                          /**< Score for the capability */
109
110     bool          b_builtin;  /* Set to true if the module is built in */
111     bool          b_loaded;        /* Set to true if the dll is loaded */
112     bool b_unloadable;                        /**< Can we be dlclosed? */
113
114     /* Callbacks */
115     void *pf_activate;
116     void *pf_deactivate;
117
118     /*
119      * Variables set by the module to store its config options
120      */
121     module_config_t *p_config;             /* Module configuration structure */
122     size_t           confsize;            /* Number of module_config_t items */
123     unsigned int     i_config_items;        /* number of configuration items */
124     unsigned int     i_bool_items;            /* number of bool config items */
125
126     /*
127      * Variables used internally by the module manager
128      */
129     /* Plugin-specific stuff */
130     module_handle_t     handle;                             /* Unique handle */
131     char *              psz_filename;                     /* Module filename */
132     char *              domain;                            /* gettext domain */
133 };
134
135 module_t *vlc_module_create (void);
136 module_t *vlc_submodule_create (module_t *module);
137
138 void  module_InitBank( vlc_object_t * );
139 #define module_InitBank(a) module_InitBank(VLC_OBJECT(a))
140 void module_LoadPlugins( vlc_object_t * );
141 #define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
142 void module_EndBank( vlc_object_t *, bool );
143 #define module_EndBank(a,b) module_EndBank(VLC_OBJECT(a), b)
144
145 int vlc_bindtextdomain (const char *);
146
147 /* Low-level OS-dependent handler */
148 int  module_Load   (vlc_object_t *, const char *, module_handle_t *);
149 int  module_Call   (vlc_object_t *obj, module_t *);
150 void module_Unload (module_handle_t);
151
152 /* Plugins cache */
153 void   CacheMerge (vlc_object_t *, module_t *, module_t *);
154 void   CacheDelete(vlc_object_t *, const char *);
155 void   CacheLoad  (vlc_object_t *, module_bank_t *, const char *);
156 void   CacheSave  (vlc_object_t *, const char *, module_cache_t *const *, size_t);
157 module_cache_t * CacheFind (module_bank_t *, const char *, time_t, off_t);
158
159 #endif /* !LIBVLC_MODULES_H */