+2005-10-08 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_load_file):
+ * gst/gstplugin.h:
+ * gst/gstregistry.c: (gst_registry_lookup_locked),
+ (gst_registry_scan_path_level):
+ * gst/gstregistryxml.c: (load_plugin):
+ Only ever load one plugin for a given plugin basename.
+ This ensures correct overriding of GST_PLUGIN_PATH over
+ GST_PLUGIN_SYSTEM_PATH and of home dir plugins over
+ system installed plugins.
+
2005-10-08 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
}
}
g_free (plugin->filename);
+ g_free (plugin->basename);
gst_plugin_desc_free (&plugin->desc);
G_OBJECT_CLASS (parent_class)->finalize (object);
plugin->module = module;
plugin->filename = strdup (filename);
+ plugin->basename = g_path_get_basename (filename);
plugin->file_mtime = file_status.st_mtime;
plugin->file_size = file_status.st_size;
unsigned int flags;
gchar * filename;
+ gchar * basename; /* base name (non-dir part) of plugin path */
GModule * module; /* contains the module if plugin is loaded */
size_t file_size;
time_t file_mtime;
+ gboolean registered; /* TRUE when the registry has seen a filename
+ * that matches the plugin's basename */
gpointer _gst_reserved[GST_PADDING];
};
{
GList *g;
GstPlugin *plugin;
+ gchar *basename;
if (filename == NULL)
return NULL;
+ basename = g_path_get_basename (filename);
for (g = registry->plugins; g; g = g_list_next (g)) {
plugin = GST_PLUGIN (g->data);
- if (plugin->filename && strcmp (filename, plugin->filename) == 0) {
+ if (plugin->basename && strcmp (basename, plugin->basename) == 0) {
+ g_free (basename);
return plugin;
}
}
+ g_free (basename);
return NULL;
}
continue;
}
+ /* plug-ins are considered unique by basename; if the given name
+ * was already seen by the registry, we ignore it */
plugin = gst_registry_lookup (registry, filename);
if (plugin) {
struct stat file_status;
g_free (filename);
continue;
}
-
+ if (plugin->registered) {
+ GST_DEBUG_OBJECT (registry, "plugin already registered from path %s",
+ plugin->filename);
+ continue;
+ }
+ plugin->registered = TRUE;
if (plugin->file_mtime == file_status.st_mtime &&
plugin->file_size == file_status.st_size) {
GST_DEBUG_OBJECT (registry, "file %s cached", filename);
gst_object_unref (plugin);
} else {
+ GST_DEBUG_OBJECT (registry, "file %s not yet in registry", filename);
newplugin = gst_plugin_load_file (filename, NULL);
- if (newplugin)
+ if (newplugin) {
+ newplugin->registered = TRUE;
gst_object_unref (newplugin);
+ }
}
g_free (filename);
if (!read_string (reader, &plugin->filename))
break;
GST_DEBUG ("filename %s", plugin->filename);
+ plugin->basename = g_path_get_basename (plugin->filename);
} else if (g_str_equal (tag, "version")) {
if (!read_string (reader, &plugin->desc.version))
break;