Changeset 0ed17f99bb99ca20fc26061a238a1ed051a21bd1
- Timestamp:
- 12/15/07 23:18:03
(9 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1197757083 +0000
- git-parent:
[417253217308d59d4073a2f3065d4510be343420]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1197757083 +0000
- Message:
Continue the vlc_config_set stuff - still unfinished
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3b055b7 |
r0ed17f9 |
|
| 150 | 150 | { |
|---|
| 151 | 151 | int i_type; /* Configuration type */ |
|---|
| 152 | | const char *psz_type; /* Configuration subtype */ |
|---|
| 153 | | const char *psz_name; /* Option name */ |
|---|
| | 152 | char *psz_type; /* Configuration subtype */ |
|---|
| | 153 | char *psz_name; /* Option name */ |
|---|
| 154 | 154 | char i_short; /* Optional short option name */ |
|---|
| 155 | | const char *psz_text; /* Short comment on the configuration option */ |
|---|
| 156 | | const char *psz_longtext; /* Long comment on the configuration option */ |
|---|
| | 155 | char *psz_text; /* Short comment on the configuration option */ |
|---|
| | 156 | char *psz_longtext; /* Long comment on the configuration option */ |
|---|
| 157 | 157 | module_value_t value; /* Option value */ |
|---|
| 158 | 158 | module_value_t orig; |
|---|
| … | … | |
| 240 | 240 | VLC_CONFIG_VALUE, /* actual value (args=<type>) */ |
|---|
| 241 | 241 | VLC_CONFIG_RANGE, /* minimum value (args=<type>, <type>) */ |
|---|
| 242 | | VLC_CONFIG_STEP, /* interval value (args=<type>) */ |
|---|
| 243 | 242 | VLC_CONFIG_ADVANCED, /* enable advanced flag (args=none) */ |
|---|
| 244 | 243 | VLC_CONFIG_VOLATILE, /* don't write variable to storage (args=none) */ |
|---|
| | 244 | VLC_CONFIG_PERSISTENT, /* always write variable to storage (args=none) */ |
|---|
| | 245 | VLC_CONFIG_RESTART, /* restart required to apply value change (args=none) */ |
|---|
| 245 | 246 | VLC_CONFIG_PRIVATE, /* hide from user (args=none) */ |
|---|
| 246 | 247 | } vlc_config_t; |
|---|
| … | … | |
| 280 | 281 | #define add_typeadv_inner( type, text, longtext, advc ) \ |
|---|
| 281 | 282 | add_typedesc_inner( type, text, longtext ); \ |
|---|
| 282 | | p_config[i_config].b_advanced = advc |
|---|
| | 283 | if (advc) vlc_config_set (p_config + i_config, VLC_CONFIG_ADVANCED) |
|---|
| 283 | 284 | |
|---|
| 284 | 285 | #define add_typename_inner( type, name, text, longtext, advc, cb ) \ |
|---|
| … | … | |
| 289 | 290 | #define add_string_inner( type, name, text, longtext, advc, cb, v ) \ |
|---|
| 290 | 291 | add_typename_inner( type, name, text, longtext, advc, cb ); \ |
|---|
| 291 | | p_config[i_config].value.psz = v |
|---|
| | 292 | vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (const char *)(v)) |
|---|
| 292 | 293 | |
|---|
| 293 | 294 | #define add_int_inner( type, name, text, longtext, advc, cb, v ) \ |
|---|
| 294 | 295 | add_typename_inner( type, name, text, longtext, advc, cb ); \ |
|---|
| 295 | | p_config[i_config].value.i = v |
|---|
| | 296 | vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (int)(v)) |
|---|
| 296 | 297 | |
|---|
| 297 | 298 | |
|---|
| … | … | |
| 359 | 360 | #define add_float( name, v, p_callback, text, longtext, advc ) \ |
|---|
| 360 | 361 | add_typename_inner( CONFIG_ITEM_FLOAT, name, text, longtext, advc, p_callback ); \ |
|---|
| 361 | | p_config[i_config].value.f = v |
|---|
| | 362 | vlc_config_set (p_config + i_config, VLC_CONFIG_VALUE, (double)(v)) |
|---|
| 362 | 363 | |
|---|
| 363 | 364 | #define add_float_with_range( name, value, f_min, f_max, p_callback, text, longtext, advc ) \ |
|---|
| … | … | |
| 373 | 374 | add_config_inner( ); \ |
|---|
| 374 | 375 | p_config[ i_config ].i_type = p_config[ i_config -1 ].i_type; \ |
|---|
| 375 | | p_config[ i_config ].psz_name = name; \ |
|---|
| | 376 | vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \ |
|---|
| | 377 | (const char *)(name), (vlc_callback_t)NULL); \ |
|---|
| 376 | 378 | p_config[i_config].b_strict = VLC_FALSE; \ |
|---|
| 377 | 379 | p_config[ i_config ].psz_current = p_config[ i_config-1 ].psz_current \ |
|---|
| … | … | |
| 382 | 384 | #define add_obsolete_inner( name, type ) \ |
|---|
| 383 | 385 | add_type_inner( type ); \ |
|---|
| 384 | | p_config[ i_config ].psz_name = name; \ |
|---|
| 385 | | p_config[ i_config ].psz_current = "SUPPRESSED"; |
|---|
| | 386 | vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \ |
|---|
| | 387 | (const char *)(name), (vlc_callback_t)NULL); \ |
|---|
| | 388 | p_config[ i_config ].psz_current = "SUPPRESSED" |
|---|
| 386 | 389 | |
|---|
| 387 | 390 | #define add_obsolete_bool( name ) \ |
|---|
| … | … | |
| 412 | 415 | |
|---|
| 413 | 416 | #define change_integer_range( minv, maxv ) \ |
|---|
| 414 | | p_config[i_config].min.i = minv; \ |
|---|
| 415 | | p_config[i_config].max.i = maxv; |
|---|
| | 417 | vlc_config_set (p_config + i_config, VLC_CONFIG_RANGE, \ |
|---|
| | 418 | (int)(minv), (int)(maxv)) |
|---|
| 416 | 419 | |
|---|
| 417 | 420 | #define change_float_range( minv, maxv ) \ |
|---|
| 418 | | p_config[i_config].min.f = minv; \ |
|---|
| 419 | | p_config[i_config].max.f = maxv; |
|---|
| | 421 | vlc_config_set (p_config + i_config, VLC_CONFIG_RANGE, \ |
|---|
| | 422 | (double)(minv), (double)(maxv)) |
|---|
| 420 | 423 | |
|---|
| 421 | 424 | #define change_action_add( pf_action, action_text ) \ |
|---|
| … | … | |
| 435 | 438 | |
|---|
| 436 | 439 | #define change_internal() \ |
|---|
| 437 | | p_config[i_config].b_internal = VLC_TRUE; |
|---|
| | 440 | vlc_config_set (p_config + i_config, VLC_CONFIG_PRIVATE) |
|---|
| 438 | 441 | |
|---|
| 439 | 442 | #define change_need_restart() \ |
|---|
| 440 | | p_config[i_config].b_restart = VLC_TRUE; |
|---|
| | 443 | vlc_config_set (p_config + i_config, VLC_CONFIG_RESTART) |
|---|
| 441 | 444 | |
|---|
| 442 | 445 | #define change_autosave() \ |
|---|
| 443 | | p_config[i_config].b_autosave = VLC_TRUE; |
|---|
| | 446 | vlc_config_set (p_config + i_config, VLC_CONFIG_PERSISTENT) |
|---|
| 444 | 447 | |
|---|
| 445 | 448 | #define change_unsaveable() \ |
|---|
| 446 | | p_config[i_config].b_unsaveable = VLC_TRUE; |
|---|
| | 449 | vlc_config_set (p_config + i_config, VLC_VOLATILE) |
|---|
| 447 | 450 | |
|---|
| 448 | 451 | /**************************************************************************** |
|---|
| r3b055b7 |
r0ed17f9 |
|
| 23 | 23 | #include <stdarg.h> |
|---|
| 24 | 24 | |
|---|
| 25 | | #include "modules.h" |
|---|
| | 25 | #include "modules/modules.h" |
|---|
| | 26 | #include "config/config.h" |
|---|
| 26 | 27 | #include "libvlc.h" |
|---|
| 27 | 28 | |
|---|
| … | … | |
| 160 | 161 | item->psz_name = strdup (name); |
|---|
| 161 | 162 | item->pf_callback = cb; |
|---|
| | 163 | ret = 0; |
|---|
| 162 | 164 | break; |
|---|
| 163 | 165 | } |
|---|
| … | … | |
| 175 | 177 | |
|---|
| 176 | 178 | case VLC_CONFIG_VALUE: |
|---|
| | 179 | { |
|---|
| | 180 | if (IsConfigIntegerType (item->i_type)) |
|---|
| | 181 | { |
|---|
| | 182 | item->value.i = va_arg (ap, int); |
|---|
| | 183 | ret = 0; |
|---|
| | 184 | } |
|---|
| | 185 | else |
|---|
| | 186 | if (IsConfigFloatType (item->i_type)) |
|---|
| | 187 | { |
|---|
| | 188 | item->value.f = va_arg (ap, double); |
|---|
| | 189 | ret = 0; |
|---|
| | 190 | } |
|---|
| | 191 | else |
|---|
| | 192 | if (IsConfigStringType (item->i_type)) |
|---|
| | 193 | { |
|---|
| | 194 | const char *value = va_arg (ap, const char *); |
|---|
| | 195 | item->value.psz = value ? strdup (value) : NULL; |
|---|
| | 196 | ret = 0; |
|---|
| | 197 | } |
|---|
| | 198 | break; |
|---|
| | 199 | } |
|---|
| | 200 | |
|---|
| 177 | 201 | case VLC_CONFIG_RANGE: |
|---|
| 178 | | case VLC_CONFIG_STEP: |
|---|
| | 202 | { |
|---|
| | 203 | if (IsConfigIntegerType (item->i_type)) |
|---|
| | 204 | { |
|---|
| | 205 | item->min.i = va_arg (ap, int); |
|---|
| | 206 | item->max.i = va_arg (ap, int); |
|---|
| | 207 | ret = 0; |
|---|
| | 208 | } |
|---|
| | 209 | else |
|---|
| | 210 | if (IsConfigFloatType (item->i_type)) |
|---|
| | 211 | { |
|---|
| | 212 | item->min.f = va_arg (ap, double); |
|---|
| | 213 | item->max.f = va_arg (ap, double); |
|---|
| | 214 | ret = 0; |
|---|
| | 215 | } |
|---|
| | 216 | break; |
|---|
| | 217 | } |
|---|
| | 218 | |
|---|
| 179 | 219 | case VLC_CONFIG_ADVANCED: |
|---|
| | 220 | item->b_advanced = VLC_TRUE; |
|---|
| | 221 | ret = 0; |
|---|
| | 222 | break; |
|---|
| | 223 | |
|---|
| 180 | 224 | case VLC_CONFIG_VOLATILE: |
|---|
| | 225 | item->b_unsaveable = VLC_TRUE; |
|---|
| | 226 | ret = 0; |
|---|
| | 227 | break; |
|---|
| | 228 | |
|---|
| | 229 | case VLC_CONFIG_PERSISTENT: |
|---|
| | 230 | item->b_autosave = VLC_TRUE; |
|---|
| | 231 | ret = 0; |
|---|
| | 232 | break; |
|---|
| | 233 | |
|---|
| | 234 | case VLC_CONFIG_RESTART: |
|---|
| | 235 | item->b_restart = VLC_TRUE; |
|---|
| | 236 | ret = 0; |
|---|
| | 237 | break; |
|---|
| | 238 | |
|---|
| 181 | 239 | case VLC_CONFIG_PRIVATE: |
|---|
| | 240 | item->b_internal = VLC_TRUE; |
|---|
| | 241 | ret = 0; |
|---|
| 182 | 242 | break; |
|---|
| 183 | 243 | } |
|---|