Commit fc35aeea authored by David Schleef's avatar David Schleef

Add gst_element_class_get_pad_template()

Original commit message from CVS:
Add gst_element_class_get_pad_template()
parent 67fb6a19
......@@ -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.
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment