00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define CONFIG_HINT_END 0x0001
00034 #define CONFIG_HINT_CATEGORY 0x0002
00035 #define CONFIG_HINT_SUBCATEGORY 0x0003
00036 #define CONFIG_HINT_SUBCATEGORY_END 0x0004
00037 #define CONFIG_HINT_USAGE 0x0005
00038
00039 #define CONFIG_CATEGORY 0x0006
00040 #define CONFIG_SUBCATEGORY 0x0007
00041 #define CONFIG_SECTION 0x0008
00042
00043 #define CONFIG_HINT 0x000F
00044
00045
00046 #define CONFIG_ITEM_STRING 0x0010
00047 #define CONFIG_ITEM_FILE 0x0020
00048 #define CONFIG_ITEM_MODULE 0x0030
00049 #define CONFIG_ITEM_INTEGER 0x0040
00050 #define CONFIG_ITEM_BOOL 0x0050
00051 #define CONFIG_ITEM_FLOAT 0x0060
00052 #define CONFIG_ITEM_DIRECTORY 0x0070
00053 #define CONFIG_ITEM_KEY 0x0080
00054 #define CONFIG_ITEM_MODULE_CAT 0x0090
00055 #define CONFIG_ITEM_MODULE_LIST 0x00A0
00056 #define CONFIG_ITEM_MODULE_LIST_CAT 0x00B0
00057
00058 #define CONFIG_ITEM 0x00F0
00059
00060
00061
00062
00063 #define CAT_INTERFACE 1
00064 #define SUBCAT_INTERFACE_GENERAL 101
00065 #define SUBCAT_INTERFACE_CONTROL 102
00066 #define SUBCAT_INTERFACE_HOTKEYS 103
00067
00068 #define CAT_AUDIO 2
00069 #define SUBCAT_AUDIO_GENERAL 201
00070 #define SUBCAT_AUDIO_AOUT 202
00071 #define SUBCAT_AUDIO_AFILTER 203
00072 #define SUBCAT_AUDIO_VISUAL 204
00073 #define SUBCAT_AUDIO_MISC 205
00074
00075 #define CAT_VIDEO 3
00076 #define SUBCAT_VIDEO_GENERAL 301
00077 #define SUBCAT_VIDEO_VOUT 302
00078 #define SUBCAT_VIDEO_VFILTER 303
00079 #define SUBCAT_VIDEO_TEXT 304
00080 #define SUBCAT_VIDEO_SUBPIC 305
00081
00082 #define CAT_INPUT 4
00083 #define SUBCAT_INPUT_GENERAL 401
00084 #define SUBCAT_INPUT_ACCESS 402
00085 #define SUBCAT_INPUT_ACCESS_FILTER 403
00086 #define SUBCAT_INPUT_DEMUX 404
00087 #define SUBCAT_INPUT_VCODEC 405
00088 #define SUBCAT_INPUT_ACODEC 406
00089 #define SUBCAT_INPUT_SCODEC 407
00090
00091 #define CAT_SOUT 5
00092 #define SUBCAT_SOUT_GENERAL 501
00093 #define SUBCAT_SOUT_STREAM 502
00094 #define SUBCAT_SOUT_MUX 503
00095 #define SUBCAT_SOUT_ACO 504
00096 #define SUBCAT_SOUT_PACKETIZER 505
00097 #define SUBCAT_SOUT_SAP 506
00098 #define SUBCAT_SOUT_VOD 507
00099
00100 #define CAT_ADVANCED 6
00101 #define SUBCAT_ADVANCED_CPU 601
00102 #define SUBCAT_ADVANCED_MISC 602
00103 #define SUBCAT_ADVANCED_NETWORK 603
00104 #define SUBCAT_ADVANCED_XML 604
00105
00106 #define CAT_PLAYLIST 7
00107 #define SUBCAT_PLAYLIST_GENERAL 701
00108 #define SUBCAT_PLAYLIST_SD 702
00109 #define SUBCAT_PLAYLIST_EXPORT 703
00110
00111 struct config_category_t
00112 {
00113 int i_id;
00114 char *psz_name;
00115 char *psz_help;
00116 };
00117
00118 struct module_config_t
00119 {
00120 int i_type;
00121 char *psz_type;
00122 char *psz_name;
00123 char i_short;
00124 char *psz_text;
00125 char *psz_longtext;
00126 char *psz_value;
00127 int i_value;
00128 float f_value;
00129 int i_min;
00130 int i_max;
00131 float f_min;
00132 float f_max;
00133
00134
00135 vlc_callback_t pf_callback;
00136 void *p_callback_data;
00137
00138
00139 char **ppsz_list;
00140 int *pi_list;
00141 char **ppsz_list_text;
00142 int i_list;
00143
00144
00145 vlc_callback_t *ppf_action;
00146 char **ppsz_action_text;
00147 int i_action;
00148
00149
00150 char *psz_current;
00151 vlc_bool_t b_strict;
00152
00153 vlc_mutex_t *p_lock;
00154 vlc_bool_t b_dirty;
00155 vlc_bool_t b_advanced;
00156
00157
00158 char *psz_value_orig;
00159 int i_value_orig;
00160 float f_value_orig;
00161
00162
00163 char *psz_value_saved;
00164 int i_value_saved;
00165 float f_value_saved;
00166 vlc_bool_t b_autosave;
00167 };
00168
00169
00170
00171
00172
00173 VLC_EXPORT( int, __config_GetType, (vlc_object_t *, const char *) );
00174 VLC_EXPORT( int, __config_GetInt, (vlc_object_t *, const char *) );
00175 VLC_EXPORT( void, __config_PutInt, (vlc_object_t *, const char *, int) );
00176 VLC_EXPORT( float, __config_GetFloat, (vlc_object_t *, const char *) );
00177 VLC_EXPORT( void, __config_PutFloat, (vlc_object_t *, const char *, float) );
00178 VLC_EXPORT( char *, __config_GetPsz, (vlc_object_t *, const char *) );
00179 VLC_EXPORT( void, __config_PutPsz, (vlc_object_t *, const char *, const char *) );
00180
00181 VLC_EXPORT( int, __config_LoadCmdLine, ( vlc_object_t *, int *, char *[], vlc_bool_t ) );
00182 VLC_EXPORT( char *, config_GetHomeDir, ( void ) );
00183 VLC_EXPORT( char *, config_GetUserDir, ( void ) );
00184 VLC_EXPORT( int, __config_LoadConfigFile, ( vlc_object_t *, const char * ) );
00185 VLC_EXPORT( int, __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
00186 VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) );
00187
00188 VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) );
00189 VLC_EXPORT( module_t *, config_FindModule,( vlc_object_t *, const char * ) );
00190
00191 VLC_EXPORT( void, config_Duplicate, ( module_t *, module_config_t * ) );
00192 void config_Free ( module_t * );
00193
00194 VLC_EXPORT( void, config_SetCallbacks, ( module_config_t *, module_config_t * ) );
00195 VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) );
00196
00197 #define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
00198 #define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
00199 #define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c)
00200 #define config_GetFloat(a,b) __config_GetFloat(VLC_OBJECT(a),b)
00201 #define config_PutFloat(a,b,c) __config_PutFloat(VLC_OBJECT(a),b,c)
00202 #define config_GetPsz(a,b) __config_GetPsz(VLC_OBJECT(a),b)
00203 #define config_PutPsz(a,b,c) __config_PutPsz(VLC_OBJECT(a),b,c)
00204
00205 #define config_LoadCmdLine(a,b,c,d) __config_LoadCmdLine(VLC_OBJECT(a),b,c,d)
00206 #define config_LoadConfigFile(a,b) __config_LoadConfigFile(VLC_OBJECT(a),b)
00207 #define config_SaveConfigFile(a,b) __config_SaveConfigFile(VLC_OBJECT(a),b)
00208 #define config_ResetAll(a) __config_ResetAll(VLC_OBJECT(a))
00209
00210
00211 int config_CreateDir( vlc_object_t *, char * );
00212 int config_AutoSaveConfigFile( vlc_object_t * );
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 #define set_category( i_id ) \
00228 i_config++; \
00229 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00230 (i_config+11) * sizeof(module_config_t)); \
00231 { static module_config_t tmp = { CONFIG_CATEGORY, NULL, NULL , '\0', NULL, NULL, NULL, i_id }; p_config[ i_config ] = tmp; }
00232
00233 #define set_subcategory( i_id ) \
00234 i_config++; \
00235 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00236 (i_config+11) * sizeof(module_config_t)); \
00237 { static module_config_t tmp = { CONFIG_SUBCATEGORY, NULL, NULL , '\0', NULL, NULL, NULL, i_id }; p_config[ i_config ] = tmp; }
00238
00239 #define set_section( text, longtext) \
00240 i_config++; \
00241 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00242 (i_config+11) * sizeof(module_config_t)); \
00243 { static module_config_t tmp = { CONFIG_SECTION, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; }
00244
00245 #define add_category_hint( text, longtext, advc ) \
00246 i_config++; \
00247 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00248 (i_config+11) * sizeof(module_config_t)); \
00249 { static module_config_t tmp = { CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; p_config[i_config].b_advanced = advc; }
00250
00251 #define add_subcategory_hint( text, longtext ) \
00252 i_config++; \
00253 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00254 (i_config+11) * sizeof(module_config_t)); \
00255 { static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; }
00256
00257
00258 #define end_subcategory_hint \
00259 i_config++; \
00260 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00261 (i_config+11) * sizeof(module_config_t)); \
00262 { static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, '\0' }; p_config[ i_config ] = tmp; }
00263 #define add_usage_hint( text ) \
00264 i_config++; \
00265 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00266 (i_config+11) * sizeof(module_config_t)); \
00267 { static module_config_t tmp = { CONFIG_HINT_USAGE, NULL, NULL, '\0', text }; p_config[ i_config ] = tmp; }
00268
00269
00270 #define add_string( name, psz_value, p_callback, text, longtext, advc ) \
00271 i_config++; \
00272 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00273 (i_config+11) * sizeof(module_config_t)); \
00274 { static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value }; tmp.b_advanced = advc; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; }
00275 #define add_file( name, psz_value, p_callback, text, longtext, advc ) \
00276 i_config++; \
00277 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00278 (i_config+11) * sizeof(module_config_t)); \
00279 { static module_config_t tmp = { CONFIG_ITEM_FILE, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00280 #define add_directory( name, psz_value, p_callback, text, longtext, advc ) \
00281 i_config++; \
00282 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00283 (i_config+11) * sizeof(module_config_t)); \
00284 { static module_config_t tmp = { CONFIG_ITEM_DIRECTORY, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00285
00286 #define add_module( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \
00287 i_config++; \
00288 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00289 (i_config+11) * sizeof(module_config_t)); \
00290 { static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00291
00292 #define add_module_cat( name, i_subcategory, psz_value, p_callback, text, longtext, advc ) \
00293 i_config++; \
00294 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00295 (i_config+11) * sizeof(module_config_t)); \
00296 { static module_config_t tmp = { CONFIG_ITEM_MODULE_CAT, NULL, name, '\0', text, longtext, psz_value, 0, 0.0, i_subcategory }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00297
00298 #define add_module_list( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \
00299 i_config++; \
00300 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00301 (i_config+11) * sizeof(module_config_t)); \
00302 { static module_config_t tmp = { CONFIG_ITEM_MODULE_LIST, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00303
00304
00305 #define add_module_list_cat( name, i_subcategory, psz_value, p_callback, text, longtext, advc ) \
00306 i_config++; \
00307 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00308 (i_config+11) * sizeof(module_config_t)); \
00309 { static module_config_t tmp = { CONFIG_ITEM_MODULE_LIST_CAT, NULL, name, '\0', text, longtext, psz_value, 0, 0.0, i_subcategory }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00310
00311 #define add_integer( name, i_value, p_callback, text, longtext, advc ) \
00312 i_config++; \
00313 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00314 (i_config+11) * sizeof(module_config_t)); \
00315 { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00316
00317 #define add_key( name, i_value, p_callback, text, longtext, advc ) \
00318 i_config++; \
00319 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00320 (i_config+11) * sizeof(module_config_t)); \
00321 { static module_config_t tmp = { CONFIG_ITEM_KEY, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00322
00323 #define add_integer_with_range( name, i_value, i_min, i_max, p_callback, text, longtext, advc ) \
00324 i_config++; \
00325 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00326 (i_config+11) * sizeof(module_config_t)); \
00327 { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value, 0, i_min, i_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00328
00329 #define add_float( name, f_value, p_callback, text, longtext, advc ) \
00330 i_config++; \
00331 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00332 (i_config+11) * sizeof(module_config_t)); \
00333 { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00334
00335 #define add_float_with_range( name, f_value, f_min, f_max, p_callback, text, longtext, advc ) \
00336 i_config++; \
00337 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00338 (i_config+11) * sizeof(module_config_t)); \
00339 { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value, 0, 0, f_min, f_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00340
00341 #define add_bool( name, b_value, p_callback, text, longtext, advc ) \
00342 i_config++; \
00343 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00344 (i_config+11) * sizeof(module_config_t)); \
00345 { static module_config_t tmp = { CONFIG_ITEM_BOOL, NULL, name, '\0', text, longtext, NULL, b_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
00346
00347 #define add_deprecated( name, strict ) \
00348 i_config++; \
00349 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00350 (i_config+11) * sizeof(module_config_t)); \
00351 { static module_config_t tmp; \
00352 p_config[ i_config ] = tmp; \
00353 p_config[ i_config ].i_type = p_config[ i_config -1 ].i_type; \
00354 p_config[ i_config ].psz_name = name; \
00355 p_config[i_config].b_strict = strict; \
00356 p_config[ i_config ].psz_current = p_config[ i_config-1].psz_current?p_config[ i_config-1 ].psz_current:p_config[ i_config-1 ].psz_name; }
00357
00358 #define add_suppressed_bool( name ) \
00359 i_config++; \
00360 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00361 (i_config+11) * sizeof(module_config_t)); \
00362 { static module_config_t tmp; \
00363 p_config[ i_config ] = tmp; \
00364 p_config[ i_config ].i_type = CONFIG_ITEM_BOOL; \
00365 p_config[ i_config ].psz_name = name; \
00366 p_config[ i_config ].psz_current = "SUPPRESSED"; }
00367
00368 #define add_suppressed_integer( name ) \
00369 i_config++; \
00370 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00371 (i_config+11) * sizeof(module_config_t)); \
00372 { static module_config_t tmp; \
00373 p_config[ i_config ] = tmp; \
00374 p_config[ i_config ].i_type = CONFIG_ITEM_INTEGER; \
00375 p_config[ i_config ].psz_name = name; \
00376 p_config[ i_config ].psz_current = "SUPPRESSED"; }
00377 #define add_suppressed_float( name ) \
00378 i_config++; \
00379 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00380 (i_config+11) * sizeof(module_config_t)); \
00381 { static module_config_t tmp; \
00382 p_config[ i_config ] = tmp; \
00383 p_config[ i_config ].i_type = CONFIG_ITEM_FLOAT; \
00384 p_config[ i_config ].psz_name = name; \
00385 p_config[ i_config ].psz_current = "SUPPRESSED"; }
00386 #define add_suppressed_string( name ) \
00387 i_config++; \
00388 if(!(i_config%10)) p_config = (module_config_t* )realloc(p_config, \
00389 (i_config+11) * sizeof(module_config_t)); \
00390 { static module_config_t tmp; \
00391 p_config[ i_config ] = tmp; \
00392 p_config[ i_config ].i_type = CONFIG_ITEM_STRING; \
00393 p_config[ i_config ].psz_name = name; \
00394 p_config[ i_config ].psz_current = "SUPPRESSED"; }
00395
00396 #define change_short( ch ) \
00397 p_config[i_config].i_short = ch;
00398
00399 #define change_string_list( list, list_text, list_update_func ) \
00400 p_config[i_config].i_list = sizeof(list)/sizeof(char *); \
00401 p_config[i_config].ppsz_list = list; \
00402 p_config[i_config].ppsz_list_text = list_text;
00403
00404 #define change_integer_list( list, list_text, list_update_func ) \
00405 p_config[i_config].i_list = sizeof(list)/sizeof(int); \
00406 p_config[i_config].pi_list = list; \
00407 p_config[i_config].ppsz_list_text = list_text;
00408
00409 #define change_integer_range( min, max ) \
00410 p_config[i_config].i_min = min; \
00411 p_config[i_config].i_max = max;
00412
00413 #define change_float_range( min, max ) \
00414 p_config[i_config].f_min = min; \
00415 p_config[i_config].f_max = max;
00416
00417 #define change_action_add( pf_action, action_text ) \
00418 if( !p_config[i_config].i_action ) \
00419 { p_config[i_config].ppsz_action_text = 0; \
00420 p_config[i_config].ppf_action = 0; } \
00421 p_config[i_config].ppf_action = (vlc_callback_t *) \
00422 realloc( p_config[i_config].ppf_action, \
00423 (p_config[i_config].i_action + 1) * sizeof(void *) ); \
00424 p_config[i_config].ppsz_action_text = (char **)\
00425 realloc( p_config[i_config].ppsz_action_text, \
00426 (p_config[i_config].i_action + 1) * sizeof(void *) ); \
00427 p_config[i_config].ppf_action[p_config[i_config].i_action] = pf_action; \
00428 p_config[i_config].ppsz_action_text[p_config[i_config].i_action] = \
00429 action_text; \
00430 p_config[i_config].i_action++;
00431
00432 #define change_autosave() \
00433 p_config[i_config].b_autosave = VLC_TRUE;