| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#ifdef HAVE_CONFIG_H |
|---|
| 25 |
# include "config.h" |
|---|
| 26 |
#endif |
|---|
| 27 |
|
|---|
| 28 |
#include <vlc_common.h> |
|---|
| 29 |
#include "../libvlc.h" |
|---|
| 30 |
#include "vlc_keys.h" |
|---|
| 31 |
#include "vlc_charset.h" |
|---|
| 32 |
#include "vlc_configuration.h" |
|---|
| 33 |
|
|---|
| 34 |
#include <assert.h> |
|---|
| 35 |
|
|---|
| 36 |
#include "configuration.h" |
|---|
| 37 |
#include "modules/modules.h" |
|---|
| 38 |
|
|---|
| 39 |
static inline char *strdupnull (const char *src) |
|---|
| 40 |
{ |
|---|
| 41 |
return src ? strdup (src) : NULL; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
int IsConfigStringType (int type) |
|---|
| 46 |
{ |
|---|
| 47 |
static const unsigned char config_types[] = |
|---|
| 48 |
{ |
|---|
| 49 |
CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, CONFIG_ITEM_MODULE, |
|---|
| 50 |
CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_MODULE_CAT, CONFIG_ITEM_PASSWORD, |
|---|
| 51 |
CONFIG_ITEM_MODULE_LIST, CONFIG_ITEM_MODULE_LIST_CAT |
|---|
| 52 |
}; |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
return memchr (config_types, type, sizeof (config_types)) != NULL; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
int IsConfigIntegerType (int type) |
|---|
| 60 |
{ |
|---|
| 61 |
static const unsigned char config_types[] = |
|---|
| 62 |
{ |
|---|
| 63 |
CONFIG_ITEM_INTEGER, CONFIG_ITEM_KEY, CONFIG_ITEM_BOOL, |
|---|
| 64 |
CONFIG_CATEGORY, CONFIG_SUBCATEGORY |
|---|
| 65 |
}; |
|---|
| 66 |
|
|---|
| 67 |
return memchr (config_types, type, sizeof (config_types)) != NULL; |
|---|
| 68 |
} |
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
int __config_GetType( vlc_object_t *p_this, const char *psz_name ) |
|---|
| 78 |
{ |
|---|
| 79 |
module_config_t *p_config; |
|---|
| 80 |
int i_type; |
|---|
| 81 |
|
|---|
| 82 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
if( !p_config ) |
|---|
| 86 |
{ |
|---|
| 87 |
return 0; |
|---|
| 88 |
} |
|---|
| 89 |
|
|---|
| 90 |
switch( p_config->i_type ) |
|---|
| 91 |
{ |
|---|
| 92 |
case CONFIG_ITEM_BOOL: |
|---|
| 93 |
i_type = VLC_VAR_BOOL; |
|---|
| 94 |
break; |
|---|
| 95 |
|
|---|
| 96 |
case CONFIG_ITEM_INTEGER: |
|---|
| 97 |
case CONFIG_ITEM_KEY: |
|---|
| 98 |
i_type = VLC_VAR_INTEGER; |
|---|
| 99 |
break; |
|---|
| 100 |
|
|---|
| 101 |
case CONFIG_ITEM_FLOAT: |
|---|
| 102 |
i_type = VLC_VAR_FLOAT; |
|---|
| 103 |
break; |
|---|
| 104 |
|
|---|
| 105 |
case CONFIG_ITEM_MODULE: |
|---|
| 106 |
case CONFIG_ITEM_MODULE_CAT: |
|---|
| 107 |
case CONFIG_ITEM_MODULE_LIST: |
|---|
| 108 |
case CONFIG_ITEM_MODULE_LIST_CAT: |
|---|
| 109 |
i_type = VLC_VAR_MODULE; |
|---|
| 110 |
break; |
|---|
| 111 |
|
|---|
| 112 |
case CONFIG_ITEM_STRING: |
|---|
| 113 |
i_type = VLC_VAR_STRING; |
|---|
| 114 |
break; |
|---|
| 115 |
|
|---|
| 116 |
case CONFIG_ITEM_PASSWORD: |
|---|
| 117 |
i_type = VLC_VAR_STRING; |
|---|
| 118 |
break; |
|---|
| 119 |
|
|---|
| 120 |
case CONFIG_ITEM_FILE: |
|---|
| 121 |
i_type = VLC_VAR_FILE; |
|---|
| 122 |
break; |
|---|
| 123 |
|
|---|
| 124 |
case CONFIG_ITEM_DIRECTORY: |
|---|
| 125 |
i_type = VLC_VAR_DIRECTORY; |
|---|
| 126 |
break; |
|---|
| 127 |
|
|---|
| 128 |
default: |
|---|
| 129 |
i_type = 0; |
|---|
| 130 |
break; |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
return i_type; |
|---|
| 134 |
} |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
int __config_GetInt( vlc_object_t *p_this, const char *psz_name ) |
|---|
| 144 |
{ |
|---|
| 145 |
module_config_t *p_config; |
|---|
| 146 |
|
|---|
| 147 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
if( !p_config ) |
|---|
| 151 |
{ |
|---|
| 152 |
msg_Err( p_this, "option %s does not exist", psz_name ); |
|---|
| 153 |
return -1; |
|---|
| 154 |
} |
|---|
| 155 |
|
|---|
| 156 |
if (!IsConfigIntegerType (p_config->i_type)) |
|---|
| 157 |
{ |
|---|
| 158 |
msg_Err( p_this, "option %s does not refer to an int", psz_name ); |
|---|
| 159 |
return -1; |
|---|
| 160 |
} |
|---|
| 161 |
|
|---|
| 162 |
return p_config->value.i; |
|---|
| 163 |
} |
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
float __config_GetFloat( vlc_object_t *p_this, const char *psz_name ) |
|---|
| 172 |
{ |
|---|
| 173 |
module_config_t *p_config; |
|---|
| 174 |
|
|---|
| 175 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
if( !p_config ) |
|---|
| 179 |
{ |
|---|
| 180 |
msg_Err( p_this, "option %s does not exist", psz_name ); |
|---|
| 181 |
return -1; |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
if (!IsConfigFloatType (p_config->i_type)) |
|---|
| 185 |
{ |
|---|
| 186 |
msg_Err( p_this, "option %s does not refer to a float", psz_name ); |
|---|
| 187 |
return -1; |
|---|
| 188 |
} |
|---|
| 189 |
|
|---|
| 190 |
return p_config->value.f; |
|---|
| 191 |
} |
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name ) |
|---|
| 205 |
{ |
|---|
| 206 |
module_config_t *p_config; |
|---|
| 207 |
|
|---|
| 208 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
if( !p_config ) |
|---|
| 212 |
{ |
|---|
| 213 |
msg_Err( p_this, "option %s does not exist", psz_name ); |
|---|
| 214 |
return NULL; |
|---|
| 215 |
} |
|---|
| 216 |
|
|---|
| 217 |
if (!IsConfigStringType (p_config->i_type)) |
|---|
| 218 |
{ |
|---|
| 219 |
msg_Err( p_this, "option %s does not refer to a string", psz_name ); |
|---|
| 220 |
return NULL; |
|---|
| 221 |
} |
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 |
vlc_mutex_lock( p_config->p_lock ); |
|---|
| 225 |
char *psz_value = strdupnull (p_config->value.psz); |
|---|
| 226 |
vlc_mutex_unlock( p_config->p_lock ); |
|---|
| 227 |
|
|---|
| 228 |
return psz_value; |
|---|
| 229 |
} |
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
void __config_PutPsz( vlc_object_t *p_this, |
|---|
| 239 |
const char *psz_name, const char *psz_value ) |
|---|
| 240 |
{ |
|---|
| 241 |
module_config_t *p_config; |
|---|
| 242 |
vlc_value_t oldval, val; |
|---|
| 243 |
|
|---|
| 244 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
if( !p_config ) |
|---|
| 249 |
{ |
|---|
| 250 |
msg_Warn( p_this, "option %s does not exist", psz_name ); |
|---|
| 251 |
return; |
|---|
| 252 |
} |
|---|
| 253 |
|
|---|
| 254 |
if (!IsConfigStringType (p_config->i_type)) |
|---|
| 255 |
{ |
|---|
| 256 |
msg_Err( p_this, "option %s does not refer to a string", psz_name ); |
|---|
| 257 |
return; |
|---|
| 258 |
} |
|---|
| 259 |
|
|---|
| 260 |
vlc_mutex_lock( p_config->p_lock ); |
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
oldval.psz_string = (char *)p_config->value.psz; |
|---|
| 264 |
|
|---|
| 265 |
if ((psz_value != NULL) && *psz_value) |
|---|
| 266 |
p_config->value.psz = strdup (psz_value); |
|---|
| 267 |
else |
|---|
| 268 |
p_config->value.psz = NULL; |
|---|
| 269 |
|
|---|
| 270 |
p_config->b_dirty = true; |
|---|
| 271 |
|
|---|
| 272 |
val.psz_string = (char *)p_config->value.psz; |
|---|
| 273 |
|
|---|
| 274 |
vlc_mutex_unlock( p_config->p_lock ); |
|---|
| 275 |
|
|---|
| 276 |
if( p_config->pf_callback ) |
|---|
| 277 |
{ |
|---|
| 278 |
p_config->pf_callback( p_this, psz_name, oldval, val, |
|---|
| 279 |
p_config->p_callback_data ); |
|---|
| 280 |
} |
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
free( oldval.psz_string ); |
|---|
| 284 |
} |
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 |
|
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 |
void __config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value ) |
|---|
| 294 |
{ |
|---|
| 295 |
module_config_t *p_config; |
|---|
| 296 |
vlc_value_t oldval, val; |
|---|
| 297 |
|
|---|
| 298 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 |
if( !p_config ) |
|---|
| 302 |
{ |
|---|
| 303 |
msg_Warn( p_this, "option %s does not exist", psz_name ); |
|---|
| 304 |
return; |
|---|
| 305 |
} |
|---|
| 306 |
|
|---|
| 307 |
if (!IsConfigIntegerType (p_config->i_type)) |
|---|
| 308 |
{ |
|---|
| 309 |
msg_Err( p_this, "option %s does not refer to an int", psz_name ); |
|---|
| 310 |
return; |
|---|
| 311 |
} |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
oldval.i_int = p_config->value.i; |
|---|
| 315 |
|
|---|
| 316 |
|
|---|
| 317 |
if ((p_config->min.i == 0) && (p_config->max.i == 0)) |
|---|
| 318 |
{ |
|---|
| 319 |
p_config->value.i = i_value; |
|---|
| 320 |
} |
|---|
| 321 |
else if (i_value < p_config->min.i) |
|---|
| 322 |
{ |
|---|
| 323 |
p_config->value.i = p_config->min.i; |
|---|
| 324 |
} |
|---|
| 325 |
else if (i_value > p_config->max.i) |
|---|
| 326 |
{ |
|---|
| 327 |
p_config->value.i = p_config->max.i; |
|---|
| 328 |
} |
|---|
| 329 |
else |
|---|
| 330 |
{ |
|---|
| 331 |
p_config->value.i = i_value; |
|---|
| 332 |
} |
|---|
| 333 |
|
|---|
| 334 |
p_config->b_dirty = true; |
|---|
| 335 |
|
|---|
| 336 |
val.i_int = p_config->value.i; |
|---|
| 337 |
|
|---|
| 338 |
if( p_config->pf_callback ) |
|---|
| 339 |
{ |
|---|
| 340 |
p_config->pf_callback( p_this, psz_name, oldval, val, |
|---|
| 341 |
p_config->p_callback_data ); |
|---|
| 342 |
} |
|---|
| 343 |
} |
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
void __config_PutFloat( vlc_object_t *p_this, |
|---|
| 352 |
const char *psz_name, float f_value ) |
|---|
| 353 |
{ |
|---|
| 354 |
module_config_t *p_config; |
|---|
| 355 |
vlc_value_t oldval, val; |
|---|
| 356 |
|
|---|
| 357 |
p_config = config_FindConfig( p_this, psz_name ); |
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
if( !p_config ) |
|---|
| 361 |
{ |
|---|
| 362 |
msg_Warn( p_this, "option %s does not exist", psz_name ); |
|---|
| 363 |
return; |
|---|
| 364 |
} |
|---|
| 365 |
|
|---|
| 366 |
if (!IsConfigFloatType (p_config->i_type)) |
|---|
| 367 |
{ |
|---|
| 368 |
msg_Err( p_this, "option %s does not refer to a float", psz_name ); |
|---|
| 369 |
return; |
|---|
| 370 |
} |
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
oldval.f_float = p_config->value.f; |
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
if ((p_config->min.f == 0) && (p_config->max.f == 0)) |
|---|
| 377 |
{ |
|---|
| 378 |
p_config->value.f = f_value; |
|---|
| 379 |
} |
|---|
| 380 |
else if (f_value < p_config->min.f) |
|---|
| 381 |
{ |
|---|
| 382 |
p_config->value.f = p_config->min.f; |
|---|
| 383 |
} |
|---|
| 384 |
else if (f_value > p_config->max.f) |
|---|
| 385 |
{ |
|---|
| 386 |
p_config->value.f = p_config->max.f; |
|---|
| 387 |
} |
|---|
| 388 |
else |
|---|
| 389 |
{ |
|---|
| 390 |
p_config->value.f = f_value; |
|---|
| 391 |
} |
|---|
| 392 |
|
|---|
| 393 |
p_config->b_dirty = true; |
|---|
| 394 |
|
|---|
| 395 |
val.f_float = p_config->value.f; |
|---|
| 396 |
|
|---|
| 397 |
if( p_config->pf_callback ) |
|---|
| 398 |
{ |
|---|
| 399 |
p_config->pf_callback( p_this, psz_name, oldval, val, |
|---|
| 400 |
p_config->p_callback_data ); |
|---|
| 401 |
} |
|---|
| 402 |
} |
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 |
module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name ) |
|---|
| 411 |
{ |
|---|
| 412 |
module_t *p_parser; |
|---|
| 413 |
|
|---|
| 414 |
if( !psz_name ) return NULL; |
|---|
| 415 |
|
|---|
| 416 |
module_t **list = module_list_get (NULL); |
|---|
| 417 |
if (list == NULL) |
|---|
| 418 |
return NULL; |
|---|
| 419 |
|
|---|
| 420 |
for (size_t i = 0; (p_parser = list[i]) != NULL; i++) |
|---|
| 421 |
{ |
|---|
| 422 |
module_config_t *p_item, *p_end; |
|---|
| 423 |
|
|---|
| 424 |
if( !p_parser->i_config_items ) |
|---|
| 425 |
continue; |
|---|
| 426 |
|
|---|
| 427 |
for( p_item = p_parser->p_config, p_end = p_item + p_parser->confsize; |
|---|
| 428 |
p_item < p_end; |
|---|
| 429 |
p_item++ ) |
|---|
| 430 |
{ |
|---|
| 431 |
if( p_item->i_type & CONFIG_HINT ) |
|---|
| 432 |
|
|---|
| 433 |
continue; |
|---|
| 434 |
if( !strcmp( psz_name, p_item->psz_name ) |
|---|
| 435 |
|| ( p_item->psz_oldname |
|---|
| 436 |
&& !strcmp( psz_name, p_item->psz_oldname ) ) ) |
|---|
| 437 |
{ |
|---|
| 438 |
module_list_free (list); |
|---|
| 439 |
return p_item; |
|---|
| 440 |
} |
|---|
| 441 |
} |
|---|
| 442 |
} |
|---|
| 443 |
|
|---|
| 444 |
module_list_free (list); |
|---|
| 445 |
return NULL; |
|---|
| 446 |
} |
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
void config_Free( module_t *p_module ) |
|---|
| 454 |
{ |
|---|
| 455 |
int i; |
|---|
| 456 |
|
|---|
| 457 |
for (size_t j = 0; j < p_module->confsize; j++) |
|---|
| 458 |
{ |
|---|
| 459 |
module_config_t *p_item = p_module->p_config + j; |
|---|
| 460 |
|
|---|
| 461 |
free( p_item->psz_type ); |
|---|
| 462 |
free( p_item->psz_name ); |
|---|
| 463 |
free( p_item->psz_text ); |
|---|
| 464 |
free( p_item->psz_longtext ); |
|---|
| 465 |
free( p_item->psz_oldname ); |
|---|
| 466 |
|
|---|
| 467 |
if (IsConfigStringType (p_item->i_type)) |
|---|
| 468 |
{ |
|---|
| 469 |
free (p_item->value.psz); |
|---|
| 470 |
free (p_item->orig.psz); |
|---|
| 471 |
free (p_item->saved.psz); |
|---|
| 472 |
} |
|---|
| 473 |
|
|---|
| 474 |
if( p_item->ppsz_list ) |
|---|
| 475 |
for( i = 0; i < p_item->i_list; i++ ) |
|---|
| 476 |
free( p_item->ppsz_list[i] ); |
|---|
| 477 |
if( p_item->ppsz_list_text ) |
|---|
| 478 |
for( i = 0; i < p_item->i_list; i++ ) |
|---|
| 479 |
free( p_item->ppsz_list_text[i] ); |
|---|
| 480 |
free( p_item->ppsz_list ); |
|---|
| 481 |
free( p_item->ppsz_list_text ); |
|---|
| 482 |
free( p_item->pi_list ); |
|---|
| 483 |
|
|---|
| 484 |
if( p_item->i_action ) |
|---|
| 485 |
{ |
|---|
| 486 |
for( i = 0; i < p_item->i_action; i++ ) |
|---|
| 487 |
{ |
|---|
| 488 |
free( p_item->ppsz_action_text[i] ); |
|---|
| 489 |
} |
|---|
| 490 |
free( p_item->ppf_action ); |
|---|
| 491 |
free( p_item->ppsz_action_text ); |
|---|
| 492 |
} |
|---|
| 493 |
} |
|---|
| 494 |
|
|---|
| 495 |
free (p_module->p_config); |
|---|
| 496 |
p_module->p_config = NULL; |
|---|
| 497 |
} |
|---|
| 498 |
|
|---|
| 499 |
|
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 |
|
|---|
| 503 |
|
|---|
| 504 |
|
|---|
| 505 |
|
|---|
| 506 |
void config_SetCallbacks( module_config_t *p_new, module_config_t *p_orig, |
|---|
| 507 |
size_t n ) |
|---|
| 508 |
{ |
|---|
| 509 |
for (size_t i = 0; i < n; i++) |
|---|
| 510 |
{ |
|---|
| 511 |
p_new->pf_callback = p_orig->pf_callback; |
|---|
| 512 |
p_new++; |
|---|
| 513 |
p_orig++; |
|---|
| 514 |
} |
|---|
| 515 |
} |
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 |
void config_UnsetCallbacks( module_config_t *p_new, size_t n ) |
|---|
| 523 |
{ |
|---|
| 524 |
for (size_t i = 0; i < n; i++) |
|---|
| 525 |
{ |
|---|
| 526 |
p_new->pf_callback = NULL; |
|---|
| 527 |
p_new++; |
|---|
| 528 |
} |
|---|
| 529 |
} |
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 |
void __config_ResetAll( vlc_object_t *p_this ) |
|---|
| 535 |
{ |
|---|
| 536 |
libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc); |
|---|
| 537 |
int i_index; |
|---|
| 538 |
module_t *p_module; |
|---|
| 539 |
module_t **list = module_list_get (NULL); |
|---|
| 540 |
|
|---|
| 541 |
|
|---|
| 542 |
vlc_mutex_lock( &priv->config_lock ); |
|---|
| 543 |
|
|---|
| 544 |
|
|---|
| 545 |
for (size_t j = 0; (p_module = list[j]) != NULL; j++) |
|---|
| 546 |
{ |
|---|
| 547 |
if( p_module->b_submodule ) continue; |
|---|
| 548 |
|
|---|
| 549 |
for (size_t i = 0; i < p_module->confsize; i++ ) |
|---|
| 550 |
{ |
|---|
| 551 |
if (IsConfigIntegerType (p_module->p_config[i].i_type)) |
|---|
| 552 |
p_module->p_config[i].value.i = p_module->p_config[i].orig.i; |
|---|
| 553 |
else |
|---|
| 554 |
if (IsConfigFloatType (p_module->p_config[i].i_type)) |
|---|
| 555 |
p_module->p_config[i].value.f = p_module->p_config[i].orig.f; |
|---|
| 556 |
else |
|---|
| 557 |
if (IsConfigStringType (p_module->p_config[i].i_type)) |
|---|
| 558 |
{ |
|---|
| 559 |
free ((char *)p_module->p_config[i].value.psz); |
|---|
| 560 |
p_module->p_config[i].value.psz = |
|---|
| 561 |
strdupnull (p_module->p_config[i].orig.psz); |
|---|
| 562 |
} |
|---|
| 563 |
} |
|---|
| 564 |
} |
|---|
| 565 |
|
|---|
| 566 |
module_list_free (list); |
|---|
| 567 |
vlc_mutex_unlock( &priv->config_lock ); |
|---|
| 568 |
} |
|---|