]> git.sesse.net Git - vlc/blob - include/vlc_modules.h
Qt4 - Pref: start to track functionnalities missing. Directory still segfaults..
[vlc] / include / vlc_modules.h
1 /*****************************************************************************
2  * modules.h : Module descriptor and load 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 #if !defined( __LIBVLC__ )
25   #error You are not libvlc or one of its plugins. You cannot include this file
26 #endif
27
28 #define MODULE_SHORTCUT_MAX 50
29
30 /* The module handle type. */
31 #if defined(HAVE_DL_DYLD)
32 #   if defined (HAVE_MACH_O_DYLD_H)
33 #       include <mach-o/dyld.h>
34 #   endif
35 typedef NSModule module_handle_t;
36 #elif defined(HAVE_IMAGE_H)
37 typedef int module_handle_t;
38 #elif defined(WIN32) || defined(UNDER_CE)
39 typedef void * module_handle_t;
40 #elif defined(HAVE_DL_DLOPEN)
41 typedef void * module_handle_t;
42 #elif defined(HAVE_DL_SHL_LOAD)
43 typedef shl_t module_handle_t;
44 #endif
45
46 /**
47  * Module descriptor
48  */
49 struct module_t
50 {
51     VLC_COMMON_MEMBERS
52
53     /*
54      * Variables set by the module to identify itself
55      */
56     const char *psz_shortname;                              /**< Module name */
57     const char *psz_longname;                   /**< Module descriptive name */
58     const char *psz_help;        /**< Long help string for "special" modules */
59
60     /*
61      * Variables set by the module to tell us what it can do
62      */
63     const char *psz_program; /**< Program name which will activate the module */
64
65     /** Shortcuts to the module */
66     const char *pp_shortcuts[ MODULE_SHORTCUT_MAX ];
67
68     const char    *psz_capability;                           /**< Capability */
69     int      i_score;                          /**< Score for the capability */
70     uint32_t i_cpu;                           /**< Required CPU capabilities */
71
72     vlc_bool_t b_unloadable;                        /**< Can we be dlclosed? */
73     vlc_bool_t b_reentrant;                           /**< Are we reentrant? */
74     vlc_bool_t b_submodule;                        /**< Is this a submodule? */
75
76     /* Callbacks */
77     int  ( * pf_activate )   ( vlc_object_t * );
78     void ( * pf_deactivate ) ( vlc_object_t * );
79
80     /*
81      * Variables set by the module to store its config options
82      */
83     module_config_t *p_config;             /* Module configuration structure */
84     size_t           confsize;            /* Number of module_config_t items */
85     unsigned int     i_config_items;        /* number of configuration items */
86     unsigned int     i_bool_items;            /* number of bool config items */
87
88     /*
89      * Variables used internally by the module manager
90      */
91     /* Plugin-specific stuff */
92     module_handle_t     handle;                             /* Unique handle */
93     char *              psz_filename;                     /* Module filename */
94
95     vlc_bool_t          b_builtin;  /* Set to true if the module is built in */
96     vlc_bool_t          b_loaded;        /* Set to true if the dll is loaded */
97
98     /*
99      * Symbol table we send to the module so that it can access vlc symbols
100      */
101     module_symbols_t *p_symbols;
102 };
103
104 /*****************************************************************************
105  * Exported functions.
106  *****************************************************************************/
107 #define module_Need(a,b,c,d) __module_Need(VLC_OBJECT(a),b,c,d)
108 VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char *, vlc_bool_t ) );
109 #define module_Unneed(a,b) __module_Unneed(VLC_OBJECT(a),b)
110 VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) );
111 #define module_Exists(a,b) __module_Exists(VLC_OBJECT(a),b)
112 VLC_EXPORT( vlc_bool_t,  __module_Exists, ( vlc_object_t *, const char * ) );