mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
gst/gstpad.c: check that caps are fixed
Original commit message from CVS: * gst/gstpad.c: (gst_pad_set_explicit_caps): check that caps are fixed * gst/gstpad.c: (gst_pad_template_new): don't try to simplify caps, costs too much time on gst_init * gst/gstplugin.c: (gst_plugin_add_feature): G_ERROR if features are added twice * gst/gsttypefind.c: (gst_type_find_register): * gst/gstelementfactory.c: (gst_element_register): don't add features twice * docs/random/ds/0.9-suggested-changes: add note about possible gst_init optimization
This commit is contained in:
parent
0dc1a2b42f
commit
2bd5f3ad46
6 changed files with 37 additions and 7 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2004-07-29 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* gst/gstpad.c: (gst_pad_set_explicit_caps):
|
||||
check that caps are fixed
|
||||
* gst/gstpad.c: (gst_pad_template_new):
|
||||
don't try to simplify caps, costs too much time on gst_init
|
||||
* gst/gstplugin.c: (gst_plugin_add_feature):
|
||||
G_ERROR if features are added twice
|
||||
* gst/gsttypefind.c: (gst_type_find_register):
|
||||
* gst/gstelementfactory.c: (gst_element_register):
|
||||
don't add features twice
|
||||
* docs/random/ds/0.9-suggested-changes:
|
||||
add note about possible gst_init optimization
|
||||
|
||||
2004-07-28 David Schleef <ds@schleef.org>
|
||||
|
||||
* testsuite/elements/Makefile.am:
|
||||
|
|
|
@ -140,3 +140,7 @@ object hierarchy:
|
|||
- make this explicit by having a list of keywords instead of a fixed string
|
||||
with slashes
|
||||
- fix the editor/el browser to display this nicely
|
||||
|
||||
- optimization:
|
||||
- delay parsing caps from the registry until after startup (until they're
|
||||
first requested or maybe an idle handler for the main loop)
|
||||
|
|
|
@ -214,20 +214,20 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
factory = gst_element_factory_find (name);
|
||||
|
||||
if (!factory) {
|
||||
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
||||
factory =
|
||||
GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
|
||||
GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
|
||||
g_type_name (type));
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
} else {
|
||||
g_return_val_if_fail (factory->type == 0, FALSE);
|
||||
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
||||
gst_element_factory_cleanup (factory);
|
||||
GST_LOG_OBJECT (factory, "Reuse existing elementfactory for type %s",
|
||||
g_type_name (type));
|
||||
}
|
||||
|
||||
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
|
||||
factory->type = type;
|
||||
__gst_element_details_copy (&factory->details, &klass->details);
|
||||
factory->padtemplates = g_list_copy (klass->padtemplates);
|
||||
|
@ -257,7 +257,6 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
g_free (interfaces);
|
||||
|
||||
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -2463,6 +2463,7 @@ gst_pad_set_explicit_caps (GstPad * pad, const GstCaps * caps)
|
|||
GstPadLinkReturn link_ret;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_PADS,
|
||||
"setting explicit caps on %s:%s to %" GST_PTR_FORMAT,
|
||||
|
@ -3652,6 +3653,10 @@ gst_pad_template_new (const gchar * name_template,
|
|||
|
||||
g_return_val_if_fail (name_template != NULL, NULL);
|
||||
g_return_val_if_fail (caps != NULL, NULL);
|
||||
g_return_val_if_fail (direction == GST_PAD_SRC
|
||||
|| direction == GST_PAD_SINK, NULL);
|
||||
g_return_val_if_fail (presence == GST_PAD_ALWAYS
|
||||
|| presence == GST_PAD_SOMETIMES || presence == GST_PAD_REQUEST, NULL);
|
||||
|
||||
if (!name_is_valid (name_template, presence))
|
||||
return NULL;
|
||||
|
@ -3672,7 +3677,6 @@ gst_pad_template_new (const gchar * name_template,
|
|||
GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (name_template);
|
||||
GST_PAD_TEMPLATE_DIRECTION (new) = direction;
|
||||
GST_PAD_TEMPLATE_PRESENCE (new) = presence;
|
||||
gst_caps_do_simplify (caps);
|
||||
GST_PAD_TEMPLATE_CAPS (new) = caps;
|
||||
|
||||
return new;
|
||||
|
|
|
@ -790,6 +790,8 @@ gst_plugin_add_feature (GstPlugin * plugin, GstPluginFeature * feature)
|
|||
{
|
||||
GstPluginFeature *oldfeature;
|
||||
|
||||
/* FIXME 0.9: get reference counting somewhat right in here, GstPluginFeatures
|
||||
* should probably be GstObjects that are sinked when adding them to a plugin */
|
||||
g_return_if_fail (plugin != NULL);
|
||||
g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
|
||||
g_return_if_fail (feature != NULL);
|
||||
|
@ -797,7 +799,15 @@ gst_plugin_add_feature (GstPlugin * plugin, GstPluginFeature * feature)
|
|||
oldfeature = gst_plugin_find_feature (plugin,
|
||||
GST_PLUGIN_FEATURE_NAME (feature), G_OBJECT_TYPE (feature));
|
||||
|
||||
if (!oldfeature) {
|
||||
if (oldfeature == feature) {
|
||||
GST_ERROR ("feature %s has already been added",
|
||||
GST_PLUGIN_FEATURE_NAME (feature));
|
||||
/* g_object_unref (feature); */
|
||||
} else if (oldfeature) {
|
||||
GST_ERROR ("feature %s already present in plugin",
|
||||
GST_PLUGIN_FEATURE_NAME (feature));
|
||||
/* g_object_unref (feature); */
|
||||
} else {
|
||||
feature->manager = plugin;
|
||||
plugin->features = g_list_prepend (plugin->features, feature);
|
||||
plugin->numfeatures++;
|
||||
|
|
|
@ -239,6 +239,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
GST_DEBUG_OBJECT (factory, "using new typefind factory for %s", name);
|
||||
g_assert (GST_IS_TYPE_FIND_FACTORY (factory));
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (factory, "using old typefind factory for %s", name);
|
||||
}
|
||||
|
@ -252,8 +253,6 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
factory->function = func;
|
||||
factory->user_data = data;
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue