]> git.sesse.net Git - vlc/blobdiff - include/vlc_configuration.h
Partially introduce vlc_config_set() to modify module_config_t through a less brittle API
[vlc] / include / vlc_configuration.h
index 6ced4a5c2f2a73685219e8ab3c224413051610df..da7524996e0bc73d545fe00aa62c6e93a28b101f 100644 (file)
@@ -123,6 +123,9 @@ extern "C" {
    #define SUBCAT_PLAYLIST_SD 702
    #define SUBCAT_PLAYLIST_EXPORT 703
 
+#define CAT_OSD 8
+   #define SUBCAT_OSD_IMPORT 801
+
 struct config_category_t
 {
     int         i_id;
@@ -207,12 +210,15 @@ VLC_EXPORT( int,    __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( void,   __config_ResetAll, ( vlc_object_t * ) );
 
 VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) );
-VLC_EXPORT( module_t *, config_FindModule,( vlc_object_t *, const char * ) );
 
 VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t ));
 
 VLC_EXPORT(const char *, config_GetDataDir, ( void ));
 
+VLC_EXPORT( void,       __config_AddIntf,    ( vlc_object_t *, const char * ) );
+VLC_EXPORT( void,       __config_RemoveIntf, ( vlc_object_t *, const char * ) );
+VLC_EXPORT( vlc_bool_t, __config_ExistIntf,  ( vlc_object_t *, const char * ) );
+
 #define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
 #define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
 #define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c)
@@ -221,6 +227,26 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
 #define config_GetPsz(a,b) __config_GetPsz(VLC_OBJECT(a),b)
 #define config_PutPsz(a,b,c) __config_PutPsz(VLC_OBJECT(a),b,c)
 
+#define config_AddIntf(a,b) __config_AddIntf(VLC_OBJECT(a),b)
+#define config_RemoveIntf(a,b) __config_RemoveIntf(VLC_OBJECT(a),b)
+#define config_ExistIntf(a,b) __config_ExistIntf(VLC_OBJECT(a),b)
+
+typedef enum vlc_config_properties
+{
+    /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI!
+     * Append new items at the end ONLY. */
+    VLC_CONFIG_NAME,     /* command line name (args=const char *, vlc_callback_t) */
+    VLC_CONFIG_DESC,     /* description (args=const char *, const char *) */
+    VLC_CONFIG_VALUE,    /* actual value (args=<type>) */
+    VLC_CONFIG_RANGE,    /* minimum value (args=<type>, <type>) */
+    VLC_CONFIG_STEP,     /* interval value (args=<type>) */
+    VLC_CONFIG_ADVANCED, /* enable advanced flag (args=none) */
+    VLC_CONFIG_VOLATILE, /* don't write variable to storage (args=none) */
+    VLC_CONFIG_PRIVATE,  /* hide from user (args=none) */
+} vlc_config_t;
+
+
+VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
 
 /*****************************************************************************
  * Macros used to build the configuration structure.
@@ -248,8 +274,8 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
 
 #define add_typedesc_inner( type, text, longtext ) \
     add_type_inner( type ); \
-    p_config[i_config].psz_text = text; \
-    p_config[i_config].psz_longtext = longtext
+    vlc_config_set (p_config + i_config, VLC_CONFIG_DESC, \
+                    (const char *)(text), (const char *)(longtext))
 
 #define add_typeadv_inner( type, text, longtext, advc ) \
     add_typedesc_inner( type, text, longtext ); \
@@ -257,17 +283,13 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
 
 #define add_typename_inner( type, name, text, longtext, advc, cb ) \
     add_typeadv_inner( type, text, longtext, advc ); \
-    p_config[i_config].psz_name = name; \
-    p_config[i_config].pf_callback = cb
+    vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \
+                    (const char *)(name), (vlc_callback_t)(cb))
 
 #define add_string_inner( type, name, text, longtext, advc, cb, v ) \
     add_typename_inner( type, name, text, longtext, advc, cb ); \
     p_config[i_config].value.psz = v
 
-#define add_password_inner( type, name, text, longtext, advc, cb, v ) \
-    add_typename_inner( type, name, text, longtext, advc, cb ); \
-    p_config[i_config].value.psz = v
-
 #define add_int_inner( type, name, text, longtext, advc, cb, v ) \
     add_typename_inner( type, name, text, longtext, advc, cb ); \
     p_config[i_config].value.i = v
@@ -300,7 +322,7 @@ VLC_EXPORT(const char *, config_GetDataDir, ( void ));
     add_string_inner( CONFIG_ITEM_STRING, name, text, longtext, advc, p_callback, value )
 
 #define add_password( name, value, p_callback, text, longtext, advc ) \
-    add_password_inner( CONFIG_ITEM_PASSWORD, name, text, longtext, advc, p_callback, value )
+    add_string_inner( CONFIG_ITEM_PASSWORD, name, text, longtext, advc, p_callback, value )
 
 #define add_file( name, value, p_callback, text, longtext, advc ) \
     add_string_inner( CONFIG_ITEM_FILE, name, text, longtext, advc, p_callback, value )
@@ -439,31 +461,6 @@ VLC_EXPORT( void,   __config_ChainParse, ( vlc_object_t *, const char *psz_prefi
 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;
-}
-
 # ifdef __cplusplus
 }
 # endif