registry: fill in elementfactory when registering element

elementfactory field is filled in by gst_element_base_class_init,
but it needs some info set on the element's type, so have it
available prior to class structure creation spinning up.
This affects elements that have a well-known/public type (e.g. pipeline)
and can be created by other means than gst_element_factory_make
(which will also fill in the element's factory).
This commit is contained in:
Mark Nauwelaerts 2009-08-29 20:44:36 +02:00
parent b0c1ebbd08
commit 1b6da398fb

View file

@ -286,6 +286,8 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
GST_LOG_OBJECT (factory, "Created new elementfactory for type %s", GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
g_type_name (type)); g_type_name (type));
/* provide info needed during class structure setup */
g_type_set_qdata (type, _gst_elementclass_factory, factory);
klass = GST_ELEMENT_CLASS (g_type_class_ref (type)); klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
if ((klass->details.longname == NULL) || if ((klass->details.longname == NULL) ||
(klass->details.klass == NULL) || (klass->details.author == NULL)) (klass->details.klass == NULL) || (klass->details.author == NULL))
@ -306,7 +308,6 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
g_list_append (factory->staticpadtemplates, newt); g_list_append (factory->staticpadtemplates, newt);
} }
factory->numpadtemplates = klass->numpadtemplates; factory->numpadtemplates = klass->numpadtemplates;
g_type_set_qdata (type, _gst_elementclass_factory, factory);
/* special stuff for URI handling */ /* special stuff for URI handling */
if (g_type_is_a (type, GST_TYPE_URI_HANDLER)) { if (g_type_is_a (type, GST_TYPE_URI_HANDLER)) {