mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-10-03 18:49:46 +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 (element)), GST_STATE_PENDING (element),
|
||||||
_gst_print_statename (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_return_val_if_fail(bin->numchildren != 0, GST_STATE_FAILURE);
|
||||||
|
|
||||||
// g_print("-->\n");
|
// g_print("-->\n");
|
||||||
|
@ -253,6 +245,14 @@ gst_bin_change_state (GstElement *element)
|
||||||
}
|
}
|
||||||
// g_print("<-- \"%s\"\n",gst_object_get_name(GST_OBJECT(bin)));
|
// 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);
|
return gst_bin_change_state_norecurse (bin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,6 +307,7 @@ gint
|
||||||
gst_element_set_state (GstElement *element, GstElementState state)
|
gst_element_set_state (GstElement *element, GstElementState state)
|
||||||
{
|
{
|
||||||
GstElementClass *oclass;
|
GstElementClass *oclass;
|
||||||
|
GstElementState curpending;
|
||||||
GstElementStateReturn return_val = GST_STATE_SUCCESS;
|
GstElementStateReturn return_val = GST_STATE_SUCCESS;
|
||||||
|
|
||||||
// g_print("gst_element_set_state(\"%s\",%08lx)\n",
|
// 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 (element != NULL, GST_STATE_FAILURE);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
||||||
|
|
||||||
// first we set the pending state variable
|
curpending = GST_STATE(element);
|
||||||
// FIXME should probably check to see that we don't already have one
|
while (GST_STATE(element) != state) {
|
||||||
GST_STATE_PENDING (element) = state;
|
if (curpending < state) curpending++;
|
||||||
|
else curpending--;
|
||||||
|
|
||||||
// now we call the state change function so it can set the state
|
// first we set the pending state variable
|
||||||
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
// FIXME should probably check to see that we don't already have one
|
||||||
if (oclass->change_state)
|
GST_STATE_PENDING (element) = curpending;
|
||||||
return_val = (oclass->change_state)(element);
|
|
||||||
|
// 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;
|
return return_val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue