diff --git a/gst/gstplugin.c b/gst/gstplugin.c index c6bd2bb386..addbaca36b 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -102,6 +102,16 @@ gst_plugin_register_func (GstPluginDesc *desc, GstPlugin *plugin, GModule *modul plugin->filename); return NULL; } + GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" initialised", plugin->filename); + + return plugin; +} + +GstPlugin* +gst_plugin_new (const gchar *filename) +{ + GstPlugin *plugin = g_new0 (GstPlugin, 1); + plugin->filename = g_strdup (filename); return plugin; } diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 80dbd9ee2e..98957854b1 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -89,6 +89,8 @@ _gst_plugin_static_init__ ##init (void) \ void _gst_plugin_initialize (void); void _gst_plugin_register_static (GstPluginDesc *desc); +GstPlugin* gst_plugin_new (const gchar *filename); + const gchar* gst_plugin_get_name (GstPlugin *plugin); void gst_plugin_set_name (GstPlugin *plugin, const gchar *name); const gchar* gst_plugin_get_longname (GstPlugin *plugin); diff --git a/gst/gstregistry.c b/gst/gstregistry.c index f8ab4ff046..e2dd0fc36a 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -285,6 +285,37 @@ gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin) registry->plugins = g_list_remove (registry->plugins, plugin); } +static GstPluginFeature* +gst_plugin_list_find_feature (GList *plugins, const gchar *name, GType type) +{ + GstPluginFeature *feature = NULL; + + while (plugins) { + GstPlugin *plugin = (GstPlugin *) (plugins->data); + + feature = gst_plugin_find_feature (plugin, name, type); + if (feature) + return feature; + + plugins = g_list_next (plugins); + } + return feature; +} + +static GstPlugin* +gst_plugin_list_find_plugin (GList *plugins, const gchar *name) +{ + while (plugins) { + GstPlugin *plugin = (GstPlugin *) (plugins->data); + + if (plugin->name && !strcmp (plugin->name, name)) + return plugin; + + plugins = g_list_next (plugins); + } + return NULL; +} + /** * gst_registry_find_plugin: * @registry: the registry to search @@ -297,41 +328,10 @@ gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin) GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name) { - GList *walk; - g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL); g_return_val_if_fail (name != NULL, NULL); - walk = registry->plugins; - - while (walk) { - GstPlugin *plugin = (GstPlugin *) (walk->data); - - if (plugin->name && !strcmp (plugin->name, name)) - return plugin; - - walk = g_list_next (walk); - } - return NULL; -} - -static GstPluginFeature* -gst_plugin_list_find_feature (GList *plugins, const gchar *name, GType type) -{ - GstPluginFeature *feature = NULL; - - g_return_val_if_fail (name != NULL, NULL); - - while (plugins) { - GstPlugin *plugin = (GstPlugin *) (plugins->data); - - feature = gst_plugin_find_feature (plugin, name, type); - if (feature) - return feature; - - plugins = g_list_next (plugins); - } - return feature; + return gst_plugin_list_find_plugin (registry->plugins, name); } /** @@ -572,7 +572,13 @@ GstPlugin* gst_registry_pool_find_plugin (const gchar *name) { GstPlugin *result = NULL; - GList *walk = _gst_registry_pool; + GList *walk; + + result = gst_plugin_list_find_plugin (_gst_registry_pool_plugins, name); + if (result) + return result; + + walk = _gst_registry_pool; while (walk) { GstRegistry *registry = GST_REGISTRY (walk->data); diff --git a/gst/registries/gstxmlregistry.c b/gst/registries/gstxmlregistry.c index 77bf2aee0c..5fd16aa32a 100644 --- a/gst/registries/gstxmlregistry.c +++ b/gst/registries/gstxmlregistry.c @@ -1271,8 +1271,7 @@ gst_xml_registry_rebuild_recurse (GstXMLRegistry *registry, const gchar *directo if ((temp = strstr (directory, ".so")) && (!strcmp (temp, ".so"))) { - GstPlugin *plugin = g_new0 (GstPlugin, 1); - plugin->filename = g_strdup (directory); + GstPlugin *plugin = gst_plugin_new (directory); loaded = gst_plugin_load_plugin (plugin); if (!loaded) {