[vlc-commits] plugin: pass string identifier for callbacks

Rémi Denis-Courmont git at videolan.org
Thu Oct 27 18:46:15 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 27 15:01:36 2016 +0300| [f4277df90b167b987bbeef3008c6e3cf1776dd2d] | committer: Rémi Denis-Courmont

plugin: pass string identifier for callbacks

This would enable identifying unique callback functions within a plugin
even when the plugin is not loaded, and in particular within the
plugins cache file.

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

 include/vlc_plugin.h | 14 +++++++-------
 src/modules/entry.c  |  3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index bd5c154..0d4e943 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -103,7 +103,7 @@ enum vlc_module_properties
 
     VLC_CONFIG_LIST_CB,
     /* callback for suggested values
-     * (args=size_t (*)(vlc_object_t *, <type> **, char ***)) */
+     * (args=const char *, size_t (*)(vlc_object_t *, <type> **, char ***)) */
 
     /* Insert new VLC_CONFIG_* here */
 };
@@ -188,8 +188,8 @@ enum vlc_module_properties
 /**
  * Current plugin ABI version
  */
-# define MODULE_SYMBOL 3_0_0c
-# define MODULE_SUFFIX "__3_0_0c"
+# define MODULE_SYMBOL 3_0_0d
+# define MODULE_SUFFIX "__3_0_0d"
 
 /*****************************************************************************
  * Add a few defines. You do not want to read this section. Really.
@@ -299,8 +299,8 @@ VLC_METADATA_EXPORTS
         goto error;
 
 #define set_callbacks( activate, deactivate ) \
-    if (vlc_module_set (VLC_MODULE_CB_OPEN, activate) \
-     || vlc_module_set (VLC_MODULE_CB_CLOSE, deactivate)) \
+    if (vlc_module_set (VLC_MODULE_CB_OPEN, #activate, activate) \
+     || vlc_module_set (VLC_MODULE_CB_CLOSE, #deactivate, deactivate)) \
         goto error;
 
 #define cannot_unload_broken_library( ) \
@@ -470,7 +470,7 @@ VLC_METADATA_EXPORTS
                     (const char *const *)(list_text));
 
 #define change_string_cb( cb ) \
-    vlc_config_set (VLC_CONFIG_LIST_CB, (cb));
+    vlc_config_set (VLC_CONFIG_LIST_CB, #cb, (cb));
 
 #define change_integer_list( list, list_text ) \
     vlc_config_set (VLC_CONFIG_LIST, \
@@ -479,7 +479,7 @@ VLC_METADATA_EXPORTS
                     (const char *const *)(list_text));
 
 #define change_integer_cb( cb ) \
-    vlc_config_set (VLC_CONFIG_LIST_CB, (cb));
+    vlc_config_set (VLC_CONFIG_LIST_CB, #cb, (cb));
 
 #define change_integer_range( minv, maxv ) \
     vlc_config_set (VLC_CONFIG_RANGE, (int64_t)(minv), (int64_t)(maxv));
diff --git a/src/modules/entry.c b/src/modules/entry.c
index 1721e81..7af97e9 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -252,10 +252,12 @@ static int vlc_plugin_setter(void *ctx, void *tgt, int propid, ...)
             break;
 
         case VLC_MODULE_CB_OPEN:
+            va_arg(ap, const char *);
             module->pf_activate = va_arg (ap, void *);
             break;
 
         case VLC_MODULE_CB_CLOSE:
+            va_arg(ap, const char *);
             module->pf_deactivate = va_arg (ap, void *);
             break;
 
@@ -415,6 +417,7 @@ static int vlc_plugin_setter(void *ctx, void *tgt, int propid, ...)
         }
 
         case VLC_CONFIG_LIST_CB:
+            va_arg(ap, const char *);
             if (IsConfigIntegerType (item->i_type))
                item->list.i_cb = va_arg (ap, vlc_integer_list_cb);
             else



More information about the vlc-commits mailing list