[vlc-commits] Remove ugly builtin support

Rémi Denis-Courmont git at videolan.org
Mon May 2 10:57:49 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May  1 21:06:15 2011 +0300| [473a276fdd990c75efe1106a8c7b2de18200df59] | committer: Rémi Denis-Courmont

Remove ugly builtin support

I don't this abomination to leak through the stable LibVLC interface.
To link statically, modules should be linked into LibVLC instead.

And then, there is no need to reintroduce the old "builtin" vlc-config
type if all modules are built the same. In prehistoric times, the
distinction was needed because some modules were static and some not.

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

 configure.ac                  |   24 ++++--------------------
 include/vlc/libvlc.h          |   35 -----------------------------------
 modules/common.am             |   10 +++++-----
 src/control/core.c            |   11 ++---------
 src/control/libvlc_internal.h |    2 +-
 src/libvlc.c                  |    4 ++--
 src/libvlc.sym                |    1 -
 src/modules/modules.c         |    8 +-------
 src/modules/modules.h         |    6 +++---
 9 files changed, 18 insertions(+), 83 deletions(-)

diff --git a/configure.ac b/configure.ac
index fa18aec..710b889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,26 +94,6 @@ AS_IF([test -n "${with_binary_version}"],[
          [Binary specific version])
 ])
 
-dnl Check how we are asked to build
-AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
-  AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
-])
-
-AC_ARG_ENABLE(static-modules,
-  [AS_HELP_STRING([--enable-static-modules],
-    [link modules statically - VLC will not work])])
-AS_IF([test "${enable_static_modules}" = yes], [
-   enable_shared="no"
-   enable_static="yes"
-   VLC_DEFAULT_PLUGIN_TYPE="builtin"
-   AS_IF([test "${enable_vlc}" != "no"],
-     [AC_MSG_WARN([Building modules as static. VLC will not work.])])
-], [
-   VLC_DEFAULT_PLUGIN_TYPE="plugin"
-])
-
-AC_SUBST(VLC_DEFAULT_PLUGIN_TYPE)
-
 dnl
 dnl  Check for the contrib directory
 dnl
@@ -444,6 +424,10 @@ m4_defun([AC_DEPLIBS_CHECK_METHOD],[])
 
 lt_cv_deplibs_check_method=pass_all
 
+AS_IF([test "${enable_shared}" = "no"], [
+  AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
+])
+
 dnl
 dnl Gettext stuff
 dnl
diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index 614c3b0..43acdeb 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -135,41 +135,6 @@ const char *libvlc_printerr (const char *fmt, ...);
 VLC_PUBLIC_API libvlc_instance_t *
 libvlc_new( int argc , const char *const *argv );
 
-
-/**
- * \return a static entry point for a module, suitable for passing to
- * libvlc_new_with_builtins. This is to be used when you want to statically
- * link to a module.
- *
- * Note, statically linking to a module will results in nearly zero speed gain
- * and increased memory usage. Use with caution.
- */
-
-#define vlc_plugin(module) & vlc_plugin_entry(module)
-
-#define vlc_plugin_entry(module) vlc_entry__ ## module
-#define vlc_declare_plugin(module) extern void *vlc_plugin_entry(module);
-
-/**
- * Create and initialize a libvlc instance.
- *
- * \param argc the number of arguments
- * \param argv command-line-type arguments
- * \param builtins a NULL terminated array of \see vlc_plugin.
- * \return the libvlc instance or NULL in case of error
- * @begincode
- * {
- *     vlc_declare_plugin(mp4);
- *     vlc_declare_plugin(dummy);
- *     const void **builtins = { vlc_plugin(mp4), vlc_plugin(dummy), NULL };
- *     libvlc_instance_t *vlc = libvlc_new_with_builtins(argc, argv, builtins);
- * }
- * @endcode
- */
-VLC_PUBLIC_API libvlc_instance_t *
-libvlc_new_with_builtins( int argc , const char *const *argv, const void **builtins);
-
-
 /**
  * Decrement the reference count of a libvlc instance, and destroy it
  * if it reaches zero.
diff --git a/modules/common.am b/modules/common.am
index f001a7f..1092b62 100644
--- a/modules/common.am
+++ b/modules/common.am
@@ -13,17 +13,17 @@ CLEANFILES = $(BUILT_SOURCES)
 
 LTLIBVLCCORE = $(top_builddir)/src/libvlccore.la
 
-AM_CFLAGS = `$(VLC_CONFIG) --cflags $(VLC_DEFAULT_PLUGIN_TYPE) $@`
-AM_CXXFLAGS = `$(VLC_CONFIG) --cxxflags $(VLC_DEFAULT_PLUGIN_TYPE) $@`
-AM_OBJCFLAGS = `$(VLC_CONFIG) --objcflags $(VLC_DEFAULT_PLUGIN_TYPE) $@`
+AM_CFLAGS = `$(VLC_CONFIG) --cflags plugin $@`
+AM_CXXFLAGS = `$(VLC_CONFIG) --cxxflags plugin $@`
+AM_OBJCFLAGS = `$(VLC_CONFIG) --objcflags plugin $@`
 AM_LDFLAGS = -rpath '$(libvlcdir)' \
 	-avoid-version -module \
 	-export-symbols-regex ^vlc_entry \
 	-shrext $(LIBEXT) \
 	-rpath "$(libvlcdir)" \
 	-no-undefined \
-	 `$(VLC_CONFIG) --ldflags $(VLC_DEFAULT_PLUGIN_TYPE) $@`
-AM_LIBADD = `$(VLC_CONFIG) -libs $(VLC_DEFAULT_PLUGIN_TYPE) $@` \
+	 `$(VLC_CONFIG) --ldflags plugin $@`
+AM_LIBADD = `$(VLC_CONFIG) -libs plugin $@` \
 	$(LTLIBVLCCORE) $(top_builddir)/compat/libcompat.la
 
 include $(srcdir)/Modules.am
diff --git a/src/control/core.c b/src/control/core.c
index ee80234..dfa0bb5 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -38,8 +38,7 @@
 
 static const char nomemstr[] = "Insufficient memory";
 
-libvlc_instance_t * libvlc_new_with_builtins( int argc, const char *const *argv,
-                                             const void ** builtins_module)
+libvlc_instance_t * libvlc_new( int argc, const char *const *argv )
 {
     libvlc_instance_t *p_new = malloc (sizeof (*p_new));
     if (unlikely(p_new == NULL))
@@ -57,7 +56,7 @@ libvlc_instance_t * libvlc_new_with_builtins( int argc, const char *const *argv,
     if (unlikely (p_libvlc_int == NULL))
         goto error;
 
-    if (libvlc_InternalInit( p_libvlc_int, argc + 1, my_argv, builtins_module ))
+    if (libvlc_InternalInit( p_libvlc_int, argc + 1, my_argv ))
     {
         libvlc_InternalDestroy( p_libvlc_int );
         goto error;
@@ -81,12 +80,6 @@ error:
     return NULL;
 }
 
-libvlc_instance_t * libvlc_new( int argc, const char *const *argv)
-{
-    return libvlc_new_with_builtins(argc, argv, NULL);
-}
-
-
 void libvlc_retain( libvlc_instance_t *p_instance )
 {
     assert( p_instance != NULL );
diff --git a/src/control/libvlc_internal.h b/src/control/libvlc_internal.h
index 935442f..c079f8d 100644
--- a/src/control/libvlc_internal.h
+++ b/src/control/libvlc_internal.h
@@ -44,7 +44,7 @@
  * Internal creation and destruction functions
  ***************************************************************************/
 VLC_EXPORT (libvlc_int_t *, libvlc_InternalCreate, ( void ) );
-VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, const char *ppsz_argv[], const void **builtins_module) );
+VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, const char *ppsz_argv[] ) );
 VLC_EXPORT (void, libvlc_InternalCleanup, ( libvlc_int_t * ) );
 VLC_EXPORT (void, libvlc_InternalDestroy, ( libvlc_int_t * ) );
 
diff --git a/src/libvlc.c b/src/libvlc.c
index c495790..cceb3e6 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -249,7 +249,7 @@ error:
  *  - configuration and commandline parsing
  */
 int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
-                         const char *ppsz_argv[], const void **builtins_module )
+                         const char *ppsz_argv[] )
 {
     libvlc_priv_t *priv = libvlc_priv (p_libvlc);
     char *       p_tmp = NULL;
@@ -410,7 +410,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
      * list of configuration options exported by each module and loads their
      * default values.
      */
-    module_LoadPlugins( p_libvlc, builtins_module );
+    module_LoadPlugins( p_libvlc );
     if( p_libvlc->b_die )
     {
         b_exit = true;
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 4416afa..a95b3ce 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -160,7 +160,6 @@ libvlc_media_set_state
 libvlc_media_set_user_data
 libvlc_media_subitems
 libvlc_new
-libvlc_new_with_builtins
 libvlc_playlist_play
 libvlc_release
 libvlc_retain
diff --git a/src/modules/modules.c b/src/modules/modules.c
index aa758d7..01f3583 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -201,19 +201,13 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
  * \param p_this vlc object structure
  * \return nothing
  */
-void module_LoadPlugins( vlc_object_t * p_this, const void **builtins )
+void module_LoadPlugins( vlc_object_t * p_this )
 {
     module_bank_t *p_bank = p_module_bank;
 
     assert( p_bank );
     /*vlc_assert_locked( &module_lock ); not for static mutexes :( */
 
-    if (builtins)
-    {
-        for (int i = 0; builtins[i]; i++)
-            AllocateBuiltinModule( p_this, builtins[i] );
-    }
-
 #ifdef HAVE_DYNAMIC_PLUGINS
     if( p_bank->i_usage == 1 )
     {
diff --git a/src/modules/modules.h b/src/modules/modules.h
index 90e9f9e..d450409 100644
--- a/src/modules/modules.h
+++ b/src/modules/modules.h
@@ -137,10 +137,10 @@ struct module_t
 module_t *vlc_module_create (vlc_object_t *);
 module_t *vlc_submodule_create (module_t *module);
 
-void  module_InitBank( vlc_object_t *);
+void  module_InitBank( vlc_object_t * );
 #define module_InitBank(a) module_InitBank(VLC_OBJECT(a))
-void module_LoadPlugins( vlc_object_t *, const void ** );
-#define module_LoadPlugins(a, b) module_LoadPlugins(VLC_OBJECT(a), b)
+void module_LoadPlugins( vlc_object_t * );
+#define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
 void module_EndBank( vlc_object_t *, bool );
 #define module_EndBank(a,b) module_EndBank(VLC_OBJECT(a), b)
 



More information about the vlc-commits mailing list