mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
gst/: Only ever load one plugin for a given plugin basename.
Original commit message from CVS: * 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.
This commit is contained in:
parent
5d5dbe9bc0
commit
871217319a
5 changed files with 35 additions and 3 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
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>
|
2005-10-08 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
|
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
|
||||||
|
|
|
@ -130,6 +130,7 @@ gst_plugin_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_free (plugin->filename);
|
g_free (plugin->filename);
|
||||||
|
g_free (plugin->basename);
|
||||||
gst_plugin_desc_free (&plugin->desc);
|
gst_plugin_desc_free (&plugin->desc);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
@ -413,6 +414,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
||||||
|
|
||||||
plugin->module = module;
|
plugin->module = module;
|
||||||
plugin->filename = strdup (filename);
|
plugin->filename = strdup (filename);
|
||||||
|
plugin->basename = g_path_get_basename (filename);
|
||||||
plugin->file_mtime = file_status.st_mtime;
|
plugin->file_mtime = file_status.st_mtime;
|
||||||
plugin->file_size = file_status.st_size;
|
plugin->file_size = file_status.st_size;
|
||||||
|
|
||||||
|
|
|
@ -142,11 +142,14 @@ struct _GstPlugin {
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
gchar * filename;
|
gchar * filename;
|
||||||
|
gchar * basename; /* base name (non-dir part) of plugin path */
|
||||||
|
|
||||||
GModule * module; /* contains the module if plugin is loaded */
|
GModule * module; /* contains the module if plugin is loaded */
|
||||||
|
|
||||||
size_t file_size;
|
size_t file_size;
|
||||||
time_t file_mtime;
|
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];
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
|
@ -603,17 +603,21 @@ gst_registry_lookup_locked (GstRegistry * registry, const char *filename)
|
||||||
{
|
{
|
||||||
GList *g;
|
GList *g;
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin;
|
||||||
|
gchar *basename;
|
||||||
|
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
basename = g_path_get_basename (filename);
|
||||||
for (g = registry->plugins; g; g = g_list_next (g)) {
|
for (g = registry->plugins; g; g = g_list_next (g)) {
|
||||||
plugin = GST_PLUGIN (g->data);
|
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;
|
return plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (basename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,6 +689,8 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
||||||
continue;
|
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);
|
plugin = gst_registry_lookup (registry, filename);
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
struct stat file_status;
|
struct stat file_status;
|
||||||
|
@ -694,7 +700,12 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
continue;
|
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 &&
|
if (plugin->file_mtime == file_status.st_mtime &&
|
||||||
plugin->file_size == file_status.st_size) {
|
plugin->file_size == file_status.st_size) {
|
||||||
GST_DEBUG_OBJECT (registry, "file %s cached", filename);
|
GST_DEBUG_OBJECT (registry, "file %s cached", filename);
|
||||||
|
@ -713,9 +724,12 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
||||||
gst_object_unref (plugin);
|
gst_object_unref (plugin);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
GST_DEBUG_OBJECT (registry, "file %s not yet in registry", filename);
|
||||||
newplugin = gst_plugin_load_file (filename, NULL);
|
newplugin = gst_plugin_load_file (filename, NULL);
|
||||||
if (newplugin)
|
if (newplugin) {
|
||||||
|
newplugin->registered = TRUE;
|
||||||
gst_object_unref (newplugin);
|
gst_object_unref (newplugin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
|
|
@ -654,6 +654,7 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list)
|
||||||
if (!read_string (reader, &plugin->filename))
|
if (!read_string (reader, &plugin->filename))
|
||||||
break;
|
break;
|
||||||
GST_DEBUG ("filename %s", plugin->filename);
|
GST_DEBUG ("filename %s", plugin->filename);
|
||||||
|
plugin->basename = g_path_get_basename (plugin->filename);
|
||||||
} else if (g_str_equal (tag, "version")) {
|
} else if (g_str_equal (tag, "version")) {
|
||||||
if (!read_string (reader, &plugin->desc.version))
|
if (!read_string (reader, &plugin->desc.version))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue