]> git.sesse.net Git - vlc/commitdiff
Migrate module, module_list and obsolete_* to vlc_config_set
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 16 Dec 2007 14:34:29 +0000 (14:34 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 16 Dec 2007 14:34:29 +0000 (14:34 +0000)
include/vlc_configuration.h
src/config/core.c
src/modules/entry.c

index 2baae3b64d6d5c9344564a2d2f9a57180526c702..dcb8a820e4ab8b3dbbd6fd1ac5139d83251932ea 100644 (file)
@@ -235,15 +235,39 @@ 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_ADVANCED, /* enable advanced flag (args=none) */
-    VLC_CONFIG_VOLATILE, /* don't write variable to storage (args=none) */
-    VLC_CONFIG_PERSISTENT, /* always write variable to storage (args=none) */
-    VLC_CONFIG_RESTART,  /* restart required to apply value change (args=none) */
-    VLC_CONFIG_PRIVATE,  /* hide from user (args=none) */
+
+    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=int/double/const char *) */
+
+    VLC_CONFIG_RANGE,
+    /* minimum value (args=int/double/const char * twice) */
+
+    VLC_CONFIG_ADVANCED,
+    /* enable advanced flag (args=none) */
+
+    VLC_CONFIG_VOLATILE,
+    /* don't write variable to storage (args=none) */
+
+    VLC_CONFIG_PERSISTENT,
+    /* always write variable to storage (args=none) */
+
+    VLC_CONFIG_RESTART,
+    /* restart required to apply value change (args=none) */
+
+    VLC_CONFIG_PRIVATE,
+    /* hide from user (args=none) */
+
+    VLC_CONFIG_REMOVED,
+    /* tag as no longer supported (args=none) */
+
+    VLC_CONFIG_CAPABILITY,
+    /* capability for a module or list thereof (args=const char*) */
 } vlc_config_t;
 
 
@@ -334,7 +358,8 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
 
 #define add_module( name, psz_caps, value, p_callback, text, longtext, advc ) \
     add_string_inner( CONFIG_ITEM_MODULE, name, text, longtext, advc, p_callback, value ); \
-    p_config[i_config].psz_type = psz_caps
+    vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \
+                    (const char *)(psz_caps))
 
 #define add_module_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \
     add_string_inner( CONFIG_ITEM_MODULE_CAT, name, text, longtext, advc, p_callback, value ); \
@@ -342,7 +367,8 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
 
 #define add_module_list( name, psz_caps, value, p_callback, text, longtext, advc ) \
     add_string_inner( CONFIG_ITEM_MODULE_LIST, name, text, longtext, advc, p_callback, value ); \
-    p_config[i_config].psz_type = psz_caps
+    vlc_config_set (p_config + i_config, VLC_CONFIG_CAPABILITY, \
+                    (const char *)(psz_caps))
 
 #define add_module_list_cat( name, i_subcategory, value, p_callback, text, longtext, advc ) \
     add_string_inner( CONFIG_ITEM_MODULE_LIST_CAT, name, text, longtext, advc, p_callback, value ); \
@@ -386,7 +412,7 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, vlc_config_t, ...) );
     add_type_inner( type ); \
     vlc_config_set (p_config + i_config, VLC_CONFIG_NAME, \
                     (const char *)(name), (vlc_callback_t)NULL); \
-    p_config[ i_config ].psz_current = "SUPPRESSED"
+    vlc_config_set (p_config + i_config, VLC_CONFIG_REMOVED)
 
 #define add_obsolete_bool( name ) \
         add_obsolete_inner( name, CONFIG_ITEM_BOOL )
index d2d2bba77402c0a921605cbc88330e9eb1509532..ab2dcd8cf179c82788689308322a12cfd5518985 100644 (file)
@@ -540,9 +540,9 @@ int config_Duplicate( module_t *p_module, const module_config_t *p_orig,
             p_module->p_config[i].saved.psz = NULL;
         }
 
-        p_module->p_config[i].psz_type = strdupnull (p_orig[i].psz_type);
+        p_module->p_config[i].psz_type = p_orig[i].psz_type;
         p_module->p_config[i].psz_name = p_orig[i].psz_name;
-        p_module->p_config[i].psz_current = strdupnull (p_orig[i].psz_current);
+        p_module->p_config[i].psz_current = p_orig[i].psz_current;
         p_module->p_config[i].psz_text = p_orig[i].psz_text;
         p_module->p_config[i].psz_longtext = p_orig[i].psz_longtext;
 
@@ -628,7 +628,6 @@ void config_Free( module_t *p_module )
 
         free( (char*) p_item->psz_type );
         free( (char*) p_item->psz_name );
-        free( (char*) p_item->psz_current );
         free( (char*) p_item->psz_text );
         free( (char*) p_item->psz_longtext );
 
index a221483d29a22e4381bc11f7de9b2b99c76195b7..253191cecf6d69be61542a73fb3e6e2c7807d223 100644 (file)
@@ -259,6 +259,19 @@ int vlc_config_set (module_config_t *restrict item, vlc_config_t id, ...)
             item->b_internal = VLC_TRUE;
             ret = 0;
             break;
+
+        case VLC_CONFIG_REMOVED:
+            item->psz_current = "SUPPRESSED";
+            ret = 0;
+            break;
+
+        case VLC_CONFIG_CAPABILITY:
+        {
+            const char *cap = va_arg (ap, const char *);
+            item->psz_type = cap ? strdup (cap) : NULL;
+            ret = 0;
+            break;
+        }
     }
 
     va_end (ap);