The feature name is not supposed to change over time anyway. In order to enforce
this parentize features to the registry and make the feature->name pointing to
GstObject:name. In 0.11 we could consider of removing the feature->name variable
(FIXME comment added).
Fixes: #459466
GST_DEBUG ("finalizing feature %p: '%s'", feature,
GST_PLUGIN_FEATURE_NAME (feature));
- g_free (feature->name);
if (feature->plugin != NULL) {
g_object_remove_weak_pointer ((GObject *) feature->plugin,
* Normally this function is used like this:
* |[
* GstPluginFeature *loaded_feature;
- *
+ *
* loaded_feature = gst_plugin_feature_load (feature);
* // presumably, we're no longer interested in the potentially-unloaded feature
* gst_object_unref (feature);
g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
g_return_if_fail (name != NULL);
- if (feature->name) {
+ if (G_UNLIKELY (feature->name)) {
g_return_if_fail (strcmp (feature->name, name) == 0);
} else {
- feature->name = g_strdup (name);
+ gst_object_set_name (GST_OBJECT (feature), name);
+ feature->name = GST_OBJECT_NAME (GST_OBJECT (feature));
}
- gst_object_set_name (GST_OBJECT_CAST (feature), feature->name);
}
/**
/*< private >*/
gboolean loaded;
- gchar *name;
+ gchar *name; /* FIXME-0.11: remove variable, we use GstObject:name */
guint rank;
const gchar *plugin_name;
* means of doing so is to load every plugin and look at the resulting
* information that is gathered in the default registry. Clearly, this is a time
* consuming process, so we cache information in the registry file. The format
- * and location of the cache file is internal to gstreamer.
+ * and location of the cache file is internal to gstreamer.
*
* On startup, plugins are searched for in the plugin search path. The following
* locations are checked in this order:
if (feature) {
GST_LOG_OBJECT (registry, "removing feature %p (%s)",
feature, gst_plugin_feature_get_name (feature));
- gst_object_unref (feature);
+ gst_object_unparent (GST_OBJECT_CAST (feature));
}
f = g_list_next (f);
}
registry->features = g_list_delete_link (registry->features, f);
g_hash_table_remove (registry->feature_hash, feature->name);
- gst_object_unref (feature);
+ gst_object_unparent (GST_OBJECT_CAST (feature));
}
f = next;
}
if (G_UNLIKELY (existing_feature)) {
/* We unref now. No need to remove the feature name from the hash table, it
* got replaced by the new feature */
- gst_object_unref (existing_feature);
+ gst_object_unparent (GST_OBJECT_CAST (existing_feature));
}
- gst_object_ref_sink (feature);
+ gst_object_set_parent (GST_OBJECT_CAST (feature), GST_OBJECT_CAST (registry));
registry->priv->cookie++;
GST_OBJECT_UNLOCK (registry);
g_hash_table_remove (registry->feature_hash, feature->name);
registry->priv->cookie++;
GST_OBJECT_UNLOCK (registry);
- gst_object_unref (feature);
+
+ gst_object_unparent ((GstObject *) feature);
}
/**
GstRegistryChunkPluginFeature *pf = NULL;
GstPluginFeature *feature = NULL;
const gchar *const_str, *type_name;
+ const gchar *feature_name;
const gchar *plugin_name;
- gchar *str, *feature_name;
+ gchar *str;
GType type;
guint i;
}
/* unpack more plugin feature strings */
- unpack_string (*in, feature_name, end, fail);
+ unpack_string_nocopy (*in, feature_name, end, fail);
GST_DEBUG ("Plugin '%s' feature '%s' typename : '%s'", plugin_name,
feature_name, type_name);
if (G_UNLIKELY (!(type = g_type_from_name (type_name)))) {
GST_ERROR ("Unknown type from typename '%s' for plugin '%s'", type_name,
plugin_name);
- g_free (feature_name);
return FALSE;
}
if (G_UNLIKELY ((feature = g_object_newv (type, 0, NULL)) == NULL)) {
GST_ERROR ("Can't create feature from type");
- g_free (feature_name);
return FALSE;
}
-
- feature->name = feature_name;
+ gst_plugin_feature_set_name (feature, feature_name);
if (G_UNLIKELY (!GST_IS_PLUGIN_FEATURE (feature))) {
GST_ERROR ("typename : '%s' is not a plugin feature", type_name);