Original commit message from CVS:
Update our internal state counters when adding/removing elements.
gst_bin_add (GstBin *bin,
GstElement *element)
{
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);
g_return_if_fail (bin != NULL);
g_return_if_fail (GST_IS_BIN (bin));
g_return_if_fail (element != NULL);
bin->children = g_list_append (bin->children, element);
bin->numchildren++;
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)
///// 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)
gst_bin_remove (GstBin *bin,
GstElement *element)
{
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);
g_return_if_fail (bin != NULL);
g_return_if_fail (GST_IS_BIN (bin));
g_return_if_fail (element != NULL);
bin->children = g_list_remove (bin->children, element);
bin->numchildren--;
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));
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element));
gst_object_unparent (GST_OBJECT (element));
if (oclass->iterate)
running = (oclass->iterate) (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) {
if (!running) {
if (GST_STATE (bin) == GST_STATE_PLAYING && GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {