[vlc-devel] commit: Merge vlc_submodule_create and vlc_config_create into vlc_plugin_set ( Rémi Denis-Courmont )

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


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Jan 27 21:17:06 2009 +0200| [b9259bb0c0d86256ae5610b3072e3910edc405d3] | committer: Rémi Denis-Courmont 

Merge vlc_submodule_create and vlc_config_create into vlc_plugin_set

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

 include/vlc_plugin.h  |   10 ++++++----
 src/libvlccore.sym    |    2 --
 src/modules/entry.c   |   21 ++++++++++++++++++++-
 src/modules/modules.h |    1 +
 4 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index d47e1a2..5595e20 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -29,15 +29,16 @@
  * This file implements plugin (module) macros used to define a vlc module.
  */
 
-VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) );
 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
 {
+    VLC_SUBMODULE_CREATE,
+    VLC_CONFIG_CREATE,
+
     /* 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=0x100,
@@ -191,7 +192,8 @@ enum vlc_module_properties
     VLC_METADATA_EXPORTS
 
 #define add_submodule( ) \
-    p_submodule = vlc_submodule_create( p_module );
+    if (vlc_plugin_set (p_module, NULL, VLC_SUBMODULE_CREATE, &p_submodule)) \
+        goto error;
 
 #define add_requirement( cap ) \
     if (vlc_module_set (p_module, VLC_MODULE_CPU_REQUIREMENT, \
@@ -249,7 +251,7 @@ enum vlc_module_properties
  *****************************************************************************/
 
 #define add_type_inner( type ) \
-    p_config = vlc_config_create (p_module, type);
+    vlc_plugin_set (p_module, NULL, VLC_CONFIG_CREATE, (type), &p_config);
 
 #define add_typedesc_inner( type, text, longtext ) \
     add_type_inner( type ) \
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 176627d..eb41fda 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -443,7 +443,6 @@ vlc_cond_init
 vlc_cond_signal
 vlc_cond_timedwait
 vlc_cond_wait
-vlc_config_create
 vlc_control_cancel
 vlc_CPU
 vlc_error
@@ -505,7 +504,6 @@ vlc_sendmsg
 vlc_strcasestr
 vlc_strlcpy
 vlc_strtoll
-vlc_submodule_create
 vlc_testcancel
 vlc_thread_create
 __vlc_thread_join
diff --git a/src/modules/entry.c b/src/modules/entry.c
index cd03b08..0014cc7 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -123,7 +123,7 @@ module_t *vlc_submodule_create (module_t *module)
     return submodule;
 }
 
-module_config_t *vlc_config_create (module_t *module, int type)
+static module_config_t *vlc_config_create (module_t *module, int type)
 {
     unsigned confsize = module->confsize;
     module_config_t *tab = module->p_config;
@@ -161,6 +161,25 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
     va_start (ap, propid);
     switch (propid)
     {
+        case VLC_SUBMODULE_CREATE:
+        {
+            module_t **pp = va_arg (ap, module_t **);
+            *pp = vlc_submodule_create (module);
+            if (*pp == NULL)
+                ret = -1;
+            break;
+        }
+
+        case VLC_CONFIG_CREATE:
+        {
+            int type = va_arg (ap, int);
+            module_config_t **pp = va_arg (ap, module_config_t **);
+            *pp = vlc_config_create (module, type);
+            if (*pp == NULL)
+                ret = -1;
+            break;
+        }
+
         case VLC_MODULE_CPU_REQUIREMENT:
             assert (!module->b_submodule);
             module->i_cpu |= va_arg (ap, int);
diff --git a/src/modules/modules.h b/src/modules/modules.h
index 9d941bf..b208987 100644
--- a/src/modules/modules.h
+++ b/src/modules/modules.h
@@ -147,6 +147,7 @@ struct module_t
 };
 
 module_t *vlc_module_create (vlc_object_t *);
+module_t *vlc_submodule_create (module_t *module);
 
 #define module_InitBank(a)     __module_InitBank(VLC_OBJECT(a))
 void  __module_InitBank        ( vlc_object_t * );




More information about the vlc-devel mailing list