1 /*****************************************************************************
2 * modules.h : Module management functions.
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
6 * Authors: Samuel Hocevar <sam@zoy.org>
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.
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.
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 *****************************************************************************/
23 /* Number of tries before we unload an unused module */
24 #define MODULE_HIDE_DELAY 10
26 /* The module handle type. */
28 typedef int module_handle_t;
30 typedef void * module_handle_t;
33 /*****************************************************************************
34 * Configuration structure
35 *****************************************************************************/
36 typedef struct module_config_s
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 */
45 /*****************************************************************************
46 * Bank and module description structures
47 *****************************************************************************/
49 /* The main module structure */
50 typedef struct module_s
52 boolean_t b_builtin; /* Set to true if the module is built in */
54 module_handle_t handle; /* Unique handle to refer to the module */
55 char * psz_filename; /* Module filename */
57 char * psz_name; /* Module _unique_ name */
58 char * psz_longname; /* Module descriptive name */
59 char * psz_version; /* Module version */
61 int i_usage; /* Reference counter */
62 int i_unused_delay; /* Delay until module is unloaded */
64 struct module_s * next; /* Next module */
65 struct module_s * prev; /* Previous module */
67 u32 i_capabilities; /* Capability list */
69 module_config_t * p_config; /* Module configuration structure table */
73 /* The module bank structure */
74 typedef struct module_bank_s
76 module_t * first; /* First module of the bank */
78 vlc_mutex_t lock; /* Global lock -- you can't imagine how awful it
79 is to design thread-safe linked lists. */
82 /*****************************************************************************
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 );
90 int module_Need ( module_t * p_module );
91 int module_Unneed ( module_t * p_module );