- move the state_change signal emit to a better place, before changing the parent state

Original commit message from CVS:
- move the state_change signal emit to a better place, before changing
the parent state
- also call the parent state change handler in a bin
This commit is contained in:
Wim Taymans 2002-07-28 01:46:38 +00:00
parent e3c9576f3c
commit a444a6ccc5
2 changed files with 17 additions and 9 deletions

View file

@ -229,7 +229,8 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
if (GST_IS_BIN (element)) {
if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not resetting");
gst_scheduler_add_scheduler (sched, GST_ELEMENT_SCHED (element));
if (GST_ELEMENT_SCHED (element))
gst_scheduler_add_scheduler (sched, GST_ELEMENT_SCHED (element));
return;
}
@ -565,9 +566,13 @@ gst_bin_change_state (GstElement * element)
if (have_async)
ret = GST_STATE_ASYNC;
else
ret = GST_STATE_SUCCESS;
else {
if (parent_class->change_state) {
ret = parent_class->change_state(element);
}
else
ret = GST_STATE_SUCCESS;
}
return ret;
}
@ -577,9 +582,9 @@ gst_bin_change_state_norecurse (GstBin * bin)
{
GstElementStateReturn ret;
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
if (parent_class->change_state) {
GST_DEBUG_ELEMENT (GST_CAT_STATES, bin, "setting bin's own state");
ret = GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (bin));
ret = parent_class->change_state (GST_ELEMENT (bin));
return ret;
}

View file

@ -2087,14 +2087,17 @@ gst_element_change_state (GstElement *element)
parent = GST_ELEMENT_PARENT (element);
GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "signaling state change from %s to %s",
gst_element_state_get_name (old_state),
gst_element_state_get_name (GST_STATE (element)));
g_signal_emit (G_OBJECT (element), gst_element_signals[STATE_CHANGE],
0, old_state, GST_STATE (element));
/* tell our parent about the state change */
if (parent && GST_IS_BIN (parent)) {
gst_bin_child_state_change (GST_BIN (parent), old_state, GST_STATE (element), element);
}
g_signal_emit (G_OBJECT (element), gst_element_signals[STATE_CHANGE],
0, old_state, GST_STATE (element));
/* signal the state change in case somebody is waiting for us */
g_mutex_lock (element->state_mutex);
g_cond_signal (element->state_cond);