gstelement: add gst_element_class_add_pad_template_from_static

This function helps ensure the pad template is unreffed
without having to complicate the calling code.

https://bugzilla.gnome.org/show_bug.cgi?id=662664
This commit is contained in:
Vincent Penquerc'h 2011-11-28 12:30:15 +00:00
parent 3b28af5171
commit c0ba7985bd
3 changed files with 26 additions and 0 deletions

View file

@ -1331,6 +1331,30 @@ gst_element_class_add_pad_template (GstElementClass * klass,
klass->numpadtemplates++;
}
/**
* gst_element_class_add_static_pad_template:
* @klass: the #GstElementClass to add the pad template to.
* @templ: (transfer none): a #GstStaticPadTemplate describing the pad
* to add to the element class.
*
* Adds a padtemplate to an element class. This is mainly used in the _base_init
* functions of classes.
*
* Since: 0.10.36
*/
void
gst_element_class_add_static_pad_template (GstElementClass * klass,
GstStaticPadTemplate * templ)
{
GstPadTemplate *pt;
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
pt = gst_static_pad_template_get (templ);
gst_element_class_add_pad_template (klass, pt);
gst_object_unref (pt);
}
static void
gst_element_class_add_meta_data (GstElementClass * klass,
const gchar * key, const gchar * value)

View file

@ -680,6 +680,7 @@ struct _GstElementClass
/* element class pad templates */
void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
void gst_element_class_add_static_pad_template (GstElementClass *klass, GstStaticPadTemplate *templ);
GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);

View file

@ -299,6 +299,7 @@ EXPORTS
gst_element_add_pad
gst_element_change_state
gst_element_class_add_pad_template
gst_element_class_add_static_pad_template
gst_element_class_get_pad_template
gst_element_class_get_pad_template_list
gst_element_class_install_std_props