From c12c39d37c20f51b22b79ace0f2dfc059b57289e Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 24 Mar 2002 20:55:45 +0000 Subject: [PATCH] added plugin_desc structures to libs, which makes their locations cached in the registry. this speeds plugin loading ... Original commit message from CVS: * added plugin_desc structures to libs, which makes their locations cached in the registry. this speeds plugin loading considerably, especially on uninstalled versions. * put the lib path before all others, for speed reasons. * some fixes to adder's caps. * added linefeeds (\n) to GST_DEBUG strings to match GST_INFO behavior. this is more sane. all code will need to be converted. i think some perl can do this. --- gst/gstinfo.c | 4 ++-- gst/gstplugin.c | 17 +++++++++-------- libs/gst/bytestream/bytestream.c | 15 +++++++++++++++ libs/gst/control/control.c | 15 +++++++++++++++ libs/gst/getbits/getbits.c | 15 +++++++++++++++ libs/gst/putbits/putbits.c | 16 ++++++++++++++++ 6 files changed, 72 insertions(+), 10 deletions(-) diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 148c94a988..c50e41b676 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -207,11 +207,11 @@ gst_default_debug_handler (gint category, gboolean incore, #ifdef GST_DEBUG_COLOR fprintf(stderr,"DEBUG(\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033[" - "%s;%sm%s%s\033[00m %s", + "%s;%sm%s%s\033[00m %s\n", pthread_color,pthread_id,cothread_color,cothread_id,incore?"00":"01", _gst_category_colors[category],location,elementname,string); #else - fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s", + fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s\n", pthread_id,cothread_id,location,elementname,string); #endif /* GST_DEBUG_COLOR */ diff --git a/gst/gstplugin.c b/gst/gstplugin.c index a5614ed18a..6d5c59a704 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -71,9 +71,6 @@ _gst_plugin_initialize (void) gst_plugin_register_statics (main_module); #ifdef PLUGINS_USE_BUILDDIR - /* the library directory */ - gst_plugin_default_paths = g_list_prepend (gst_plugin_default_paths, - PLUGINS_BUILDDIR "/libs/gst"); /* location libgstelements.so */ gst_plugin_default_paths = g_list_prepend (gst_plugin_default_paths, PLUGINS_BUILDDIR "/gst/elements"); @@ -103,6 +100,10 @@ _gst_plugin_initialize (void) if (_gst_warn_old_registry) g_warning ("gstplugin: registry needs rebuild: run gst-register\n"); _gst_plugin_paths = g_list_concat (_gst_plugin_paths, gst_plugin_default_paths); +#ifdef PLUGINS_USE_BUILDDIR + /* we prepend the lib dir first for performance reasons */ + _gst_plugin_paths = g_list_prepend (_gst_plugin_paths, PLUGINS_BUILDDIR "/libs/gst"); +#endif gst_plugin_load_all (); /* gst_plugin_unload_all (); */ return; @@ -277,7 +278,7 @@ gst_plugin_load_all (void) path = _gst_plugin_paths; while (path != NULL) { - GST_INFO (GST_CAT_PLUGIN_LOADING,"loading plugins from %s",(gchar *)path->data); + GST_DEBUG (GST_CAT_PLUGIN_LOADING,"loading plugins from %s",(gchar *)path->data); gst_plugin_load_recurse(path->data,NULL); path = g_list_next(path); } @@ -422,7 +423,7 @@ gst_plugin_load_absolute (const gchar *filename) g_return_val_if_fail (filename != NULL, FALSE); - GST_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" absolute loading", filename); + GST_DEBUG (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" absolute loading", filename); while (plugins) { GstPlugin *testplugin = (GstPlugin *)plugins->data; @@ -501,10 +502,10 @@ gst_plugin_load_plugin (GstPlugin *plugin) filename = plugin->filename; - GST_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loading", filename); + GST_DEBUG (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loading", filename); if (g_module_supported () == FALSE) { - g_warning("gstplugin: wow, you built this on a platform without dynamic loading???\n"); + g_warning ("gstplugin: wow, you built this on a platform without dynamic loading???\n"); return FALSE; } @@ -517,7 +518,7 @@ gst_plugin_load_plugin (GstPlugin *plugin) if (module != NULL) { if (g_module_symbol (module, "plugin_desc", (gpointer *)&desc)) { - GST_INFO (GST_CAT_PLUGIN_LOADING,"loading plugin \"%s\"...", filename); + GST_DEBUG (GST_CAT_PLUGIN_LOADING,"loading plugin \"%s\"...", filename); plugin->filename = g_strdup (filename); plugin = gst_plugin_register_func (desc, plugin, module); diff --git a/libs/gst/bytestream/bytestream.c b/libs/gst/bytestream/bytestream.c index 8ab81ffa6c..370d220a1a 100644 --- a/libs/gst/bytestream/bytestream.c +++ b/libs/gst/bytestream/bytestream.c @@ -473,3 +473,18 @@ gst_bytestream_print_status (GstByteStream * bs) bs_print ("STATUS: buffer starts at %d and is %d bytes long\n", GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf)); } } + + +static gboolean +plugin_init (GModule *module, GstPlugin *plugin) +{ + gst_plugin_set_longname (plugin, "GstByteStream: a byte-oriented layer on top of buffer-passing"); + return TRUE; +} + +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstbytestream", + plugin_init +}; diff --git a/libs/gst/control/control.c b/libs/gst/control/control.c index 30c9b818b9..58ada45d55 100644 --- a/libs/gst/control/control.c +++ b/libs/gst/control/control.c @@ -19,9 +19,24 @@ * Boston, MA 02111-1307, USA. */ +#include #include void gst_control_init (int *argc, char **argv[]) { _gst_dpman_initialize (); } + +static gboolean +plugin_init (GModule *module, GstPlugin *plugin) +{ + gst_plugin_set_longname (plugin, "Dynamic Parameters"); + return TRUE; +} + +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstcontrol", + plugin_init +}; diff --git a/libs/gst/getbits/getbits.c b/libs/gst/getbits/getbits.c index 1985a4fdd2..7ac83a5a9d 100644 --- a/libs/gst/getbits/getbits.c +++ b/libs/gst/getbits/getbits.c @@ -211,3 +211,18 @@ void gst_getbits_newbuf(gst_getbits_t *gb,unsigned char *buffer, unsigned long l /* gb->qword = 0; */ #endif /* HAVE_LIBMMX */ } + + +static gboolean +plugin_init (GModule *module, GstPlugin *plugin) +{ + gst_plugin_set_longname (plugin, "Accelerated routines for getting bits from a data stream"); + return TRUE; +} + +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstgetbits", + plugin_init +}; diff --git a/libs/gst/putbits/putbits.c b/libs/gst/putbits/putbits.c index e14f3aa05a..5ecb0a1fe9 100644 --- a/libs/gst/putbits/putbits.c +++ b/libs/gst/putbits/putbits.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include /* initialize buffer, call once before first putbits or alignbits */ void gst_putbits_init(gst_putbits_t *pb) @@ -99,3 +101,17 @@ int gst_putbits_bitcount(gst_putbits_t *pb) { return 8*pb->bytecnt + (8-pb->outcnt); } + +static gboolean +plugin_init (GModule *module, GstPlugin *plugin) +{ + gst_plugin_set_longname (plugin, "Accelerated routines for putting bits into a data stream"); + return TRUE; +} + +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstputbits", + plugin_init +};