diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2001-12-10 18:08:35 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2001-12-10 18:08:35 +0000 |
commit | 970e58ebd3551f81667a860e8531021880acd7e0 (patch) | |
tree | 20f1bce956d0d56b421185214e316ffb6b89cf73 | |
parent | d2bceb75d736fcc2bd06427a18f6d26792ae0aec (diff) |
Update our internal state counters when adding/removing elements.BRANCH-BUILD1-200112101-ROOT
Original commit message from CVS:
Update our internal state counters when adding/removing elements.
-rw-r--r-- | gst/gstbin.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c index 579fce9a9..07c5610d8 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -256,6 +256,9 @@ void gst_bin_add (GstBin *bin, GstElement *element) { + gint state_idx = 0; + GstElementState state; + g_return_if_fail (bin != NULL); g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (element != NULL); @@ -280,6 +283,11 @@ gst_bin_add (GstBin *bin, bin->children = g_list_append (bin->children, element); bin->numchildren++; + // bump our internal state counter + state = GST_STATE (element); + while (state>>=1) state_idx++; + bin->child_states[state_idx]++; + ///// now we have to deal with manager stuff // we can only do this if there's a scheduler: // if we're not a manager, and aren't attached to anything, we have no sched (yet) @@ -306,6 +314,9 @@ void gst_bin_remove (GstBin *bin, GstElement *element) { + gint state_idx = 0; + GstElementState state; + g_return_if_fail (bin != NULL); g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (element != NULL); @@ -332,6 +343,11 @@ gst_bin_remove (GstBin *bin, bin->children = g_list_remove (bin->children, element); bin->numchildren--; + // bump our internal state counter + state = GST_STATE (element); + while (state>>=1) state_idx++; + bin->child_states[state_idx]--; + GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element)); gst_object_unparent (GST_OBJECT (element)); @@ -711,7 +727,7 @@ gst_bin_iterate (GstBin *bin) if (oclass->iterate) running = (oclass->iterate) (bin); - GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin)); + GST_DEBUG_LEAVE("(\"%s\") %d",GST_ELEMENT_NAME (bin), running); if (!running) { if (GST_STATE (bin) == GST_STATE_PLAYING && GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) { |