mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 11:15:31 +00:00
gstbin.c: modified so create_plan occurs after the state change of all the child elements.
Original commit message from CVS: gstbin.c: modified so create_plan occurs after the state change of all the child elements. gstelement.c: set_state now loops such that each element only deals with one state change at a time, i.e. NULL->READY,READY->PLAYING, instead of a single NULL->PLAYING.
This commit is contained in:
parent
587051a384
commit
4638451539
2 changed files with 24 additions and 15 deletions
16
gst/gstbin.c
16
gst/gstbin.c
|
@ -221,14 +221,6 @@ gst_bin_change_state (GstElement *element)
|
|||
_gst_print_statename (GST_STATE (element)), GST_STATE_PENDING (element),
|
||||
_gst_print_statename (GST_STATE_PENDING (element)));
|
||||
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
||||
GstObject *parent;
|
||||
|
||||
parent = gst_object_get_parent (GST_OBJECT (element));
|
||||
|
||||
if (!parent || !GST_IS_BIN (parent))
|
||||
gst_bin_create_plan (bin);
|
||||
}
|
||||
// g_return_val_if_fail(bin->numchildren != 0, GST_STATE_FAILURE);
|
||||
|
||||
// g_print("-->\n");
|
||||
|
@ -253,6 +245,14 @@ gst_bin_change_state (GstElement *element)
|
|||
}
|
||||
// g_print("<-- \"%s\"\n",gst_object_get_name(GST_OBJECT(bin)));
|
||||
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
||||
GstObject *parent;
|
||||
|
||||
parent = gst_object_get_parent (GST_OBJECT (element));
|
||||
|
||||
if (!parent || !GST_IS_BIN (parent))
|
||||
gst_bin_create_plan (bin);
|
||||
}
|
||||
|
||||
return gst_bin_change_state_norecurse (bin);
|
||||
}
|
||||
|
|
|
@ -307,6 +307,7 @@ gint
|
|||
gst_element_set_state (GstElement *element, GstElementState state)
|
||||
{
|
||||
GstElementClass *oclass;
|
||||
GstElementState curpending;
|
||||
GstElementStateReturn return_val = GST_STATE_SUCCESS;
|
||||
|
||||
// g_print("gst_element_set_state(\"%s\",%08lx)\n",
|
||||
|
@ -315,14 +316,22 @@ gst_element_set_state (GstElement *element, GstElementState state)
|
|||
g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
||||
|
||||
// first we set the pending state variable
|
||||
// FIXME should probably check to see that we don't already have one
|
||||
GST_STATE_PENDING (element) = state;
|
||||
curpending = GST_STATE(element);
|
||||
while (GST_STATE(element) != state) {
|
||||
if (curpending < state) curpending++;
|
||||
else curpending--;
|
||||
|
||||
// now we call the state change function so it can set the state
|
||||
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
||||
if (oclass->change_state)
|
||||
return_val = (oclass->change_state)(element);
|
||||
// first we set the pending state variable
|
||||
// FIXME should probably check to see that we don't already have one
|
||||
GST_STATE_PENDING (element) = curpending;
|
||||
|
||||
// now we call the state change function so it can set the state
|
||||
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
||||
if (oclass->change_state)
|
||||
return_val = (oclass->change_state)(element);
|
||||
|
||||
if (return_val == GST_STATE_FAILURE) return return_val;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue