Changeset a1e597bf0072e2466e137277ec9ff0562c8d0a8e

Show
Ignore:
Timestamp:
01/22/06 18:12:24 (3 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1137949944 +0000
git-parent:

[71016b4ee50599cbea456362d264e59a589f324c]

git-author:
Clément Stenac <zorglub@videolan.org> 1137949944 +0000
Message:

* Make ParseOption? (from input) a global service (var_OptionParse)
* Add i_options/pp_options to intf_Create

* add global options to enable file-logging and syslog (Refs:#508)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/variables.h

    r2cb472d ra1e597b  
    163163VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) ); 
    164164VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) ); 
     165 
     166#define var_OptionParse(a,b) __var_OptionParse( VLC_OBJECT( a ) , b ) 
     167VLC_EXPORT( void, __var_OptionParse, ( vlc_object_t *, const char * ) ); 
    165168 
    166169/** 
  • include/vlc_interface.h

    r2cb472d ra1e597b  
    114114 * Prototypes 
    115115 *****************************************************************************/ 
    116 #define intf_Create(a,b) __intf_Create(VLC_OBJECT(a),b
    117 VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t *, const char * ) ); 
     116#define intf_Create(a,b,c,d) __intf_Create(VLC_OBJECT(a),b,c,d
     117VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t *, const char *, int, char ** ) ); 
    118118VLC_EXPORT( int,               intf_RunThread,  ( intf_thread_t * ) ); 
    119119VLC_EXPORT( void,              intf_StopThread, ( intf_thread_t * ) ); 
  • include/vlc_symbols.h

    r19713fc ra1e597b  
    5656void * vlc_readdir (void *); 
    5757int sout_AnnounceRegister (sout_instance_t *,session_descriptor_t*, announce_method_t*); 
     58void __var_OptionParse (vlc_object_t *, const char *); 
    5859int osd_ShowTextRelative (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t); 
    5960void * __vlc_object_get (vlc_object_t *, int); 
     
    280281void input_StopThread (input_thread_t *); 
    281282int __input_Read (vlc_object_t *, input_item_t *, vlc_bool_t); 
    282 intf_thread_t * __intf_Create (vlc_object_t *, const char *); 
     283intf_thread_t * __intf_Create (vlc_object_t *, const char *, int, char **); 
    283284void aout_ChannelReorder (uint8_t *, int, int, const int *, int); 
    284285int __var_DelCallback (vlc_object_t *, const char *, vlc_callback_t, void *); 
     
    676677    void (*input_DecoderDelete_inner) (decoder_t *); 
    677678    void (*input_DecoderDecode_inner) (decoder_t *, block_t *); 
    678     intf_thread_t * (*__intf_Create_inner) (vlc_object_t *, const char *); 
     679    intf_thread_t * (*__intf_Create_inner) (vlc_object_t *, const char *, int, char **); 
    679680    int (*intf_RunThread_inner) (intf_thread_t *); 
    680681    void (*intf_StopThread_inner) (intf_thread_t *); 
     
    891892    void (*stats_HandlerDestroy_inner) (stats_handler_t*); 
    892893    vlc_t * (*vlc_current_object_inner) (int); 
     894    void (*__var_OptionParse_inner) (vlc_object_t *, const char *); 
    893895}; 
    894896#  if defined (__PLUGIN__) 
     
    13211323#  define stats_HandlerDestroy (p_symbols)->stats_HandlerDestroy_inner 
    13221324#  define vlc_current_object (p_symbols)->vlc_current_object_inner 
     1325#  define __var_OptionParse (p_symbols)->__var_OptionParse_inner 
    13231326#  elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 
    13241327/****************************************************************** 
     
    17541757    ((p_symbols)->stats_HandlerDestroy_inner) = stats_HandlerDestroy; \ 
    17551758    ((p_symbols)->vlc_current_object_inner) = vlc_current_object; \ 
     1759    ((p_symbols)->__var_OptionParse_inner) = __var_OptionParse; \ 
    17561760    (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 
    17571761    (p_symbols)->__stats_CounterGet_deprecated = NULL; \ 
  • modules/codec/cmml/cmml.c

    r2cb472d ra1e597b  
    129129 
    130130    /* initialise the CMML responder interface */ 
    131     p_sys->p_intf = intf_Create( p_dec, "cmml" ); 
     131    p_sys->p_intf = intf_Create( p_dec, "cmml", 0, NULL ); 
    132132    p_sys->p_intf->b_block = VLC_FALSE; 
    133133    intf_RunThread( p_sys->p_intf ); 
  • modules/control/rc.c

    r2cb472d ra1e597b  
    16711671        playlist_Stop( p_playlist ); 
    16721672        vlc_object_release( p_playlist ); 
    1673     }     
     1673    } 
    16741674    p_this->p_vlc->b_die = VLC_TRUE; 
    16751675    return VLC_SUCCESS; 
     
    16811681    intf_thread_t *p_newintf = NULL; 
    16821682 
    1683     p_newintf = intf_Create( p_this->p_vlc, newval.psz_string ); 
     1683    p_newintf = intf_Create( p_this->p_vlc, newval.psz_string, 0, NULL ); 
    16841684    if( p_newintf ) 
    16851685    { 
  • modules/misc/logger.c

    r2cb472d ra1e597b  
    119119 
    120120vlc_module_begin(); 
    121     set_category( CAT_INTERFACE ); 
    122     set_subcategory( SUBCAT_INTERFACE_CONTROL ); 
    123121    set_shortname( N_( "Logging" ) ); 
    124122    set_description( _("File logging") ); 
    125123 
    126     add_file( "logfile", NULL, NULL, N_("Log filename"), N_("Specify the log filename."), VLC_FALSE ); 
     124    add_file( "logfile", NULL, NULL, 
     125             N_("Log filename"), N_("Specify the log filename."), VLC_FALSE ); 
    127126    add_string( "logmode", "text", NULL, LOGMODE_TEXT, LOGMODE_LONGTEXT, 
    128127                VLC_FALSE ); 
     
    152151    } 
    153152 
    154     psz_mode = config_GetPsz( p_intf, "logmode" ); 
     153    psz_mode = var_CreateGetString( p_intf, "logmode" ); 
    155154    if( psz_mode ) 
    156155    { 
  • src/input/input.c

    r5bd61a8 ra1e597b  
    6464 
    6565static void UpdateItemLength( input_thread_t *, int64_t i_length, vlc_bool_t ); 
    66  
    67 static void ParseOption( input_thread_t *p_input, const char *psz_option ); 
    6866 
    6967static void DecodeUrl( char * ); 
     
    167165    for( i = 0; i < p_item->i_options; i++ ) 
    168166    { 
    169         ParseOption( p_input, p_item->ppsz_options[i] ); 
     167        var_OptionParse( p_input, p_item->ppsz_options[i] ); 
    170168    } 
    171169    vlc_mutex_unlock( &p_item->lock ); 
     
    24132411 
    24142412/***************************************************************************** 
    2415  * ParseOption: parses the options for the input 
    2416  ***************************************************************************** 
    2417  * This function parses the input (config) options and creates their associated 
    2418  * object variables. 
    2419  * Options are of the form "[no[-]]foo[=bar]" where foo is the option name and 
    2420  * bar is the value of the option. 
    2421  *****************************************************************************/ 
    2422 static void ParseOption( input_thread_t *p_input, const char *psz_option ) 
    2423 { 
    2424     char *psz_name = (char *)psz_option; 
    2425     char *psz_value = strchr( psz_option, '=' ); 
    2426     int  i_name_len, i_type; 
    2427     vlc_bool_t b_isno = VLC_FALSE; 
    2428     vlc_value_t val; 
    2429  
    2430     if( psz_value ) i_name_len = psz_value - psz_option; 
    2431     else i_name_len = strlen( psz_option ); 
    2432  
    2433     /* It's too much of an hassle to remove the ':' when we parse 
    2434      * the cmd line :) */ 
    2435     if( i_name_len && *psz_name == ':' ) 
    2436     { 
    2437         psz_name++; 
    2438         i_name_len--; 
    2439     } 
    2440  
    2441     if( i_name_len == 0 ) return; 
    2442  
    2443     psz_name = strndup( psz_name, i_name_len ); 
    2444     if( psz_value ) psz_value++; 
    2445  
    2446     /* FIXME: :programs should be handled generically */ 
    2447     if( !strcmp( psz_name, "programs" ) ) 
    2448         i_type = VLC_VAR_LIST; 
    2449     else 
    2450         i_type = config_GetType( p_input, psz_name ); 
    2451  
    2452     if( !i_type && !psz_value ) 
    2453     { 
    2454         /* check for "no-foo" or "nofoo" */ 
    2455         if( !strncmp( psz_name, "no-", 3 ) ) 
    2456         { 
    2457             memmove( psz_name, psz_name + 3, strlen(psz_name) + 1 - 3 ); 
    2458         } 
    2459         else if( !strncmp( psz_name, "no", 2 ) ) 
    2460         { 
    2461             memmove( psz_name, psz_name + 2, strlen(psz_name) + 1 - 2 ); 
    2462         } 
    2463         else goto cleanup;           /* Option doesn't exist */ 
    2464  
    2465         b_isno = VLC_TRUE; 
    2466         i_type = config_GetType( p_input, psz_name ); 
    2467  
    2468         if( !i_type ) goto cleanup;  /* Option doesn't exist */ 
    2469     } 
    2470     else if( !i_type ) goto cleanup; /* Option doesn't exist */ 
    2471  
    2472     if( ( i_type != VLC_VAR_BOOL ) && 
    2473         ( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */ 
    2474  
    2475     /* Create the variable in the input object. 
    2476      * Children of the input object will be able to retreive this value 
    2477      * thanks to the inheritance property of the object variables. */ 
    2478     var_Create( p_input, psz_name, i_type ); 
    2479  
    2480     switch( i_type ) 
    2481     { 
    2482     case VLC_VAR_BOOL: 
    2483         val.b_bool = !b_isno; 
    2484         break; 
    2485  
    2486     case VLC_VAR_INTEGER: 
    2487         val.i_int = strtol( psz_value, NULL, 0 ); 
    2488         break; 
    2489  
    2490     case VLC_VAR_FLOAT: 
    2491         val.f_float = atof( psz_value ); 
    2492         break; 
    2493  
    2494     case VLC_VAR_STRING: 
    2495     case VLC_VAR_MODULE: 
    2496     case VLC_VAR_FILE: 
    2497     case VLC_VAR_DIRECTORY: 
    2498         val.psz_string = psz_value; 
    2499         break; 
    2500  
    2501     case VLC_VAR_LIST: 
    2502     { 
    2503         char *psz_orig, *psz_var; 
    2504         vlc_list_t *p_list = malloc(sizeof(vlc_list_t)); 
    2505         val.p_list = p_list; 
    2506         p_list->i_count = 0; 
    2507  
    2508         psz_var = psz_orig = strdup(psz_value); 
    2509         while( psz_var && *psz_var ) 
    2510         { 
    2511             char *psz_item = psz_var; 
    2512             vlc_value_t val2; 
    2513             while( *psz_var && *psz_var != ',' ) psz_var++; 
    2514             if( *psz_var == ',' ) 
    2515             { 
    2516                 *psz_var = '\0'; 
    2517                 psz_var++; 
    2518             } 
    2519             val2.i_int = strtol( psz_item, NULL, 0 ); 
    2520             INSERT_ELEM( p_list->p_values, p_list->i_count, 
    2521                          p_list->i_count, val2 ); 
    2522             /* p_list->i_count is incremented twice by INSERT_ELEM */ 
    2523             p_list->i_count--; 
    2524             INSERT_ELEM( p_list->pi_types, p_list->i_count, 
    2525                          p_list->i_count, VLC_VAR_INTEGER ); 
    2526         } 
    2527         if( psz_orig ) free( psz_orig ); 
    2528         break; 
    2529     } 
    2530  
    2531     default: 
    2532         goto cleanup; 
    2533         break; 
    2534     } 
    2535  
    2536     var_Set( p_input, psz_name, val ); 
    2537  
    2538     msg_Dbg( p_input, "set input option: %s to %s", psz_name, 
    2539              psz_value ? psz_value : ( val.b_bool ? "true" : "false") ); 
    2540  
    2541   cleanup: 
    2542     if( psz_name ) free( psz_name ); 
    2543     return; 
    2544 } 
    2545  
    2546 /***************************************************************************** 
    25472413 * MRLSplit: parse the access, demux and url part of the 
    25482414 *           Media Resource Locator. 
  • src/interface/interface.c

    r2cb472d ra1e597b  
    8383/** 
    8484 * Create the interface, and prepare it for main loop. 
     85 * You can give some additional options to be used for interface initialization 
    8586 * 
    8687 * \param p_this the calling vlc_object_t 
    8788 * \param psz_module a prefered interface module 
     89 * \param i_options number additional options 
     90 * \param ppsz_options additional option strings 
    8891 * \return a pointer to the created interface thread, NULL on error 
    8992 */ 
    90 intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module ) 
     93intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module, 
     94                              int i_options, char **ppsz_options  ) 
    9195{ 
    9296    intf_thread_t * p_intf; 
     97    int i; 
    9398 
    9499    /* Allocate structure */ 
     
    105110    p_intf->b_interaction = VLC_FALSE; 
    106111 
     112    for( i = 0 ; i< i_options; i++ ) 
     113    { 
     114        var_OptionParse( p_intf, ppsz_options[i] ); 
     115    } 
     116 
    107117    /* Choose the best module */ 
    108118    p_intf->p_module = module_Need( p_intf, "interface", psz_module, 0 ); 
     
    121131    /* Initialize mutexes */ 
    122132    vlc_mutex_init( p_intf, &p_intf->change_lock ); 
    123  
    124     msg_Dbg( p_intf, "interface initialized" ); 
    125133 
    126134    /* Attach interface to its parent object */ 
     
    429437    /* Try to create the interface */ 
    430438    sprintf( psz_intf, "%s,none", newval.psz_string ); 
    431     p_intf = intf_Create( p_this->p_vlc, psz_intf ); 
     439    p_intf = intf_Create( p_this->p_vlc, psz_intf, 0, NULL ); 
    432440    free( psz_intf ); 
    433441    if( p_intf == NULL ) 
  • src/libvlc.c

    r4f86b95 ra1e597b  
    9393 * Local prototypes 
    9494 *****************************************************************************/ 
     95static int AddIntfInternal( int i_object, char const *psz_module, 
     96                             vlc_bool_t b_block, vlc_bool_t b_play, 
     97                             int i_options, char **ppsz_options ); 
     98 
    9599static void LocaleInit( void ); 
    96100static void LocaleDeinit( void ); 
     
    773777#endif 
    774778 
     779    if( config_GetInt( p_vlc, "file-logging" ) == 1 ) 
     780    { 
     781        VLC_AddIntf( 0, "logger", VLC_FALSE, VLC_FALSE ); 
     782    } 
     783    if( config_GetInt( p_vlc, "syslog" ) == 1 ) 
     784    { 
     785        char *psz_logmode = "logmode=syslog"; 
     786        AddIntfInternal( 0, "logger", VLC_FALSE, VLC_FALSE, 1, &psz_logmode ); 
     787    } 
     788 
    775789    /* 
    776790     * FIXME: kludge to use a p_vlc-local variable for the Mozilla plugin 
     
    825839                 vlc_bool_t b_block, vlc_bool_t b_play ) 
    826840{ 
    827     int i_err; 
    828     intf_thread_t *p_intf; 
    829     vlc_t *p_vlc = vlc_current_object( i_object ); 
    830  
    831     if( !p_vlc ) 
    832     { 
    833         return VLC_ENOOBJ; 
    834     } 
    835  
    836 #ifndef WIN32 
    837     if( p_vlc->p_libvlc->b_daemon && b_block && !psz_module ) 
    838     { 
    839         /* Daemon mode hack. 
    840          * We prefer the dummy interface if none is specified. */ 
    841         char *psz_interface = config_GetPsz( p_vlc, "intf" ); 
    842         if( !psz_interface || !*psz_interface ) psz_module = "dummy"; 
    843         if( psz_interface ) free( psz_interface ); 
    844     } 
    845 #endif 
    846  
    847     /* Try to create the interface */ 
    848     p_intf = intf_Create( p_vlc, psz_module ? psz_module : "$intf" ); 
    849  
    850     if( p_intf == NULL ) 
    851     { 
    852         msg_Err( p_vlc, "interface \"%s\" initialization failed", psz_module ); 
    853         if( i_object ) vlc_object_release( p_vlc ); 
    854         return VLC_EGENERIC; 
    855     } 
    856  
    857     /* Interface doesn't handle play on start so do it ourselves */ 
    858     if( !p_intf->b_play && b_play ) VLC_Play( i_object ); 
    859  
    860     /* Try to run the interface */ 
    861     p_intf->b_play = b_play; 
    862     p_intf->b_block = b_block; 
    863     i_err = intf_RunThread( p_intf ); 
    864     if( i_err ) 
    865     { 
    866         vlc_object_detach( p_intf ); 
    867         intf_Destroy( p_intf ); 
    868         if( i_object ) vlc_object_release( p_vlc ); 
    869         return i_err; 
    870     } 
    871  
    872     if( i_object ) vlc_object_release( p_vlc ); 
    873     return VLC_SUCCESS; 
    874 
     841    return AddIntfInternal( i_object, psz_module, b_block, b_play, 0, NULL ); 
     842
     843 
    875844 
    876845/***************************************************************************** 
     
    19131882 
    19141883/* following functions are local */ 
     1884 
     1885 
     1886static int  AddIntfInternal( int i_object, char const *psz_module, 
     1887                             vlc_bool_t b_block, vlc_bool_t b_play, 
     1888                             int i_options, char **ppsz_options ) 
     1889{ 
     1890    int i_err,i; 
     1891    intf_thread_t *p_intf; 
     1892    vlc_t *p_vlc = vlc_current_object( i_object ); 
     1893 
     1894    if( !p_vlc ) 
     1895    { 
     1896        return VLC_ENOOBJ; 
     1897    } 
     1898 
     1899#ifndef WIN32 
     1900    if( p_vlc->p_libvlc->b_daemon && b_block && !psz_module ) 
     1901    { 
     1902        /* Daemon mode hack. 
     1903         * We prefer the dummy interface if none is specified. */ 
     1904        char *psz_interface = config_GetPsz( p_vlc, "intf" ); 
     1905        if( !psz_interface || !*psz_interface ) psz_module = "dummy"; 
     1906        if( psz_interface ) free( psz_interface ); 
     1907    } 
     1908#endif 
     1909 
     1910    /* Try to create the interface */ 
     1911    p_intf = intf_Create( p_vlc, psz_module ? psz_module : "$intf", 
     1912                          i_options, ppsz_options ); 
     1913 
     1914    if( p_intf == NULL ) 
     1915    { 
     1916        msg_Err( p_vlc, "interface \"%s\" initialization failed", psz_module ); 
     1917        if( i_object ) vlc_object_release( p_vlc ); 
     1918        return VLC_EGENERIC; 
     1919    } 
     1920 
     1921    /* Interface doesn't handle play on start so do it ourselves */ 
     1922    if( !p_intf->b_play && b_play ) VLC_Play( i_object ); 
     1923 
     1924    /* Try to run the interface */ 
     1925    p_intf->b_play = b_play; 
     1926    p_intf->b_block = b_block; 
     1927    i_err = intf_RunThread( p_intf ); 
     1928    if( i_err ) 
     1929    { 
     1930        vlc_object_detach( p_intf ); 
     1931        intf_Destroy( p_intf ); 
     1932        if( i_object ) vlc_object_release( p_vlc ); 
     1933        return i_err; 
     1934    } 
     1935 
     1936    for( i = 0  ; i< i_options ; i++ ) 
     1937    { 
     1938         
     1939    } 
     1940 
     1941    if( i_object ) vlc_object_release( p_vlc ); 
     1942    return VLC_SUCCESS; 
     1943}; 
    19151944 
    19161945static void LocaleInit( void ) 
  • src/libvlc.h

    rd83a30d ra1e597b  
    264264#define SS_TEXT N_("Disable screensaver") 
    265265#define SS_LONGTEXT N_("Disable the screensaver during video playback." ) 
     266 
     267#define FILE_LOG_TEXT N_( "Log to file" ) 
     268#define FILE_LOG_LONGTEXT N_( "Log all VLC messages to a text file. Use the "\ 
     269    "logfile option to set the file name." ) 
     270 
     271#define SYSLOG_TEXT N_( "Log to syslog" ) 
     272#define SYSLOG_LONGTEXT N_( "Log all VLC messages to syslog." ) 
    266273 
    267274#define VIDEO_DECO_TEXT N_("Window decorations") 
     
    10761083    add_bool( "disable-screensaver", VLC_TRUE, NULL, SS_TEXT, SS_LONGTEXT, 
    10771084              VLC_TRUE ); 
     1085 
     1086    add_bool( "file-logging", VLC_FALSE, NULL, FILE_LOG_TEXT, FILE_LOG_LONGTEXT, 
     1087              VLC_TRUE ); 
     1088#if HAVE_SYSLOG_H 
     1089    add_bool ( "syslog", VLC_FALSE, NULL, SYSLOG_TEXT, SYSLOG_LONGTEXT, 
     1090               VLC_TRUE ); 
     1091#endif 
    10781092 
    10791093    set_section( N_("Snapshot") , NULL ); 
  • src/misc/variables.c

    r2cb472d ra1e597b  
    917917    return VLC_SUCCESS; 
    918918} 
     919 
     920/** Parse a stringified option 
     921 * This function parse a string option and create the associated object 
     922 * variable 
     923 * The option must be of the form "[no[-]]foo[=bar]" where foo is the 
     924 * option name and bar is the value of the option. 
     925 * \param p_obj the object in which the variable must be created 
     926 * \param psz_option the option to parse 
     927 * \return nothing 
     928 */ 
     929void __var_OptionParse( vlc_object_t *p_obj,const char *psz_option ) 
     930{ 
     931    char *psz_name = (char *)psz_option; 
     932    char *psz_value = strchr( psz_option, '=' ); 
     933    int  i_name_len, i_type; 
     934    vlc_bool_t b_isno = VLC_FALSE; 
     935    vlc_value_t val; 
     936 
     937    if( psz_value ) i_name_len = psz_value - psz_option; 
     938    else i_name_len = strlen( psz_option ); 
     939 
     940    /* It's too much of an hassle to remove the ':' when we parse 
     941     * the cmd line :) */ 
     942    if( i_name_len && *psz_name == ':' ) 
     943    { 
     944        psz_name++; 
     945        i_name_len--; 
     946    } 
     947 
     948    if( i_name_len == 0 ) return; 
     949 
     950    psz_name = strndup( psz_name, i_name_len ); 
     951    if( psz_value ) psz_value++; 
     952 
     953    /* FIXME: :programs should be handled generically */ 
     954    if( !strcmp( psz_name, "programs" ) ) 
     955        i_type = VLC_VAR_LIST; 
     956    else 
     957        i_type = config_GetType( p_obj, psz_name ); 
     958 
     959    if( !i_type && !psz_value ) 
     960    { 
     961        /* check for "no-foo" or "nofoo" */ 
     962        if( !strncmp( psz_name, "no-", 3 ) ) 
     963        { 
     964            memmove( psz_name, psz_name + 3, strlen(psz_name) + 1 - 3 ); 
     965        } 
     966        else if( !strncmp( psz_name, "no", 2 ) ) 
     967        { 
     968            memmove( psz_name, psz_name + 2, strlen(psz_name) + 1 - 2 ); 
     969        } 
     970        else goto cleanup;           /* Option doesn't exist */ 
     971 
     972        b_isno = VLC_TRUE; 
     973        i_type = config_GetType( p_obj, psz_name ); 
     974 
     975        if( !i_type ) goto cleanup;  /* Option doesn't exist */ 
     976    } 
     977    else if( !i_type ) goto cleanup; /* Option doesn't exist */ 
     978 
     979    if( ( i_type != VLC_VAR_BOOL ) && 
     980        ( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */ 
     981 
     982    /* Create the variable in the input object. 
     983     * Children of the input object will be able to retreive this value 
     984     * thanks to the inheritance property of the object variables. */ 
     985    var_Create( p_obj, psz_name, i_type ); 
     986 
     987    switch( i_type ) 
     988    { 
     989    case VLC_VAR_BOOL: 
     990        val.b_bool = !b_isno; 
     991        break; 
     992 
     993    case VLC_VAR_INTEGER: 
     994        val.i_int = strtol( psz_value, NULL, 0 ); 
     995        break; 
     996 
     997    case VLC_VAR_FLOAT: 
     998        val.f_float = atof( psz_value ); 
     999        break; 
     1000 
     1001    case VLC_VAR_STRING: 
     1002    case VLC_VAR_MODULE: 
     1003    case VLC_VAR_FILE: 
     1004    case VLC_VAR_DIRECTORY: 
     1005        val.psz_string = psz_value; 
     1006        break; 
     1007 
     1008    case VLC_VAR_LIST: 
     1009    { 
     1010        char *psz_orig, *psz_var; 
     1011        vlc_list_t *p_list = malloc(sizeof(vlc_list_t)); 
     1012        val.p_list = p_list; 
     1013        p_list->i_count = 0; 
     1014 
     1015        psz_var = psz_orig = strdup(psz_value); 
     1016        while( psz_var && *psz_var ) 
     1017        { 
     1018            char *psz_item = psz_var; 
     1019            vlc_value_t val2; 
     1020            while( *psz_var && *psz_var != ',' ) psz_var++; 
     1021            if( *psz_var == ',' ) 
     1022            { 
     1023                *psz_var = '\0'; 
     1024                psz_var++; 
     1025            } 
     1026            val2.i_int = strtol( psz_item, NULL, 0 ); 
     1027            INSERT_ELEM( p_list->p_values, p_list->i_count, 
     1028                         p_list->i_count, val2 ); 
     1029            /* p_list->i_count is incremented twice by INSERT_ELEM */ 
     1030            p_list->i_count--; 
     1031            INSERT_ELEM( p_list->pi_types, p_list->i_count, 
     1032                         p_list->i_count, VLC_VAR_INTEGER ); 
     1033        } 
     1034        if( psz_orig ) free( psz_orig ); 
     1035        break; 
     1036    } 
     1037 
     1038    default: 
     1039        goto cleanup; 
     1040        break; 
     1041    } 
     1042 
     1043    var_Set( p_obj, psz_name, val ); 
     1044 
     1045  cleanup: 
     1046    if( psz_name ) free( psz_name ); 
     1047    return; 
     1048} 
     1049 
    9191050 
    9201051/* Following functions are local */