mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
debug: Instantiate GType when dumping debug categories.
A lot of debug categories are declared in element class_init functions, which don't get run until the element is first created (not just registered in the plugin load function). This means that --gst-debug-help doesn't print out a lot of categories. Creating an instance of each element from the element factory makes them visible, at some extra cost - 2-3 times longer, which can be a full second or two of extra waiting. Yikes! https://bugzilla.gnome.org/show_bug.cgi?id=741001
This commit is contained in:
parent
5e43ee5989
commit
fe3180dcca
1 changed files with 33 additions and 0 deletions
33
gst/gst.c
33
gst/gst.c
|
@ -763,8 +763,41 @@ gst_debug_help (void)
|
|||
/* FIXME this is gross. why don't debug have categories PluginFeatures? */
|
||||
for (g = list2; g; g = g_list_next (g)) {
|
||||
GstPlugin *plugin = GST_PLUGIN_CAST (g->data);
|
||||
GList *features, *orig_features;
|
||||
|
||||
if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED))
|
||||
continue;
|
||||
|
||||
gst_plugin_load (plugin);
|
||||
/* Now create one of each feature so the class_init functions
|
||||
* are called, as that's where most debug categories are
|
||||
* registered. FIXME: If debug categories were a plugin feature,
|
||||
* this would be unneeded */
|
||||
orig_features = features =
|
||||
gst_registry_get_feature_list_by_plugin (gst_registry_get (),
|
||||
gst_plugin_get_name (plugin));
|
||||
while (features) {
|
||||
GstPluginFeature *feature;
|
||||
|
||||
if (G_UNLIKELY (features->data == NULL))
|
||||
goto next;
|
||||
|
||||
feature = GST_PLUGIN_FEATURE (features->data);
|
||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
||||
GstElementFactory *factory;
|
||||
GstElement *e;
|
||||
|
||||
factory = GST_ELEMENT_FACTORY (feature);
|
||||
e = gst_element_factory_create (factory, NULL);
|
||||
if (e)
|
||||
gst_object_unref (e);
|
||||
}
|
||||
|
||||
next:
|
||||
features = g_list_next (features);
|
||||
}
|
||||
|
||||
gst_plugin_feature_list_free (orig_features);
|
||||
}
|
||||
g_list_free (list2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue