Remove the name property from the plugin feature and port code to use the object
name instead.
if (name)
GST_INFO ("creating element \"%s\" named \"%s\"",
- GST_PLUGIN_FEATURE_NAME (factory), GST_STR_NULL (name));
+ GST_OBJECT_NAME (factory), GST_STR_NULL (name));
else
- GST_INFO ("creating element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory));
+ GST_INFO ("creating element \"%s\"", GST_OBJECT_NAME (factory));
if (factory->type == 0)
goto no_type;
(gpointer) & oclass->elementfactory, NULL, factory))
gst_object_unref (factory);
- GST_DEBUG ("created element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory));
+ GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory));
return element;
GstIndexFactory *factory;
g_return_val_if_fail (name != NULL, NULL);
- factory = GST_INDEX_FACTORY (g_object_newv (GST_TYPE_INDEX_FACTORY, 0, NULL));
- GST_PLUGIN_FEATURE_NAME (factory) = g_strdup (name);
+ factory =
+ GST_INDEX_FACTORY (g_object_new (GST_TYPE_INDEX_FACTORY, "name", name,
+ NULL));
+
if (factory->longdesc)
g_free (factory->longdesc);
factory->longdesc = g_strdup (longdesc);
{
GstPluginFeature *feature = GST_PLUGIN_FEATURE_CAST (object);
- GST_DEBUG ("finalizing feature %p: '%s'", feature,
- GST_PLUGIN_FEATURE_NAME (feature));
+ GST_DEBUG ("finalizing feature %p: '%s'", feature, GST_OBJECT_NAME (feature));
if (feature->plugin != NULL) {
g_object_remove_weak_pointer ((GObject *) feature->plugin,
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
GST_DEBUG ("loading plugin for feature %p; '%s'", feature,
- GST_PLUGIN_FEATURE_NAME (feature));
+ GST_OBJECT_NAME (feature));
if (feature->loaded)
return gst_object_ref (feature);
gst_object_unref (plugin);
real_feature =
- gst_registry_lookup_feature (gst_registry_get_default (), feature->name);
+ gst_registry_lookup_feature (gst_registry_get_default (),
+ GST_OBJECT_NAME (feature));
if (real_feature == NULL)
goto disappeared;
load_failed:
{
GST_WARNING ("Failed to load plugin containing feature '%s'.",
- GST_PLUGIN_FEATURE_NAME (feature));
+ GST_OBJECT_NAME (feature));
return NULL;
}
disappeared:
{
GST_INFO
("Loaded plugin containing feature '%s', but feature disappeared.",
- feature->name);
+ GST_OBJECT_NAME (feature));
return NULL;
}
not_found:
{
GST_INFO ("Tried to load plugin containing feature '%s', but feature was "
- "not found.", real_feature->name);
+ "not found.", GST_OBJECT_NAME (real_feature));
return NULL;
}
}
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
return ((data->type == 0 || data->type == G_OBJECT_TYPE (feature)) &&
- (data->name == NULL
- || !strcmp (data->name, GST_PLUGIN_FEATURE_NAME (feature))));
-}
-
-/**
- * gst_plugin_feature_set_name:
- * @feature: a feature
- * @name: the name to set
- *
- * Sets the name of a plugin feature. The name uniquely identifies a feature
- * within all features of the same type. Renaming a plugin feature is not
- * allowed. A copy is made of the name so you should free the supplied @name
- * after calling this function.
- */
-void
-gst_plugin_feature_set_name (GstPluginFeature * feature, const gchar * name)
-{
- g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
- g_return_if_fail (name != NULL);
-
- if (G_UNLIKELY (feature->name)) {
- g_return_if_fail (strcmp (feature->name, name) == 0);
- } else {
- gst_object_set_name (GST_OBJECT (feature), name);
- feature->name = GST_OBJECT_NAME (GST_OBJECT (feature));
- }
-}
-
-/**
- * gst_plugin_feature_get_name:
- * @feature: a feature
- *
- * Gets the name of a plugin feature.
- *
- * Returns: the name
- */
-G_CONST_RETURN gchar *
-gst_plugin_feature_get_name (GstPluginFeature * feature)
-{
- g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), NULL);
-
- return feature->name;
+ (data->name == NULL || !strcmp (data->name, GST_OBJECT_NAME (feature))));
}
/**
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
GST_DEBUG ("Looking up plugin '%s' containing plugin feature '%s'",
- feature->plugin_name, feature->name);
+ feature->plugin_name, GST_OBJECT_NAME (feature));
registry = gst_registry_get_default ();
plugin = gst_registry_find_plugin (registry, feature->plugin_name);
if (diff != 0)
return diff;
- diff = strcmp (f2->name, f1->name);
+ diff = strcmp (GST_OBJECT_NAME (f2), GST_OBJECT_NAME (f1));
return diff;
}
#define GST_PLUGIN_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass))
#define GST_PLUGIN_FEATURE_CAST(obj) ((GstPluginFeature*)(obj))
-/**
- * GST_PLUGIN_FEATURE_NAME:
- * @feature: The feature to query
- *
- * Get the name of the feature
- */
-#define GST_PLUGIN_FEATURE_NAME(feature) (GST_PLUGIN_FEATURE (feature)->name)
-
typedef struct _GstPluginFeature GstPluginFeature;
typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
} GstRank;
/**
+ * gst_plugin_feature_get_name:
+ * @feature: a #GstPluginFeature to get the name of @feature.
+ *
+ * Returns a copy of the name of @feature.
+ * Caller should g_free() the return value after usage.
+ * For a nameless plugin feature, this returns NULL, which you can safely g_free()
+ * as well.
+ *
+ * Returns: (transfer full): the name of @feature. g_free() after usage. MT safe.
+ *
+ */
+#define gst_plugin_feature_get_name(feature) gst_object_get_name(GST_OBJECT_CAST(feature))
+
+/**
+ * gst_plugin_feature_set_name:
+ * @feature: a #GstPluginFeature to set the name of.
+ * @name: the new name
+ *
+ * Sets the name of the plugin feature, getting rid of the old name if there was one.
+ */
+#define gst_plugin_feature_set_name(feature,name) gst_object_set_name(GST_OBJECT_CAST(feature),name)
+
+/**
* GstPluginFeature:
*
* Opaque #GstPluginFeature structure.
/*< private >*/
gboolean loaded;
- gchar *name; /* FIXME-0.11: remove variable, we use GstObject:name */
guint rank;
const gchar *plugin_name;
GstTypeNameData *data);
void gst_plugin_feature_set_rank (GstPluginFeature *feature, guint rank);
-void gst_plugin_feature_set_name (GstPluginFeature *feature, const gchar *name);
guint gst_plugin_feature_get_rank (GstPluginFeature *feature);
-G_CONST_RETURN gchar *gst_plugin_feature_get_name (GstPluginFeature *feature);
void gst_plugin_feature_list_free (GList *list);
GList *gst_plugin_feature_list_copy (GList *list);
plugin->desc.name);
registry->features = g_list_delete_link (registry->features, f);
- g_hash_table_remove (registry->feature_hash, feature->name);
+ g_hash_table_remove (registry->feature_hash, GST_OBJECT_NAME (feature));
gst_object_unparent (GST_OBJECT_CAST (feature));
}
f = next;
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
- g_return_val_if_fail (feature->name != NULL, FALSE);
+ g_return_val_if_fail (GST_OBJECT_NAME (feature) != NULL, FALSE);
g_return_val_if_fail (feature->plugin_name != NULL, FALSE);
GST_OBJECT_LOCK (registry);
existing_feature = gst_registry_lookup_feature_locked (registry,
- feature->name);
+ GST_OBJECT_NAME (feature));
if (G_UNLIKELY (existing_feature)) {
GST_DEBUG_OBJECT (registry, "replacing existing feature %p (%s)",
- existing_feature, feature->name);
+ existing_feature, GST_OBJECT_NAME (feature));
/* Remove the existing feature from the list now, before we insert the new
* one, but don't unref yet because the hash is still storing a reference to
* it. */
registry->features = g_list_remove (registry->features, existing_feature);
}
- GST_DEBUG_OBJECT (registry, "adding feature %p (%s)", feature, feature->name);
+ GST_DEBUG_OBJECT (registry, "adding feature %p (%s)", feature,
+ GST_OBJECT_NAME (feature));
registry->features = g_list_prepend (registry->features, feature);
- g_hash_table_replace (registry->feature_hash, feature->name, feature);
+ g_hash_table_replace (registry->feature_hash, GST_OBJECT_NAME (feature),
+ feature);
if (G_UNLIKELY (existing_feature)) {
/* We unref now. No need to remove the feature name from the hash table, it
registry->priv->cookie++;
GST_OBJECT_UNLOCK (registry);
- GST_LOG_OBJECT (registry, "emitting feature-added for %s", feature->name);
+ GST_LOG_OBJECT (registry, "emitting feature-added for %s",
+ GST_OBJECT_NAME (feature));
g_signal_emit (registry, gst_registry_signals[FEATURE_ADDED], 0, feature);
return TRUE;
GST_OBJECT_LOCK (registry);
registry->features = g_list_remove (registry->features, feature);
- g_hash_table_remove (registry->feature_hash, feature->name);
+ g_hash_table_remove (registry->feature_hash, GST_OBJECT_NAME (feature));
registry->priv->cookie++;
GST_OBJECT_UNLOCK (registry);
/* to make the order in which things happen more deterministic,
* sort by name when the ranks are the same. */
- return strcmp (fac1->name, fac2->name);
+ return strcmp (GST_OBJECT_NAME (fac1), GST_OBJECT_NAME (fac2));
}
static GList *
gst_registry_chunks_save_const_string (list, (gchar *) walk->data);
}
GST_DEBUG ("Feature %s: saved %d interfaces %d pad templates",
- feature->name, ef->ninterfaces, ef->npadtemplates);
+ GST_OBJECT_NAME (feature), ef->ninterfaces, ef->npadtemplates);
/* save uritypes */
if (GST_URI_TYPE_IS_VALID (factory->uri_type)) {
GST_DEBUG ("Saved %d UriTypes", ef->nuriprotocols);
} else {
g_warning ("GStreamer feature '%s' is URI handler but does not provide"
- " any protocols it can handle", feature->name);
+ " any protocols it can handle", GST_OBJECT_NAME (feature));
}
}
*list = g_list_prepend (*list, chk);
/* pack plugin feature strings */
- gst_registry_chunks_save_const_string (list, feature->name);
+ gst_registry_chunks_save_const_string (list, GST_OBJECT_NAME (feature));
gst_registry_chunks_save_const_string (list, (gchar *) type_name);
return TRUE;
(gpointer *) & feature->plugin);
gst_registry_add_feature (registry, feature);
- GST_DEBUG ("Added feature %s, plugin %p %s", feature->name, plugin,
- plugin_name);
+ GST_DEBUG ("Added feature %s, plugin %p %s", GST_OBJECT_NAME (feature),
+ plugin, plugin_name);
return TRUE;
helper = (GstTypeFindHelper *) data;
GST_LOG_OBJECT (helper->obj, "'%s' called peek (%" G_GINT64_FORMAT
- ", %u)", GST_PLUGIN_FEATURE_NAME (helper->factory), offset, size);
+ ", %u)", GST_OBJECT_NAME (helper->factory), offset, size);
if (size == 0)
return NULL;
GST_LOG_OBJECT (helper->obj,
"'%s' called called suggest (%u, %" GST_PTR_FORMAT ")",
- GST_PLUGIN_FEATURE_NAME (helper->factory), probability, caps);
+ GST_OBJECT_NAME (helper->factory), probability, caps);
if (probability > helper->best_probability) {
GstCaps *copy = gst_caps_copy (caps);
GstTypeFindHelper *helper = (GstTypeFindHelper *) data;
GST_LOG_OBJECT (helper->obj, "'%s' called called get_length, returning %"
- G_GUINT64_FORMAT, GST_PLUGIN_FEATURE_NAME (helper->factory),
- helper->size);
+ G_GUINT64_FORMAT, GST_OBJECT_NAME (helper->factory), helper->size);
return helper->size;
}
continue;
GST_LOG_OBJECT (obj, "testing factory %s for extension %s",
- GST_PLUGIN_FEATURE_NAME (factory), extension);
+ GST_OBJECT_NAME (factory), extension);
for (i = 0; ext[i]; i++) {
if (strcmp (ext[i], extension) == 0) {
helper = (GstTypeFindBufHelper *) data;
GST_LOG_OBJECT (helper->obj, "'%s' called peek (%" G_GINT64_FORMAT ", %u)",
- GST_PLUGIN_FEATURE_NAME (helper->factory), off, size);
+ GST_OBJECT_NAME (helper->factory), off, size);
if (size == 0)
return NULL;
if (off < 0) {
GST_LOG_OBJECT (helper->obj, "'%s' wanted to peek at end; not supported",
- GST_PLUGIN_FEATURE_NAME (helper->factory));
+ GST_OBJECT_NAME (helper->factory));
return NULL;
}
GST_LOG_OBJECT (helper->obj,
"'%s' called called suggest (%u, %" GST_PTR_FORMAT ")",
- GST_PLUGIN_FEATURE_NAME (helper->factory), probability, caps);
+ GST_OBJECT_NAME (helper->factory), probability, caps);
/* Note: not >= as we call typefinders in order of rank, highest first */
if (probability > helper->best_probability) {
fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1,
"Feature in registry should have refcount of 1");
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature),
- feature->name);
+ GST_OBJECT_NAME (feature));
}
}
print_element_info (factory, TRUE);
else
g_print ("%s: %s: %s\n", plugin->desc.name,
- GST_PLUGIN_FEATURE_NAME (factory),
+ GST_OBJECT_NAME (factory),
gst_element_factory_get_longname (factory));
} else if (GST_IS_INDEX_FACTORY (feature)) {
GstIndexFactory *factory;
factory = GST_INDEX_FACTORY (feature);
if (!print_all)
g_print ("%s: %s: %s\n", plugin->desc.name,
- GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
+ GST_OBJECT_NAME (factory), factory->longdesc);
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
GstTypeFindFactory *factory;
} else {
if (!print_all)
n_print ("%s: %s (%s)\n", plugin->desc.name,
- GST_PLUGIN_FEATURE_NAME (feature),
- g_type_name (G_OBJECT_TYPE (feature)));
+ GST_OBJECT_NAME (feature), g_type_name (G_OBJECT_TYPE (feature)));
}
next:
GstElementFactory *factory;
factory = GST_ELEMENT_FACTORY (feature);
- n_print (" %s: %s\n", GST_PLUGIN_FEATURE_NAME (factory),
+ n_print (" %s: %s\n", GST_OBJECT_NAME (factory),
gst_element_factory_get_longname (factory));
num_elements++;
} else if (GST_IS_INDEX_FACTORY (feature)) {
}
if (print_names)
- _name = g_strdup_printf ("%s: ", GST_PLUGIN_FEATURE (factory)->name);
+ _name = g_strdup_printf ("%s: ", GST_OBJECT_NAME (factory));
else
_name = NULL;
if (caps == NULL) {
g_printerr ("Couldn't find static pad template for %s '%s'\n",
- type_name, GST_PLUGIN_FEATURE_NAME (factory));
+ type_name, GST_OBJECT_NAME (factory));
return;
}
return -1;
}
PUT_START_TAG (0, "element");
- PUT_ESCAPED (1, "name", GST_PLUGIN_FEATURE_NAME (factory));
+ PUT_ESCAPED (1, "name", GST_OBJECT_NAME (factory));
gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element));
gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));