]> git.sesse.net Git - vlc/blobdiff - include/configuration.h
* Other way around of course
[vlc] / include / configuration.h
index 6b708809c88a8b8e5a0b37eeef102e74a9c88a55..6bea943c808540c78269127365e1b756166131eb 100644 (file)
@@ -79,6 +79,7 @@
    #define SUBCAT_VIDEO_VFILTER 303
    #define SUBCAT_VIDEO_TEXT 304
    #define SUBCAT_VIDEO_SUBPIC 305
+   #define SUBCAT_VIDEO_VFILTER2 306
 
 #define CAT_INPUT 4
    #define SUBCAT_INPUT_GENERAL 401
 struct config_category_t
 {
     int         i_id;
-    char       *psz_name;
-    char       *psz_help;
+    const char *psz_name;
+    const char *psz_help;
 };
 
 struct module_config_t
 {
     int          i_type;                               /* Configuration type */
-    char        *psz_type;                          /* Configuration subtype */
-    char        *psz_name;                                    /* Option name */
+    const char  *psz_type;                          /* Configuration subtype */
+    const char  *psz_name;                                    /* Option name */
     char         i_short;                      /* Optional short option name */
-    char        *psz_text;      /* Short comment on the configuration option */
-    char        *psz_longtext;   /* Long comment on the configuration option */
-    char        *psz_value;                                  /* Option value */
+    const char  *psz_text;      /* Short comment on the configuration option */
+    const char  *psz_longtext;   /* Long comment on the configuration option */
+    const char  *psz_value;                                  /* Option value */
     int          i_value;                                    /* Option value */
     float        f_value;                                    /* Option value */
     int         i_min;                               /* Option minimum value */
@@ -137,31 +138,34 @@ struct module_config_t
     void          *p_callback_data;
 
     /* Values list */
-    char       **ppsz_list;        /* List of possible values for the option */
+    const char **ppsz_list;        /* List of possible values for the option */
     int         *pi_list;          /* Idem for integers */
-    char       **ppsz_list_text;   /* Friendly names for list values */
+    const char **ppsz_list_text;   /* Friendly names for list values */
     int          i_list;           /* Options list size */
 
     /* Actions list */
     vlc_callback_t *ppf_action;    /* List of possible actions for a config */
-    char           **ppsz_action_text;         /* Friendly names for actions */
+    const char    **ppsz_action_text;         /* Friendly names for actions */
     int            i_action;                            /* actions list size */
 
     /* Deprecated */
-    char           *psz_current;   /* Good option name */
+    const char    *psz_current;   /* Good option name */
     vlc_bool_t     b_strict;      /* Transitionnal or strict */
     /* Misc */
     vlc_mutex_t *p_lock;            /* Lock to use when modifying the config */
     vlc_bool_t   b_dirty;          /* Dirty flag to indicate a config change */
     vlc_bool_t   b_advanced;          /* Flag to indicate an advanced option */
+    vlc_bool_t   b_internal;   /* Flag to indicate option is not to be shown */
+    vlc_bool_t   b_restart;    /* Flag to indicate the option need a restart */
+                               /* to take effect */
 
     /* Original option values */
-    char        *psz_value_orig;
+    const char  *psz_value_orig;
     int          i_value_orig;
     float        f_value_orig;
 
     /* Option values loaded from config file */
-    char        *psz_value_saved;
+    const char  *psz_value_saved;
     int          i_value_saved;
     float        f_value_saved;
     vlc_bool_t   b_autosave;       /* Config will be auto-saved at exit time */
@@ -330,7 +334,7 @@ int config_AutoSaveConfigFile( vlc_object_t * );
     add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc, p_callback ); \
     p_config[i_config].i_value = value
 
-/* For option renamed */
+/* For renamed option */
 #define add_deprecated( name, strict ) \
     add_config_inner( ); \
     p_config[ i_config ].i_type = p_config[ i_config -1 ].i_type; \
@@ -340,7 +344,7 @@ int config_AutoSaveConfigFile( vlc_object_t * );
         ? p_config[ i_config-1 ].psz_current \
         : p_config[ i_config-1 ].psz_name;
 
-/* For option suppressed*/
+/* For removed option */
 #define add_suppressed_inner( name, type ) \
     add_type_inner( type ); \
     p_config[ i_config ].psz_name = name; \
@@ -369,7 +373,7 @@ int config_AutoSaveConfigFile( vlc_object_t * );
 
 #define change_integer_list( list, list_text, list_update_func ) \
     p_config[i_config].i_list = sizeof(list)/sizeof(int); \
-    p_config[i_config].pi_list = list; \
+    p_config[i_config].pi_list = (int *)list; \
     p_config[i_config].ppsz_list_text = list_text;
 
 #define change_integer_range( min, max ) \
@@ -387,7 +391,7 @@ int config_AutoSaveConfigFile( vlc_object_t * );
     p_config[i_config].ppf_action = (vlc_callback_t *) \
       realloc( p_config[i_config].ppf_action, \
       (p_config[i_config].i_action + 1) * sizeof(void *) ); \
-    p_config[i_config].ppsz_action_text = (char **)\
+    p_config[i_config].ppsz_action_text = (const char **)\
       realloc( p_config[i_config].ppsz_action_text, \
       (p_config[i_config].i_action + 1) * sizeof(void *) ); \
     p_config[i_config].ppf_action[p_config[i_config].i_action] = pf_action; \
@@ -395,5 +399,53 @@ int config_AutoSaveConfigFile( vlc_object_t * );
       action_text; \
     p_config[i_config].i_action++;
 
+#define change_internal() \
+    p_config[i_config].b_internal = VLC_TRUE;
+
+#define change_need_restart() \
+    p_config[i_config].b_restart = VLC_TRUE;
+
 #define change_autosave() \
     p_config[i_config].b_autosave = VLC_TRUE;
+
+
+/****************************************************************************
+ * config_chain_t:
+ ****************************************************************************/
+struct config_chain_t
+{
+    config_chain_t *p_next;
+
+    char        *psz_name;
+    char        *psz_value;
+};
+
+#define config_ChainParse( a, b, c, d ) __config_ChainParse( VLC_OBJECT(a), b, c, d )
+VLC_EXPORT( void,   __config_ChainParse, ( vlc_object_t *, const char *psz_prefix, const char **ppsz_options, config_chain_t * ) );
+VLC_EXPORT( char *, config_ChainCreate, ( char **, config_chain_t **, const char * ) );
+VLC_EXPORT( void, config_ChainDestroy, ( config_chain_t * ) );
+
+static inline config_chain_t *config_chain_find( config_chain_t *p_cfg, const char *psz_name )
+{
+    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
+    {
+        p_cfg = p_cfg->p_next;
+    }
+
+    return p_cfg;
+}
+
+static inline char *config_chain_find_value( config_chain_t *p_cfg, const char *psz_name )
+{
+    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
+    {
+        p_cfg = p_cfg->p_next;
+    }
+
+    if( p_cfg && p_cfg->psz_value )
+    {
+        return( p_cfg->psz_value );
+    }
+
+    return NULL;
+}