mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
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:
parent
c309ad76fb
commit
ac9d8868a5
9 changed files with 74 additions and 34 deletions
11
ChangeLog
11
ChangeLog
|
@ -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>
|
2004-07-09 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
|
||||||
|
|
||||||
* gst/gstinfo.h:
|
* gst/gstinfo.h:
|
||||||
|
|
|
@ -76,6 +76,8 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::error ##### -->
|
<!-- ##### SIGNAL GstElement::error ##### -->
|
||||||
|
@ -83,6 +85,11 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
@arg1:
|
@arg1:
|
||||||
@arg2:
|
@arg2:
|
||||||
|
@ -93,6 +100,10 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
@arg1:
|
@arg1:
|
||||||
@arg2:
|
@arg2:
|
||||||
|
@ -102,6 +113,9 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
@arg1:
|
@arg1:
|
||||||
|
|
||||||
|
@ -110,6 +124,8 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
|
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
|
||||||
|
@ -117,6 +133,9 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
@arg1:
|
@arg1:
|
||||||
|
|
||||||
|
@ -125,6 +144,10 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
@:
|
||||||
|
|
||||||
@gstelement: the object which received the signal.
|
@gstelement: the object which received the signal.
|
||||||
@arg1:
|
@arg1:
|
||||||
@arg2:
|
@arg2:
|
||||||
|
@ -362,14 +385,6 @@ Get the parent object of this element.
|
||||||
@obj: a #GstElement to query
|
@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 ##### -->
|
<!-- ##### MACRO GST_ELEMENT_SCHED ##### -->
|
||||||
<para>
|
<para>
|
||||||
Get the scheduler of this element.
|
Get the scheduler of this element.
|
||||||
|
|
|
@ -307,6 +307,16 @@ It will be called by the loader at statup.
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_plugin_check_file ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@filename:
|
||||||
|
@error:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_plugin_load_file ##### -->
|
<!-- ##### FUNCTION gst_plugin_load_file ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -127,58 +127,58 @@ template.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::error ##### -->
|
<!-- ##### SIGNAL GstElement::error ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
@:
|
@arg1:
|
||||||
@:
|
@arg2:
|
||||||
@:
|
@arg3:
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::found-tag ##### -->
|
<!-- ##### SIGNAL GstElement::found-tag ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
@:
|
@arg1:
|
||||||
@:
|
@arg2:
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::new-pad ##### -->
|
<!-- ##### SIGNAL GstElement::new-pad ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
@:
|
@arg1:
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::no-more-pads ##### -->
|
<!-- ##### SIGNAL GstElement::no-more-pads ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
|
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
@:
|
@arg1:
|
||||||
|
|
||||||
<!-- ##### SIGNAL GstElement::state-change ##### -->
|
<!-- ##### SIGNAL GstElement::state-change ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@:
|
@gstelement: the object which received the signal.
|
||||||
@:
|
@arg1:
|
||||||
@:
|
@arg2:
|
||||||
|
|
||||||
<!-- ##### STRUCT GstElementClass ##### -->
|
<!-- ##### STRUCT GstElementClass ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -64,6 +64,10 @@
|
||||||
specific data needed by the element, and it can optionally fail to
|
specific data needed by the element, and it can optionally fail to
|
||||||
go from one state to another.
|
go from one state to another.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
Do not g_assert for unhandled state changes; this is taken care of by
|
||||||
|
the GstElement base class.
|
||||||
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
static GstElementStateReturn
|
static GstElementStateReturn
|
||||||
gst_my_filter_change_state (GstElement *element);
|
gst_my_filter_change_state (GstElement *element);
|
||||||
|
|
|
@ -873,7 +873,6 @@ gst_fakesrc_change_state (GstElement * element)
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2914,6 +2914,7 @@ gst_element_change_state (GstElement * element)
|
||||||
old_pending = GST_STATE_PENDING (element);
|
old_pending = GST_STATE_PENDING (element);
|
||||||
old_transition = GST_STATE_TRANSITION (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 ||
|
if (old_pending == GST_STATE_VOID_PENDING ||
|
||||||
old_state == GST_STATE_PENDING (element)) {
|
old_state == GST_STATE_PENDING (element)) {
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
||||||
|
@ -2968,7 +2969,16 @@ gst_element_change_state (GstElement * element)
|
||||||
element->base_time = 0;
|
element->base_time = 0;
|
||||||
gst_element_clear_pad_caps (element);
|
gst_element_clear_pad_caps (element);
|
||||||
break;
|
break;
|
||||||
|
case GST_STATE_NULL_TO_READY:
|
||||||
|
case GST_STATE_READY_TO_NULL:
|
||||||
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -501,14 +501,6 @@ gst_thread_change_state (GstElement * element)
|
||||||
/* it should be dead now */
|
/* it should be dead now */
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,6 @@ gst_fakesrc_change_state (GstElement * element)
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue