Changeset 0ed17f99bb99ca20fc26061a238a1ed051a21bd1

Show
Ignore:
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
  • include/vlc_configuration.h

    r3b055b7 r0ed17f9  
    150150{ 
    151151    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 */ 
    154154    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 */ 
    157157    module_value_t value;                                    /* Option value */ 
    158158    module_value_t orig; 
     
    240240    VLC_CONFIG_VALUE,    /* actual value (args=<type>) */ 
    241241    VLC_CONFIG_RANGE,    /* minimum value (args=<type>, <type>) */ 
    242     VLC_CONFIG_STEP,     /* interval value (args=<type>) */ 
    243242    VLC_CONFIG_ADVANCED, /* enable advanced flag (args=none) */ 
    244243    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) */ 
    245246    VLC_CONFIG_PRIVATE,  /* hide from user (args=none) */ 
    246247} vlc_config_t; 
     
    280281#define add_typeadv_inner( type, text, longtext, advc ) \ 
    281282    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) 
    283284 
    284285#define add_typename_inner( type, name, text, longtext, advc, cb ) \ 
     
    289290#define add_string_inner( type, name, text, longtext, advc, cb, v ) \ 
    290291    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)) 
    292293 
    293294#define add_int_inner( type, name, text, longtext, advc, cb, v ) \ 
    294295    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)) 
    296297 
    297298 
     
    359360#define add_float( name, v, p_callback, text, longtext, advc ) \ 
    360361    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)) 
    362363 
    363364#define add_float_with_range( name, value, f_min, f_max, p_callback, text, longtext, advc ) \ 
     
    373374    add_config_inner( ); \ 
    374375    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); \ 
    376378    p_config[i_config].b_strict = VLC_FALSE; \ 
    377379    p_config[ i_config ].psz_current = p_config[ i_config-1 ].psz_current \ 
     
    382384#define add_obsolete_inner( name, type ) \ 
    383385    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" 
    386389 
    387390#define add_obsolete_bool( name ) \ 
     
    412415 
    413416#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)) 
    416419 
    417420#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)) 
    420423 
    421424#define change_action_add( pf_action, action_text ) \ 
     
    435438 
    436439#define change_internal() \ 
    437     p_config[i_config].b_internal = VLC_TRUE; 
     440    vlc_config_set (p_config + i_config, VLC_CONFIG_PRIVATE) 
    438441 
    439442#define change_need_restart() \ 
    440     p_config[i_config].b_restart = VLC_TRUE; 
     443    vlc_config_set (p_config + i_config, VLC_CONFIG_RESTART) 
    441444 
    442445#define change_autosave() \ 
    443     p_config[i_config].b_autosave = VLC_TRUE; 
     446    vlc_config_set (p_config + i_config, VLC_CONFIG_PERSISTENT) 
    444447 
    445448#define change_unsaveable() \ 
    446     p_config[i_config].b_unsaveable = VLC_TRUE; 
     449    vlc_config_set (p_config + i_config, VLC_VOLATILE) 
    447450 
    448451/**************************************************************************** 
  • src/modules/entry.c

    r3b055b7 r0ed17f9  
    2323#include <stdarg.h> 
    2424 
    25 #include "modules.h" 
     25#include "modules/modules.h" 
     26#include "config/config.h" 
    2627#include "libvlc.h" 
    2728 
     
    160161            item->psz_name = strdup (name); 
    161162            item->pf_callback = cb; 
     163            ret = 0; 
    162164            break; 
    163165        } 
     
    175177 
    176178        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 
    177201        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 
    179219        case VLC_CONFIG_ADVANCED: 
     220            item->b_advanced = VLC_TRUE; 
     221            ret = 0; 
     222            break; 
     223 
    180224        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 
    181239        case VLC_CONFIG_PRIVATE: 
     240            item->b_internal = VLC_TRUE; 
     241            ret = 0; 
    182242            break; 
    183243    }