catch wrong state changes in element base class

Original commit message from CVS:
catch wrong state changes in element base class
This commit is contained in:
Thomas Vander Stichele 2004-07-09 11:20:59 +00:00
parent c309ad76fb
commit ac9d8868a5
9 changed files with 74 additions and 34 deletions

View file

@ -1,3 +1,14 @@
2004-07-09 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* docs/gst/tmpl/gstelement.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* docs/gst/tmpl/gsttypes.sgml:
* docs/pwg/building-state.xml:
* gst/elements/gstfakesrc.c: (gst_fakesrc_change_state):
* gst/gstelement.c: (gst_element_change_state):
* gst/gstthread.c: (gst_thread_change_state):
catch wrong state changes in element base class.
2004-07-09 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* gst/gstinfo.h:

View file

@ -76,6 +76,8 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@gstelement: the object which received the signal.
<!-- ##### SIGNAL GstElement::error ##### -->
@ -83,6 +85,11 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@:
@:
@:
@gstelement: the object which received the signal.
@arg1:
@arg2:
@ -93,6 +100,10 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@:
@:
@gstelement: the object which received the signal.
@arg1:
@arg2:
@ -102,6 +113,9 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@:
@gstelement: the object which received the signal.
@arg1:
@ -110,6 +124,8 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@gstelement: the object which received the signal.
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
@ -117,6 +133,9 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@:
@gstelement: the object which received the signal.
@arg1:
@ -125,6 +144,10 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
</para>
@:
@:
@:
@gstelement: the object which received the signal.
@arg1:
@arg2:
@ -362,14 +385,6 @@ Get the parent object of this element.
@obj: a #GstElement to query
<!-- ##### MACRO GST_ELEMENT_MANAGER ##### -->
<para>
Get the manager of this element.
</para>
@obj: a #GstElement to query
<!-- ##### MACRO GST_ELEMENT_SCHED ##### -->
<para>
Get the scheduler of this element.

View file

@ -307,6 +307,16 @@ It will be called by the loader at statup.
@Returns:
<!-- ##### FUNCTION gst_plugin_check_file ##### -->
<para>
</para>
@filename:
@error:
@Returns:
<!-- ##### FUNCTION gst_plugin_load_file ##### -->
<para>

View file

@ -127,58 +127,58 @@ template.
</para>
@:
@gstelement: the object which received the signal.
<!-- ##### SIGNAL GstElement::error ##### -->
<para>
</para>
@:
@:
@:
@:
@gstelement: the object which received the signal.
@arg1:
@arg2:
@arg3:
<!-- ##### SIGNAL GstElement::found-tag ##### -->
<para>
</para>
@:
@:
@:
@gstelement: the object which received the signal.
@arg1:
@arg2:
<!-- ##### SIGNAL GstElement::new-pad ##### -->
<para>
</para>
@:
@:
@gstelement: the object which received the signal.
@arg1:
<!-- ##### SIGNAL GstElement::no-more-pads ##### -->
<para>
</para>
@:
@gstelement: the object which received the signal.
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
<para>
</para>
@:
@:
@gstelement: the object which received the signal.
@arg1:
<!-- ##### SIGNAL GstElement::state-change ##### -->
<para>
</para>
@:
@:
@:
@gstelement: the object which received the signal.
@arg1:
@arg2:
<!-- ##### STRUCT GstElementClass ##### -->
<para>

View file

@ -64,6 +64,10 @@
specific data needed by the element, and it can optionally fail to
go from one state to another.
</para>
<para>
Do not g_assert for unhandled state changes; this is taken care of by
the GstElement base class.
</para>
<programlisting>
static GstElementStateReturn
gst_my_filter_change_state (GstElement *element);

View file

@ -873,7 +873,6 @@ gst_fakesrc_change_state (GstElement * element)
case GST_STATE_READY_TO_NULL:
break;
default:
g_assert_not_reached ();
break;
}

View file

@ -2914,6 +2914,7 @@ gst_element_change_state (GstElement * element)
old_pending = GST_STATE_PENDING (element);
old_transition = GST_STATE_TRANSITION (element);
/* if the element already is in the given state, we just return success */
if (old_pending == GST_STATE_VOID_PENDING ||
old_state == GST_STATE_PENDING (element)) {
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
@ -2968,7 +2969,16 @@ gst_element_change_state (GstElement * element)
element->base_time = 0;
gst_element_clear_pad_caps (element);
break;
case GST_STATE_NULL_TO_READY:
case GST_STATE_READY_TO_NULL:
break;
default:
/* this will catch real but unhandled state changes;
* can only be caused by:
* - a new state was added
* - somehow the element was asked to jump across an intermediate state
*/
g_assert_not_reached ();
break;
}

View file

@ -501,14 +501,6 @@ gst_thread_change_state (GstElement * element)
/* it should be dead now */
break;
default:
GST_ERROR_OBJECT (element, "unhandled state change! %x",
GST_STATE_TRANSITION (element));
g_warning ("thread %s: UNHANDLED STATE CHANGE! %x",
GST_STR_NULL (GST_OBJECT_NAME (element)),
GST_STATE_TRANSITION (element));
/* FIXME: not doable with current threading mess:
g_assert_not_reached ();
*/
break;
}

View file

@ -873,7 +873,6 @@ gst_fakesrc_change_state (GstElement * element)
case GST_STATE_READY_TO_NULL:
break;
default:
g_assert_not_reached ();
break;
}