Add gst_element_class_get_pad_template()

Original commit message from CVS:
Add gst_element_class_get_pad_template()
This commit is contained in:
David Schleef 2003-11-08 23:28:04 +00:00
parent 67fb6a19f6
commit fc35aeeaad
2 changed files with 60 additions and 1 deletions

View file

@ -1178,12 +1178,16 @@ void
gst_element_class_add_pad_template (GstElementClass *klass,
GstPadTemplate *templ)
{
GstPadTemplate *templ_copy;
g_return_if_fail (klass != NULL);
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
g_return_if_fail (templ != NULL);
g_return_if_fail (GST_IS_PAD_TEMPLATE (templ));
klass->padtemplates = g_list_append (klass->padtemplates, templ);
templ_copy = g_memdup(templ, sizeof(GstPadTemplate));
klass->padtemplates = g_list_append (klass->padtemplates, templ_copy);
klass->numpadtemplates++;
}
@ -1204,11 +1208,63 @@ gst_element_class_set_details (GstElementClass *klass, GstElementDetails *detail
__gst_element_details_set (&klass->details, details);
}
/**
* gst_element_class_get_pad_template_list:
* @element: a #GstElementClass to get pad templates of.
*
* Retrieves a list of the pad templates associated with the element.
*
* Returns: the #GList of padtemplates.
*/
GList*
gst_element_class_get_pad_template_list (GstElementClass *element_class)
{
g_return_val_if_fail (element_class != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT_CLASS (element_class), NULL);
return element_class->padtemplates;
}
/**
* gst_element_class_get_pad_template:
* @element: a #GstElementClass to get the pad template of.
* @name: the name of the #GstPadTemplate to get.
*
* Retrieves a padtemplate from this element with the
* given name.
*
* Returns: the #GstPadTemplate with the given name, or NULL if none was found.
* No unreferencing is necessary.
*/
GstPadTemplate*
gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name)
{
GList *padlist;
g_return_val_if_fail (element_class != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT_CLASS (element_class), NULL);
g_return_val_if_fail (name != NULL, NULL);
padlist = gst_element_class_get_pad_template_list (element_class);
while (padlist) {
GstPadTemplate *padtempl = (GstPadTemplate*) padlist->data;
if (strcmp (padtempl->name_template, name) == 0)
return padtempl;
padlist = g_list_next (padlist);
}
return NULL;
}
/**
* gst_element_get_pad_template_list:
* @element: a #GstElement to get pad templates of.
*
* Retrieves a list of the pad templates associated with the element.
* (FIXME: Should be deprecated in favor of gst_element_class_get_pad_template_list).
*
* Returns: the #GList of padtemplates.
*/
@ -1228,6 +1284,7 @@ gst_element_get_pad_template_list (GstElement *element)
*
* Retrieves a padtemplate from this element with the
* given name.
* (FIXME: Should be deprecated in favor of gst_element_class_get_pad_template).
*
* Returns: the #GstPadTemplate with the given name, or NULL if none was found.
* No unreferencing is necessary.

View file

@ -315,6 +315,8 @@ GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad);
GstPad* gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
GstCaps *filtercaps);
GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
GstPadTemplate* gst_element_get_pad_template (GstElement *element, const gchar *name);
GList* gst_element_get_pad_template_list (GstElement *element);
GstPadTemplate* gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *compattempl);