vlc_configuration.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * configuration.h : configuration management module
00003  * This file describes the programming interface for the configuration module.
00004  * It includes functions allowing to declare, get or set configuration options.
00005  *****************************************************************************
00006  * Copyright (C) 1999-2006 the VideoLAN team
00007  * $Id$
00008  *
00009  * Authors: Gildas Bazin <gbazin@videolan.org>
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00024  *****************************************************************************/
00025 
00026 #ifndef VLC_CONFIGURATION_H
00027 #define VLC_CONFIGURATION_H 1
00028 
00029 
00030 # ifdef __cplusplus
00031 extern "C" {
00032 # endif
00033 
00034 /*****************************************************************************
00035  * Macros used to build the configuration structure.
00036  *****************************************************************************/
00037 
00038 /* Configuration hint types */
00039 
00040 
00041 #define CONFIG_HINT_CATEGORY                0x0002  /* Start of new category */
00042 #define CONFIG_HINT_SUBCATEGORY             0x0003  /* Start of sub-category */
00043 #define CONFIG_HINT_SUBCATEGORY_END         0x0004  /* End of sub-category */
00044 #define CONFIG_HINT_USAGE                   0x0005  /* Usage information */
00045 
00046 #define CONFIG_CATEGORY                     0x0006 /* Set category */
00047 #define CONFIG_SUBCATEGORY                  0x0007 /* Set subcategory */
00048 #define CONFIG_SECTION                      0x0008 /* Start of new section */
00049 
00050 #define CONFIG_HINT                         0x000F
00051 
00052 /* Configuration item types */
00053 #define CONFIG_ITEM_STRING                  0x0010  /* String option */
00054 #define CONFIG_ITEM_FILE                    0x0020  /* File option */
00055 #define CONFIG_ITEM_MODULE                  0x0030  /* Module option */
00056 #define CONFIG_ITEM_INTEGER                 0x0040  /* Integer option */
00057 #define CONFIG_ITEM_BOOL                    0x0050  /* Bool option */
00058 #define CONFIG_ITEM_FLOAT                   0x0060  /* Float option */
00059 #define CONFIG_ITEM_DIRECTORY               0x0070  /* Directory option */
00060 #define CONFIG_ITEM_KEY                     0x0080  /* Hot key option */
00061 #define CONFIG_ITEM_MODULE_CAT              0x0090  /* Module option */
00062 #define CONFIG_ITEM_MODULE_LIST             0x00A0  /* Module option */
00063 #define CONFIG_ITEM_MODULE_LIST_CAT         0x00B0  /* Module option */
00064 #define CONFIG_ITEM_FONT                    0x00C0  /* Font option */
00065 #define CONFIG_ITEM_PASSWORD                0x00D0  /* Password option (*) */
00066 
00067 #define CONFIG_ITEM                         0x00F0
00068 
00069 /*******************************************************************
00070  * All predefined categories and subcategories
00071  *******************************************************************/
00072 #define CAT_INTERFACE 1
00073    #define SUBCAT_INTERFACE_GENERAL 101
00074    #define SUBCAT_INTERFACE_MAIN 102
00075    #define SUBCAT_INTERFACE_CONTROL 103
00076    #define SUBCAT_INTERFACE_HOTKEYS 104
00077 
00078 #define CAT_AUDIO 2
00079    #define SUBCAT_AUDIO_GENERAL 201
00080    #define SUBCAT_AUDIO_AOUT 202
00081    #define SUBCAT_AUDIO_AFILTER 203
00082    #define SUBCAT_AUDIO_VISUAL 204
00083    #define SUBCAT_AUDIO_MISC 205
00084 
00085 #define CAT_VIDEO 3
00086    #define SUBCAT_VIDEO_GENERAL 301
00087    #define SUBCAT_VIDEO_VOUT 302
00088    #define SUBCAT_VIDEO_VFILTER 303
00089    #define SUBCAT_VIDEO_TEXT 304
00090    #define SUBCAT_VIDEO_SUBPIC 305
00091    #define SUBCAT_VIDEO_VFILTER2 306
00092 
00093 #define CAT_INPUT 4
00094    #define SUBCAT_INPUT_GENERAL 401
00095    #define SUBCAT_INPUT_ACCESS 402
00096    #define SUBCAT_INPUT_ACCESS_FILTER 403
00097    #define SUBCAT_INPUT_DEMUX 404
00098    #define SUBCAT_INPUT_VCODEC 405
00099    #define SUBCAT_INPUT_ACODEC 406
00100    #define SUBCAT_INPUT_SCODEC 407
00101 
00102 #define CAT_SOUT 5
00103    #define SUBCAT_SOUT_GENERAL 501
00104    #define SUBCAT_SOUT_STREAM 502
00105    #define SUBCAT_SOUT_MUX 503
00106    #define SUBCAT_SOUT_ACO 504
00107    #define SUBCAT_SOUT_PACKETIZER 505
00108    #define SUBCAT_SOUT_SAP 506
00109    #define SUBCAT_SOUT_VOD 507
00110 
00111 #define CAT_ADVANCED 6
00112    #define SUBCAT_ADVANCED_CPU 601
00113    #define SUBCAT_ADVANCED_MISC 602
00114    #define SUBCAT_ADVANCED_NETWORK 603
00115    #define SUBCAT_ADVANCED_XML 604
00116 
00117 #define CAT_PLAYLIST 7
00118    #define SUBCAT_PLAYLIST_GENERAL 701
00119    #define SUBCAT_PLAYLIST_SD 702
00120    #define SUBCAT_PLAYLIST_EXPORT 703
00121 
00122 #define CAT_OSD 8
00123    #define SUBCAT_OSD_IMPORT 801
00124 
00125 struct config_category_t
00126 {
00127     int         i_id;
00128     const char *psz_name;
00129     const char *psz_help;
00130 };
00131 
00132 typedef union
00133 {
00134     char       *psz;
00135     int         i;
00136     float       f;
00137 } module_value_t;
00138 
00139 typedef union
00140 {
00141     int         i;
00142     float       f;
00143 } module_nvalue_t;
00144 
00145 struct module_config_t
00146 {
00147     int          i_type;                               /* Configuration type */
00148     char        *psz_type;                          /* Configuration subtype */
00149     char        *psz_name;                                    /* Option name */
00150     char         i_short;                      /* Optional short option name */
00151     char        *psz_text;      /* Short comment on the configuration option */
00152     char        *psz_longtext;   /* Long comment on the configuration option */
00153     module_value_t value;                                    /* Option value */
00154     module_value_t orig;
00155     module_value_t saved;
00156     module_nvalue_t min;
00157     module_nvalue_t max;
00158 
00159     /* Function to call when commiting a change */
00160     vlc_callback_t pf_callback;
00161     void          *p_callback_data;
00162 
00163     /* Values list */
00164     char **      ppsz_list;       /* List of possible values for the option */
00165     int         *pi_list;                              /* Idem for integers */
00166     char       **ppsz_list_text;          /* Friendly names for list values */
00167     int          i_list;                               /* Options list size */
00168     vlc_callback_t pf_update_list; /*callback to initialize dropdownlists */
00169 
00170     /* Actions list */
00171     vlc_callback_t *ppf_action;    /* List of possible actions for a config */
00172     char          **ppsz_action_text;         /* Friendly names for actions */
00173     int            i_action;                           /* actions list size */
00174 
00175     /* Misc */
00176     vlc_mutex_t *p_lock;           /* Lock to use when modifying the config */
00177     bool        b_dirty;          /* Dirty flag to indicate a config change */
00178     bool        b_advanced;          /* Flag to indicate an advanced option */
00179     bool        b_internal;   /* Flag to indicate option is not to be shown */
00180     bool        b_restart;   /* Flag to indicate the option needs a restart */
00181                               /* to take effect */
00182 
00183     /* Deprecated */
00184     char        *psz_oldname;                          /* Old option name */
00185     bool        b_removed;
00186 
00187     /* Option values loaded from config file */
00188     bool        b_autosave;      /* Config will be auto-saved at exit time */
00189     bool        b_unsaveable;                /* Config should not be saved */
00190 
00191     bool        b_safe;
00192 };
00193 
00194 /*****************************************************************************
00195  * Prototypes - these methods are used to get, set or manipulate configuration
00196  * data.
00197  *****************************************************************************/
00198 VLC_EXPORT( int,    __config_GetType,  (vlc_object_t *, const char *) );
00199 VLC_EXPORT( int,    __config_GetInt,   (vlc_object_t *, const char *) );
00200 VLC_EXPORT( void,   __config_PutInt,   (vlc_object_t *, const char *, int) );
00201 VLC_EXPORT( float,  __config_GetFloat, (vlc_object_t *, const char *) );
00202 VLC_EXPORT( void,   __config_PutFloat, (vlc_object_t *, const char *, float) );
00203 VLC_EXPORT( char *, __config_GetPsz,   (vlc_object_t *, const char *) );
00204 VLC_EXPORT( void,   __config_PutPsz,   (vlc_object_t *, const char *, const char *) );
00205 
00206 #define config_SaveConfigFile(a,b) __config_SaveConfigFile(VLC_OBJECT(a),b)
00207 VLC_EXPORT( int,    __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
00208 #define config_ResetAll(a) __config_ResetAll(VLC_OBJECT(a))
00209 VLC_EXPORT( void,   __config_ResetAll, ( vlc_object_t * ) );
00210 
00211 VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) );
00212 
00213 VLC_EXPORT(const char *, config_GetDataDir, ( void ));
00214 VLC_EXPORT(const char *, config_GetConfDir, ( void ) );
00215 VLC_EXPORT(const char *, config_GetHomeDir, ( void ));
00216 VLC_EXPORT(char *, config_GetUserConfDir, ( void ) );
00217 VLC_EXPORT(char *, config_GetUserDataDir, ( void ) );
00218 VLC_EXPORT(char *, config_GetCacheDir, ( void ) );
00219 
00220 VLC_EXPORT( void,       __config_AddIntf,    ( vlc_object_t *, const char * ) );
00221 VLC_EXPORT( void,       __config_RemoveIntf, ( vlc_object_t *, const char * ) );
00222 VLC_EXPORT( bool, __config_ExistIntf,  ( vlc_object_t *, const char * ) );
00223 
00224 #define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
00225 #define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
00226 #define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c)
00227 #define config_GetFloat(a,b) __config_GetFloat(VLC_OBJECT(a),b)
00228 #define config_PutFloat(a,b,c) __config_PutFloat(VLC_OBJECT(a),b,c)
00229 #define config_GetPsz(a,b) __config_GetPsz(VLC_OBJECT(a),b)
00230 #define config_PutPsz(a,b,c) __config_PutPsz(VLC_OBJECT(a),b,c)
00231 
00232 #define config_AddIntf(a,b) __config_AddIntf(VLC_OBJECT(a),b)
00233 #define config_RemoveIntf(a,b) __config_RemoveIntf(VLC_OBJECT(a),b)
00234 #define config_ExistIntf(a,b) __config_ExistIntf(VLC_OBJECT(a),b)
00235 
00236 /****************************************************************************
00237  * config_chain_t:
00238  ****************************************************************************/
00239 struct config_chain_t
00240 {
00241     config_chain_t *p_next;
00242 
00243     char        *psz_name;
00244     char        *psz_value;
00245 };
00246 
00247 #define config_ChainParse( a, b, c, d ) __config_ChainParse( VLC_OBJECT(a), b, c, d )
00248 VLC_EXPORT( void,   __config_ChainParse, ( vlc_object_t *, const char *psz_prefix, const char *const *ppsz_options, config_chain_t * ) );
00249 VLC_EXPORT( char *, config_ChainCreate, ( char **, config_chain_t **, const char * ) );
00250 VLC_EXPORT( void, config_ChainDestroy, ( config_chain_t * ) );
00251 
00252 # ifdef __cplusplus
00253 }
00254 # endif
00255 
00256 #endif /* _VLC_CONFIGURATION_H */

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1