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