element: Consider GstPadTemplate as immutable

Don't copy the templates when creating subclasses but only increase
their refcount.
This commit is contained in:
Sebastian Dröge 2011-05-17 12:12:23 +02:00
parent be00534878
commit 5f406248eb
2 changed files with 4 additions and 5 deletions

View file

@ -101,6 +101,9 @@ The 0.11 porting guide
GstPadTemplate is now created with a floating ref and
gst_element_class_add_pad_template() takes ownership of this floating ref.
GstPadTemplate instances are considered immutable and must not be
changed.
* GstMiniObject
A miniobject is now a simple refcounted structure holding the information
common to buffers, events, messages, queries and caps.

View file

@ -251,14 +251,10 @@ gst_element_base_class_init (gpointer g_class)
* from their base class but elements can add pad templates in class_init
* instead of base_init.
*/
/* FIXME: Do we consider GstPadTemplates as immutable? If so we can
* simply ref them instead of copying.
*/
padtemplates = g_list_copy (element_class->padtemplates);
for (node = padtemplates; node != NULL; node = node->next) {
GstPadTemplate *tmpl = (GstPadTemplate *) node->data;
node->data = gst_pad_template_new (tmpl->name_template,
tmpl->direction, tmpl->presence, gst_caps_copy (tmpl->caps));
gst_object_ref (tmpl);
}
element_class->padtemplates = padtemplates;