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;
}
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;
}
{
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;
}
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);