Commit 63f02ce9 authored by Wim Taymans's avatar Wim Taymans
Browse files

gst/gstelement.c: Use src/sink pads lists for the respective iterators instead of filtering.

Original commit message from CVS:
* gst/gstelement.c: (gst_element_iterate_pad_list),
(gst_element_iterate_pads), (gst_element_iterate_src_pads),
(gst_element_iterate_sink_pads):
Use src/sink pads lists for the respective iterators instead
of filtering.
parent ac8289c7
2005-10-10 Wim Taymans <wim@fluendo.com>
* gst/gstelement.c: (gst_element_iterate_pad_list),
(gst_element_iterate_pads), (gst_element_iterate_src_pads),
(gst_element_iterate_sink_pads):
Use src/sink pads lists for the respective iterators instead
of filtering.
2005-10-10 Andy Wingo <wingo@pobox.com>
Merged in popt removal + GOption addition patch from Ronald, bug
......
......@@ -925,30 +925,17 @@ iterate_pad (GstIterator * it, GstPad * pad)
return GST_ITERATOR_ITEM_PASS;
}
/**
* gst_element_iterate_pads:
* @element: a #GstElement to iterate pads of.
*
* Retrieves an iterattor of @element's pads. The iterator should
* be freed after usage.
*
* Returns: the #GstIterator of #GstPad. Unref each pad after use.
*
* MT safe.
*/
GstIterator *
gst_element_iterate_pads (GstElement * element)
static GstIterator *
gst_element_iterate_pad_list (GstElement * element, GList ** padlist)
{
GstIterator *result;
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
GST_LOCK (element);
gst_object_ref (element);
result = gst_iterator_new_list (GST_TYPE_PAD,
GST_GET_LOCK (element),
&element->pads_cookie,
&element->pads,
padlist,
element,
(GstIteratorItemFunction) iterate_pad,
(GstIteratorDisposeFunction) gst_object_unref);
......@@ -957,18 +944,23 @@ gst_element_iterate_pads (GstElement * element)
return result;
}
static gint
direction_filter (gconstpointer pad, gconstpointer direction)
/**
* gst_element_iterate_pads:
* @element: a #GstElement to iterate pads of.
*
* Retrieves an iterattor of @element's pads. The iterator should
* be freed after usage.
*
* Returns: the #GstIterator of #GstPad. Unref each pad after use.
*
* MT safe.
*/
GstIterator *
gst_element_iterate_pads (GstElement * element)
{
if (GST_PAD_DIRECTION (pad) == GPOINTER_TO_INT (direction)) {
/* pass the ref through */
return 0;
} else {
/* unref */
/* FIXME: this is very stupid */
gst_object_unref (GST_OBJECT_CAST (pad));
return 1;
}
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return gst_element_iterate_pad_list (element, &element->pads);
}
/**
......@@ -986,8 +978,7 @@ gst_element_iterate_src_pads (GstElement * element)
{
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return gst_iterator_filter (gst_element_iterate_pads (element),
direction_filter, GINT_TO_POINTER (GST_PAD_SRC));
return gst_element_iterate_pad_list (element, &element->srcpads);
}
/**
......@@ -1005,8 +996,7 @@ gst_element_iterate_sink_pads (GstElement * element)
{
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return gst_iterator_filter (gst_element_iterate_pads (element),
direction_filter, GINT_TO_POINTER (GST_PAD_SINK));
return gst_element_iterate_pad_list (element, &element->sinkpads);
}
/**
......
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