]> git.sesse.net Git - vlc/commitdiff
Externally merge vlc_config_set() and vlc_module_set()
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Tue, 27 Jan 2009 18:42:40 +0000 (20:42 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Tue, 27 Jan 2009 21:03:06 +0000 (23:03 +0200)
include/vlc_plugin.h
src/libvlccore.sym
src/modules/entry.c

index 2725e3a6ed337e9f61076ea31321c02338facebd..d47e1a2907082de5899a961e29bd3646f57a897b 100644 (file)
  */
 
 VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) );
-VLC_EXPORT( int, vlc_module_set, (module_t *module, int propid, ...) );
-VLC_EXPORT( module_config_t *, vlc_config_create, (module_t *, int type) );
-VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
+VLC_EXPORT( int, vlc_plugin_set, (module_t *, module_config_t *, int, ...) );
+VLC_EXPORT( module_config_t *, vlc_config_create, (module_t *, int) );
+
+#define vlc_module_set( mod, ... ) vlc_plugin_set ((mod), NULL, __VA_ARGS__)
+#define vlc_config_set( cfg, ... ) vlc_plugin_set (NULL, (cfg), __VA_ARGS__)
 
 enum vlc_module_properties
 {
     /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI!
      * Append new items at the end ONLY. */
-    VLC_MODULE_CPU_REQUIREMENT,
+    VLC_MODULE_CPU_REQUIREMENT=0x100,
     VLC_MODULE_SHORTCUT,
     VLC_MODULE_CAPABILITY,
     VLC_MODULE_SCORE,
@@ -49,14 +51,11 @@ enum vlc_module_properties
     VLC_MODULE_SHORTNAME,
     VLC_MODULE_DESCRIPTION,
     VLC_MODULE_HELP,
-};
+    /* Insert new VLC_MODULE_* here */
 
-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,
+    VLC_CONFIG_NAME=0x1000,
     /* command line name (args=const char *, vlc_callback_t) */
 
     VLC_CONFIG_VALUE,
@@ -105,6 +104,8 @@ enum vlc_config_properties
     VLC_CONFIG_ADD_ACTION,
     /* add value change callback
      * (args=const char *, vlc_callback_t, const char *) */
+
+    /* Insert new VLC_CONFIG_* here */
 };
 
 /*****************************************************************************
index a96d9ec91abc6ab46cf689b37fe73241de0aea6d..176627d0e9c849ef44961b32372643c2a65fa976 100644 (file)
@@ -444,7 +444,6 @@ vlc_cond_signal
 vlc_cond_timedwait
 vlc_cond_wait
 vlc_config_create
-vlc_config_set
 vlc_control_cancel
 vlc_CPU
 vlc_error
@@ -473,7 +472,6 @@ __vlc_list_children
 vlc_list_release
 vlc_memcpy
 vlc_memset
-vlc_module_set
 vlc_mutex_destroy
 vlc_mutex_init
 vlc_mutex_init_recursive
@@ -491,6 +489,7 @@ __vlc_object_lock
 __vlc_object_release
 __vlc_object_set_destructor
 __vlc_object_unlock
+vlc_plugin_set
 vlc_poll
 vlc_rand_bytes
 vlc_recvmsg
index 028fd10d466ecf6862fbf42f692f26e80b762bea..b7828888ff96ec28b350a4af315690a54011c649 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
+#undef vlc_module_set
+#undef vlc_config_set
 #include <assert.h>
 #include <stdarg.h>
 
@@ -124,12 +126,10 @@ module_t *vlc_submodule_create (module_t *module)
 }
 
 
-int vlc_module_set (module_t *module, int propid, ...)
+static int vlc_module_set (module_t *module, int propid, va_list ap)
 {
-    va_list ap;
     int ret = VLC_SUCCESS;
 
-    va_start (ap, propid);
     switch (propid)
     {
         case VLC_MODULE_CPU_REQUIREMENT:
@@ -215,7 +215,6 @@ int vlc_module_set (module_t *module, int propid, ...)
             ret = VLC_EGENERIC;
             break;
     }
-    va_end (ap);
     return ret;
 }
 
@@ -248,13 +247,11 @@ module_config_t *vlc_config_create (module_t *module, int type)
     return tab + confsize;
 }
 
-int vlc_config_set (module_config_t *restrict item, int id, ...)
+static int vlc_config_set (module_config_t *restrict item, int id, va_list ap)
 {
     int ret = -1;
-    va_list ap;
 
     assert (item != NULL);
-    va_start (ap, id);
 
     switch (id)
     {
@@ -499,7 +496,20 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             break;
         }
     }
+    return ret;
+}
 
+int vlc_plugin_set (module_t *module, module_config_t *cfg, int id, ...)
+{
+    va_list ap;
+    int ret = -1;
+
+    va_start (ap, id);
+    if (module != NULL)
+        ret = vlc_module_set (module, id, ap);
+    else if (cfg != NULL)
+        ret = vlc_config_set (cfg, id, ap);
     va_end (ap);
+
     return ret;
 }