VLC  2.1.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
modules.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * modules.h : Module management functions.
3  *****************************************************************************
4  * Copyright (C) 2001 VLC authors and VideoLAN
5  * $Id: bad964ff3a67f8110c9452d34ad470ec612c97a1 $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * 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 
28 
29 /*****************************************************************************
30  * Module cache description structure
31  *****************************************************************************/
33 {
34  /* Mandatory cache entry header */
35  char *path;
36  time_t mtime;
37  off_t size;
38 
39  /* Optional extra data */
41 };
42 
43 
44 #define MODULE_SHORTCUT_MAX 20
45 
46 /** The module handle type */
47 typedef void *module_handle_t;
48 
49 /** Plugin entry point prototype */
50 typedef int (*vlc_plugin_cb) (int (*)(void *, void *, int, ...), void *);
51 
52 /** Main module */
53 int vlc_entry__main (int (*)(void *, void *, int, ...), void *);
54 
55 /**
56  * Internal module descriptor
57  */
58 struct module_t
59 {
63  unsigned submodule_count;
64 
65  /** Shortcuts to the module */
66  unsigned i_shortcuts;
67  char **pp_shortcuts;
68 
69  /*
70  * Variables set by the module to identify itself
71  */
72  char *psz_shortname; /**< Module name */
73  char *psz_longname; /**< Module descriptive name */
74  char *psz_help; /**< Long help string for "special" modules */
75 
76  char *psz_capability; /**< Capability */
77  int i_score; /**< Score for the capability */
78 
79  bool b_loaded; /* Set to true if the dll is loaded */
80  bool b_unloadable; /**< Can we be dlclosed? */
81 
82  /* Callbacks */
83  void *pf_activate;
85 
86  /*
87  * Variables set by the module to store its config options
88  */
89  module_config_t *p_config; /* Module configuration structure */
90  size_t confsize; /* Number of module_config_t items */
91  unsigned int i_config_items; /* number of configuration items */
92  unsigned int i_bool_items; /* number of bool config items */
93 
94  /*
95  * Variables used internally by the module manager
96  */
97  /* Plugin-specific stuff */
98  module_handle_t handle; /* Unique handle */
99  char * psz_filename; /* Module filename */
100  char * domain; /* gettext domain */
101 };
102 
106 
107 void module_InitBank (void);
108 size_t module_LoadPlugins( vlc_object_t * );
109 #define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
110 void module_EndBank (bool);
111 int module_Map (vlc_object_t *, module_t *);
112 
113 ssize_t module_list_cap (module_t ***, const char *);
114 
115 int vlc_bindtextdomain (const char *);
116 
117 /* Low-level OS-dependent handler */
118 int module_Load (vlc_object_t *, const char *, module_handle_t *, bool);
119 void *module_Lookup (module_handle_t, const char *);
121 
122 /* Plugins cache */
124 void CacheDelete(vlc_object_t *, const char *);
125 size_t CacheLoad (vlc_object_t *, const char *, module_cache_t **);
126 
127 struct stat;
128 
129 int CacheAdd (module_cache_t **, size_t *,
130  const char *, const struct stat *, module_t *);
131 void CacheSave (vlc_object_t *, const char *, module_cache_t *, size_t);
132 module_t *CacheFind (module_cache_t *, size_t,
133  const char *, const struct stat *);
134 
135 #endif /* !LIBVLC_MODULES_H */