Add gst_pad_set_active_recursive().

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* gst/gstpad.c: (gst_pad_set_active_recursive):
* gst/gstpad.h:
Add gst_pad_set_active_recursive().
This commit is contained in:
Ronald S. Bultje 2005-01-11 00:40:13 +00:00
parent b848c8be0a
commit 28f58530fe
5 changed files with 65 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2005-01-11 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/gstpad.sgml:
* gst/gstpad.c: (gst_pad_set_active_recursive):
* gst/gstpad.h:
Add gst_pad_set_active_recursive().
2005-01-10 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/random/release:

View file

@ -974,6 +974,7 @@ gst_pad_set_name
gst_pad_get_name
gst_pad_get_direction
gst_pad_set_active
gst_pad_set_active_recursive
gst_pad_is_active
gst_pad_set_element_private
gst_pad_get_element_private

View file

@ -529,6 +529,15 @@ Checks if the pad is a sink pad.
@active:
<!-- ##### FUNCTION gst_pad_set_active_recursive ##### -->
<para>
</para>
@pad:
@active:
<!-- ##### FUNCTION gst_pad_is_active ##### -->
<para>

View file

@ -480,6 +480,52 @@ gst_pad_set_active (GstPad * pad, gboolean active)
g_object_notify (G_OBJECT (realpad), "active");
}
/**
* gst_pad_set_active_recursive:
* @pad: the #GstPad to activate or deactivate.
* @active: TRUE to activate the pad.
*
* Activates or deactivates the given pad and all internally linked
* pads upstream until it finds an element with multiple source pads.
*/
void
gst_pad_set_active_recursive (GstPad * pad, gboolean active)
{
GstElement *parent;
const GList *int_links;
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (GST_PAD_IS_SRC (pad));
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"Recursively %s pad %s:%s", active ? "activating" : "deactivating",
GST_DEBUG_PAD_NAME (pad));
gst_pad_set_active (pad, active);
/* If we have more than one sourcepad, then the other pads should
* possibly be kept active. FIXME: maybe we should recurse
* activation if any one pad is active and recurse deactivation
* if no single pad is active? */
parent = gst_pad_get_parent (pad);
if (!parent || parent->numsrcpads > 1)
return;
for (int_links = gst_pad_get_internal_links (pad);
int_links; int_links = g_list_next (int_links)) {
GstPad *sinkpad = GST_PAD (int_links->data);
GstPad *peer = GST_PAD_PEER (sinkpad);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, sinkpad,
"Recursing %s on pad %s:%s",
active ? "activation" : "deactivation", GST_DEBUG_PAD_NAME (sinkpad));
gst_pad_set_active (sinkpad, active);
if (peer)
gst_pad_set_active_recursive (peer, active);
}
}
/**
* gst_pad_is_active:
* @pad: the #GstPad to query

View file

@ -366,6 +366,7 @@ G_CONST_RETURN gchar* gst_pad_get_name (GstPad *pad);
GstPadDirection gst_pad_get_direction (GstPad *pad);
void gst_pad_set_active (GstPad *pad, gboolean active);
void gst_pad_set_active_recursive (GstPad *pad, gboolean active);
gboolean gst_pad_is_active (GstPad *pad);
void gst_pad_set_element_private (GstPad *pad, gpointer priv);