]> git.sesse.net Git - vlc/blob - include/modules.h
. merged the YUV plugins in the same directory to avoid too much code
[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 20
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  * Module capabilities.
35  *****************************************************************************/
36
37 #define MODULE_CAPABILITY_NULL     0        /* The Module can't do anything */
38 #define MODULE_CAPABILITY_INTF     1 <<  0  /* Interface */
39 #define MODULE_CAPABILITY_INPUT    1 <<  1  /* Input */
40 #define MODULE_CAPABILITY_DECAPS   1 <<  2  /* Decaps */
41 #define MODULE_CAPABILITY_ADEC     1 <<  3  /* Audio decoder */
42 #define MODULE_CAPABILITY_VDEC     1 <<  4  /* Video decoder */
43 #define MODULE_CAPABILITY_IDCT     1 <<  5  /* IDCT transformation */
44 #define MODULE_CAPABILITY_AOUT     1 <<  6  /* Audio output */
45 #define MODULE_CAPABILITY_VOUT     1 <<  7  /* Video output */
46 #define MODULE_CAPABILITY_YUV      1 <<  8  /* YUV colorspace conversion */
47 #define MODULE_CAPABILITY_AFX      1 <<  9  /* Audio effects */
48 #define MODULE_CAPABILITY_VFX      1 << 10  /* Video effects */
49
50 /* FIXME: not yet used */
51 typedef struct probedata_s
52 {
53     struct
54     {
55         char * psz_data;
56     } aout;
57 } probedata_t;
58
59 /* FIXME: find a nicer way to do this. */
60 typedef struct function_list_s
61 {
62     int ( * pf_probe ) ( probedata_t * p_data );
63
64     union
65     {
66         struct
67         {
68             int  ( * pf_open )       ( struct aout_thread_s * p_aout );
69             int  ( * pf_setformat )  ( struct aout_thread_s * p_aout );
70             long ( * pf_getbufinfo ) ( struct aout_thread_s * p_aout,
71                                        long l_buffer_info );
72             void ( * pf_play )       ( struct aout_thread_s * p_aout,
73                                        byte_t *buffer, int i_size );
74             void ( * pf_close )      ( struct aout_thread_s * p_aout );
75         } aout;
76
77         struct
78         {
79             void ( * pf_init )         ( struct vdec_thread_s * p_vdec );
80             void ( * pf_sparse_idct )  ( struct vdec_thread_s * p_vdec,
81                                          dctelem_t * p_block,
82                                          int i_sparse_pos );
83             void ( * pf_idct )         ( struct vdec_thread_s * p_vdec,
84                                          dctelem_t * p_block,
85                                          int i_idontcare );
86         } idct;
87
88         struct
89         {
90             int  ( * pf_init )         ( struct vout_thread_s * p_vout );
91             int  ( * pf_reset )        ( struct vout_thread_s * p_vout );
92             void ( * pf_end )          ( struct vout_thread_s * p_vout );
93         } yuv;
94
95     } functions;
96
97 } function_list_t;
98
99 typedef struct module_functions_s
100 {
101     /* XXX: The order here has to be the same as above for the #defines */
102     function_list_t intf;
103     function_list_t input;
104     function_list_t decaps;
105     function_list_t adec;
106     function_list_t vdec;
107     function_list_t idct;
108     function_list_t aout;
109     function_list_t vout;
110     function_list_t yuv;
111     function_list_t afx;
112     function_list_t vfx;
113
114 } module_functions_t;
115
116 typedef struct module_functions_s * p_module_functions_t;
117
118 /*****************************************************************************
119  * Macros used to build the configuration structure.
120  *****************************************************************************/
121
122 /* Mandatory first and last parts of the structure */
123 #define MODULE_CONFIG_ITEM_START       0xdead  /* The main window */
124 #define MODULE_CONFIG_ITEM_END         0xbeef  /* End of the window */
125
126 /* Configuration widgets */
127 #define MODULE_CONFIG_ITEM_WINDOW      0x0001  /* The main window */
128 #define MODULE_CONFIG_ITEM_PANE        0x0002  /* A notebook pane */
129 #define MODULE_CONFIG_ITEM_FRAME       0x0003  /* A frame */
130 #define MODULE_CONFIG_ITEM_COMMENT     0x0004  /* A comment text */
131 #define MODULE_CONFIG_ITEM_STRING      0x0005  /* A string */
132 #define MODULE_CONFIG_ITEM_FILE        0x0006  /* A file selector */
133 #define MODULE_CONFIG_ITEM_CHECK       0x0007  /* A checkbox */
134 #define MODULE_CONFIG_ITEM_CHOOSE      0x0008  /* A choose box */
135 #define MODULE_CONFIG_ITEM_RADIO       0x0009  /* A radio box */
136 #define MODULE_CONFIG_ITEM_SCALE       0x000a  /* A horizontal ruler */
137 #define MODULE_CONFIG_ITEM_SPIN        0x000b  /* A numerical selector */
138
139 typedef struct module_config_s
140 {
141     int         i_type;                         /* Configuration widget type */
142     char *      psz_text;        /* Text commenting or describing the widget */
143     char *      psz_name;                                   /* Variable name */
144     void *      p_getlist;          /* Function to call to get a choice list */
145     void *      p_change;        /* Function to call when commiting a change */
146 } module_config_t;
147
148 /*****************************************************************************
149  * Bank and module description structures
150  *****************************************************************************/
151
152 /* The module bank structure */
153 typedef struct module_bank_s
154 {
155     struct module_s *   first; /* First module of the bank */
156
157     vlc_mutex_t         lock;  /* Global lock -- you can't imagine how awful it
158                                   is to design thread-safe linked lists. */
159 } module_bank_t;
160
161 /* The module description structure */
162 typedef struct module_s
163 {
164     boolean_t           b_builtin;  /* Set to true if the module is built in */
165
166     module_handle_t     handle;      /* Unique handle to refer to the module */
167     char *              psz_filename;                     /* Module filename */
168
169     char *              psz_name;                    /* Module _unique_ name */
170     char *              psz_longname;             /* Module descriptive name */
171     char *              psz_version;                       /* Module version */
172
173     int                 i_usage;                        /* Reference counter */
174     int                 i_unused_delay;    /* Delay until module is unloaded */
175
176     struct module_s *   next;                                 /* Next module */
177     struct module_s *   prev;                             /* Previous module */
178
179     module_config_t *   p_config;    /* Module configuration structure table */
180
181     u32                     i_capabilities;               /* Capability list */
182     p_module_functions_t    p_functions;             /* Capability functions */
183
184 } module_t;
185
186 /*****************************************************************************
187  * Exported functions.
188  *****************************************************************************/
189 module_bank_t * module_CreateBank   ( void );
190 void            module_InitBank     ( module_bank_t * p_bank );
191 void            module_DestroyBank  ( module_bank_t * p_bank );
192 void            module_ResetBank    ( module_bank_t * p_bank );
193 void            module_ManageBank   ( module_bank_t * p_bank );
194
195 module_t *      module_Need         ( module_bank_t *p_bank,
196                                       int i_capabilities, void *p_data );
197 void            module_Unneed       ( module_bank_t * p_bank,
198                                       module_t * p_module );
199