]> git.sesse.net Git - vlc/blob - include/modules.h
. splitted modules.h into modules.h and modules_core.h to enable
[vlc] / include / modules.h
1 /*****************************************************************************
2  * modules.h : Module management functions.
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  *
6  * Authors: Samuel Hocevar <sam@zoy.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
21  *****************************************************************************/
22
23 /* Number of tries before we unload an unused module */
24 #define MODULE_HIDE_DELAY 10
25
26 /* The module handle type. */
27 #ifdef SYS_BEOS
28 typedef int     module_handle_t;
29 #else
30 typedef void *  module_handle_t;
31 #endif
32
33 /*****************************************************************************
34  * Configuration structure
35  *****************************************************************************/
36 typedef struct module_config_s
37 {
38     int         i_type;                         /* Configuration widget type */
39     char *      psz_text;        /* Text commenting or describing the widget */
40     char *      psz_name;                                   /* Variable name */
41     void *      p_getlist;          /* Function to call to get a choice list */
42     void *      p_change;        /* Function to call when commiting a change */
43 } module_config_t;
44
45 /*****************************************************************************
46  * Bank and module description structures
47  *****************************************************************************/
48
49 /* The main module structure */
50 typedef struct module_s
51 {
52     boolean_t           b_builtin;  /* Set to true if the module is built in */
53
54     module_handle_t     handle;      /* Unique handle to refer to the module */
55     char *              psz_filename;                     /* Module filename */
56
57     char *              psz_name;                    /* Module _unique_ name */
58     char *              psz_longname;             /* Module descriptive name */
59     char *              psz_version;                       /* Module version */
60
61     int                 i_usage;                        /* Reference counter */
62     int                 i_unused_delay;    /* Delay until module is unloaded */
63
64     struct module_s *   next;                                 /* Next module */
65     struct module_s *   prev;                             /* Previous module */
66
67     u32                 i_capabilities;                   /* Capability list */
68
69     module_config_t *   p_config;    /* Module configuration structure table */
70
71 } module_t;
72
73 /* The module bank structure */
74 typedef struct module_bank_s
75 {
76     module_t *          first; /* First module of the bank */
77
78     vlc_mutex_t         lock;  /* Global lock -- you can't imagine how awful it
79                                   is to design thread-safe linked lists. */
80 } module_bank_t;
81
82 /*****************************************************************************
83  * Exported functions.
84  *****************************************************************************/
85 module_bank_t * module_InitBank     ( void );
86 int             module_DestroyBank  ( module_bank_t * p_bank );
87 int             module_ResetBank    ( module_bank_t * p_bank );
88 void            module_ManageBank   ( module_bank_t * p_bank );
89
90 int module_Need    ( module_t * p_module );
91 int module_Unneed  ( module_t * p_module );
92