mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
gst/: only write out registry if it has changed, fixes #338339
Original commit message from CVS: * gst/gst.c: * gst/gstregistry.c: (gst_registry_scan_path_level), (gst_registry_scan_path): * gst/gstregistry.h: only write out registry if it has changed, fixes #338339
This commit is contained in:
parent
1785b80792
commit
13c4169d9d
4 changed files with 34 additions and 14 deletions
|
@ -29,7 +29,8 @@
|
|||
* libs/gst/base/gstbasesink.c: (gst_base_sink_event):
|
||||
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_base_init),
|
||||
(gst_collect_pads_is_collected), (gst_collect_pads_event):
|
||||
more detailed debug and formatting cleanup
|
||||
more detailed debug and formatting cleanup,
|
||||
forward newsegments to src-pad (so that e.g. adder not eats them)
|
||||
|
||||
2006-04-28 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
|
|
14
gst/gst.c
14
gst/gst.c
|
@ -602,6 +602,7 @@ init_post (void)
|
|||
char *registry_file;
|
||||
const char *plugin_path;
|
||||
GstRegistry *default_registry;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
default_registry = gst_registry_get_default ();
|
||||
registry_file = g_strdup (g_getenv ("GST_REGISTRY"));
|
||||
|
@ -622,7 +623,7 @@ init_post (void)
|
|||
GST_DEBUG ("GST_PLUGIN_PATH set to %s", plugin_path);
|
||||
list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||
for (i = 0; list[i]; i++) {
|
||||
gst_registry_scan_path (default_registry, list[i]);
|
||||
changed |= gst_registry_scan_path (default_registry, list[i]);
|
||||
}
|
||||
g_strfreev (list);
|
||||
} else {
|
||||
|
@ -642,11 +643,11 @@ init_post (void)
|
|||
* system-installed ones */
|
||||
home_plugins = g_build_filename (g_get_home_dir (),
|
||||
".gstreamer-" GST_MAJORMINOR, "plugins", NULL);
|
||||
gst_registry_scan_path (default_registry, home_plugins);
|
||||
changed |= gst_registry_scan_path (default_registry, home_plugins);
|
||||
g_free (home_plugins);
|
||||
|
||||
/* add the main (installed) library path */
|
||||
gst_registry_scan_path (default_registry, PLUGINDIR);
|
||||
changed |= gst_registry_scan_path (default_registry, PLUGINDIR);
|
||||
} else {
|
||||
char **list;
|
||||
int i;
|
||||
|
@ -654,12 +655,15 @@ init_post (void)
|
|||
GST_DEBUG ("GST_PLUGIN_SYSTEM_PATH set to %s", plugin_path);
|
||||
list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||
for (i = 0; list[i]; i++) {
|
||||
gst_registry_scan_path (default_registry, list[i]);
|
||||
changed |= gst_registry_scan_path (default_registry, list[i]);
|
||||
}
|
||||
g_strfreev (list);
|
||||
}
|
||||
|
||||
gst_registry_xml_write_cache (default_registry, registry_file);
|
||||
if (changed) {
|
||||
GST_DEBUG ("writing registry cache");
|
||||
gst_registry_xml_write_cache (default_registry, registry_file);
|
||||
}
|
||||
|
||||
_gst_registry_remove_cache_plugins (default_registry);
|
||||
|
||||
|
|
|
@ -736,7 +736,7 @@ gst_registry_lookup (GstRegistry * registry, const char *filename)
|
|||
return plugin;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
||||
int level)
|
||||
{
|
||||
|
@ -745,10 +745,11 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|||
gchar *filename;
|
||||
GstPlugin *plugin;
|
||||
GstPlugin *newplugin;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
dir = g_dir_open (path, 0, NULL);
|
||||
if (!dir)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
while ((dirent = g_dir_read_name (dir))) {
|
||||
filename = g_strjoin ("/", path, dirent, NULL);
|
||||
|
@ -758,7 +759,7 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|||
if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
|
||||
if (level > 0) {
|
||||
GST_LOG_OBJECT (registry, "found directory, recursing");
|
||||
gst_registry_scan_path_level (registry, filename, level - 1);
|
||||
changed |= gst_registry_scan_path_level (registry, filename, level - 1);
|
||||
} else {
|
||||
GST_LOG_OBJECT (registry,
|
||||
"found directory, but recursion level is too deep");
|
||||
|
@ -819,6 +820,7 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|||
newplugin->registered = TRUE;
|
||||
gst_object_unref (newplugin);
|
||||
}
|
||||
changed = TRUE;
|
||||
}
|
||||
gst_object_unref (plugin);
|
||||
|
||||
|
@ -828,6 +830,7 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|||
if (newplugin) {
|
||||
newplugin->registered = TRUE;
|
||||
gst_object_unref (newplugin);
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -835,6 +838,10 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|||
}
|
||||
|
||||
g_dir_close (dir);
|
||||
|
||||
GST_DEBUG_OBJECT (registry, "registry changed? %d", changed);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -845,15 +852,23 @@ gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|||
* Add the given path to the registry. The syntax of the
|
||||
* path is specific to the registry. If the path has already been
|
||||
* added, do nothing.
|
||||
*
|
||||
* Returns: %TRUE if registry changed
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
gst_registry_scan_path (GstRegistry * registry, const gchar * path)
|
||||
{
|
||||
g_return_if_fail (GST_IS_REGISTRY (registry));
|
||||
g_return_if_fail (path != NULL);
|
||||
gboolean changed;
|
||||
|
||||
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
GST_DEBUG_OBJECT (registry, "scanning path %s", path);
|
||||
gst_registry_scan_path_level (registry, path, 10);
|
||||
changed = gst_registry_scan_path_level (registry, path, 10);
|
||||
|
||||
GST_DEBUG_OBJECT (registry, "registry changed? %d", changed);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -78,7 +78,7 @@ GType gst_registry_get_type (void);
|
|||
|
||||
GstRegistry * gst_registry_get_default (void);
|
||||
|
||||
void gst_registry_scan_path (GstRegistry *registry, const gchar *path);
|
||||
gboolean gst_registry_scan_path (GstRegistry *registry, const gchar *path);
|
||||
GList* gst_registry_get_path_list (GstRegistry *registry);
|
||||
|
||||
gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin);
|
||||
|
|
Loading…
Reference in a new issue