[vlc-devel] commit: Externally merge vlc_config_set() and vlc_module_set() ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Jan 27 22:09:56 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Jan 27 20:42:40 2009 +0200| [70a56d5650791c01455027322181efcb045b529d] | committer: Rémi Denis-Courmont 

Externally merge vlc_config_set() and vlc_module_set()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=70a56d5650791c01455027322181efcb045b529d
---

 include/vlc_plugin.h |   19 ++++++++++---------
 src/libvlccore.sym   |    3 +--
 src/modules/entry.c  |   24 +++++++++++++++++-------
 3 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index 2725e3a..d47e1a2 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -30,15 +30,17 @@
  */
 
 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 */
 };
 
 /*****************************************************************************
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index a96d9ec..176627d 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -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
diff --git a/src/modules/entry.c b/src/modules/entry.c
index 028fd10..b782888 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -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;
 }




More information about the vlc-devel mailing list