catch wrong state changes in element base class
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 9 Jul 2004 11:20:59 +0000 (11:20 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 9 Jul 2004 11:20:59 +0000 (11:20 +0000)
Original commit message from CVS:
catch wrong state changes in element base class

ChangeLog
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/gstelement.c
gst/gstthread.c
plugins/elements/gstfakesrc.c

index 76d40cc..d795ca3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 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:
          clean up layout a little.
 
index d6e0772..6263b4e 100644 (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.
index 4b014d4..ce74670 100644 (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>
 
index b786243..dcf6af2 100644 (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>
index df6d564..4815015 100644 (file)
     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);
index fcb0036..78d4dab 100644 (file)
@@ -873,7 +873,6 @@ gst_fakesrc_change_state (GstElement * element)
     case GST_STATE_READY_TO_NULL:
       break;
     default:
-      g_assert_not_reached ();
       break;
   }
 
index e5f463d..d202484 100644 (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;
   }
 
index fe7aa24..c4357a6 100644 (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;
   }
 
index fcb0036..78d4dab 100644 (file)
@@ -873,7 +873,6 @@ gst_fakesrc_change_state (GstElement * element)
     case GST_STATE_READY_TO_NULL:
       break;
     default:
-      g_assert_not_reached ();
       break;
   }