gst/gstelement.c: don't loop forever
authorStefan Kost <ensonic@users.sourceforge.net>
Sun, 27 Nov 2005 22:43:08 +0000 (22:43 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Sun, 27 Nov 2005 22:43:08 +0000 (22:43 +0000)
Original commit message from CVS:
* gst/gstelement.c: (gst_element_dispose):
don't loop forever
* gst/gstiterator.c:
* gst/gststructure.c:
doc fixes
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(interpolate_none_get_enum_value_array):
support controlling enums

ChangeLog
gst/gstelement.c
gst/gstiterator.c
gst/gststructure.c
libs/gst/controller/gstcontroller.c
libs/gst/controller/gstcontroller.h
libs/gst/controller/gstinterpolation.c

index e4cc4d2bb4980001ad5601bc55d6e35fcdc69b68..fcf7d02642aa99ce5065bf5c6826faa3e682a0ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-11-27  Stefan Kost  <ensonic@users.sf.net>
+
+       * gst/gstelement.c: (gst_element_dispose):
+         don't loop forever
+
+       * gst/gstiterator.c:
+       * gst/gststructure.c:
+         doc fixes
+
+       * libs/gst/controller/gstcontroller.c:
+       (gst_controlled_property_set_interpolation_mode):
+       * libs/gst/controller/gstcontroller.h:
+       * libs/gst/controller/gstinterpolation.c:
+       (interpolate_none_get_enum_value_array):
+         support controlling enums
+
 2005-11-27  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/gstvalue.c:
index 19e5f2fad1cf8c05505abb48ebb1f6ce922d5610..e4196d47a503e9b49d78108198c155695a32efac 100644 (file)
@@ -2403,8 +2403,10 @@ gst_element_dispose (GObject * object)
   }
   g_return_if_fail (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING);
 
+  GST_DEBUG ("removing %d pads", g_list_length (element->pads));
   /* first we break all our links with the outside */
-  while (element->pads) {
+  while (element->pads && element->pads->data) {
+    /* don't call _remove_pad with NULL */
     gst_element_remove_pad (element, GST_PAD_CAST (element->pads->data));
   }
   if (G_UNLIKELY (element->pads != 0)) {
index c8659ababd03ceb46a99e4e1a61dc992346072ef..72acafffa0ac248202dbbd782d744e48be9baf92 100644 (file)
  *          ...rollback changes to items...
  *          gst_iterator_resync (it);
  *          break;
+ *        case GST_ITERATOR_ERROR:
+ *          ...wrong parameter were given...
+ *          done = TRUE;
+ *          break;
  *        case GST_ITERATOR_DONE:
  *          done = TRUE;
  *          break;
index 9485e3817bfc45ed03304b2dff9bb1a4a1bce531..51d79f40dcd66e07af6853408060ff85aea29919 100644 (file)
@@ -1341,7 +1341,7 @@ gst_structure_value_get_generic_type (GValue * val)
  *
  * Converts @structure to a human-readable string representation.
  *
- * Returns: a pointer to string allocated by g_malloc(). g_free after
+ * Returns: a pointer to string allocated by g_malloc(). g_free() after
  * usage.
  */
 gchar *
index 457d7196df1a54dc2588a0272cd6ce083686babe..3745bb54bf6fb6c5b0f39904ee7860e1e208bb39 100644 (file)
@@ -170,6 +170,11 @@ gst_controlled_property_set_interpolation_mode (GstControlledProperty * self,
 
   self->interpolation = mode;
   if (mode != GST_INTERPOLATE_USER) {
+    /* @todo: if it is not a fundamental type, recursively check parent
+     * until we found the fundamental one
+     * GType base=self->type;
+     * while( base=g_type_get_parent(self->base) ) self->base = base;
+     */
     switch (self->type) {
       case G_TYPE_INT:
         self->get = interpolation_methods[mode]->get_int;
@@ -206,13 +211,23 @@ gst_controlled_property_set_interpolation_mode (GstControlledProperty * self,
         self->get_value_array =
             interpolation_methods[mode]->get_boolean_value_array;
         break;
-        break;
+      case G_TYPE_ENUM:
+        self->get = interpolation_methods[mode]->get_uint;
+        self->get_value_array =
+            interpolation_methods[mode]->get_enum_value_array;
       default:
-        self->get = NULL;
-        self->get_value_array = NULL;
+        if (g_type_is_a (self->type, G_TYPE_ENUM)) {
+          self->get = interpolation_methods[mode]->get_uint;
+          self->get_value_array =
+              interpolation_methods[mode]->get_enum_value_array;
+        } else {
+          self->get = NULL;
+          self->get_value_array = NULL;
+        }
     }
     if (!self->get) {           /* || !self->get_value_array) */
-      GST_WARNING ("incomplete implementation for type '%d'", self->type);
+      GST_WARNING ("incomplete implementation for type '%d':'%s'", self->type,
+          g_type_name (self->type));
       res = FALSE;
     }
   } else {
@@ -318,6 +333,12 @@ gst_controlled_property_new (GObject * object, const gchar * name)
           g_value_set_boolean (&prop->default_value, tpspec->default_value);
         }
           break;
+        case G_TYPE_ENUM:{
+          GParamSpecEnum *tpspec = G_PARAM_SPEC_ENUM (pspec);
+
+          g_value_set_enum (&prop->default_value, tpspec->default_value);
+        }
+          break;
         default:
           GST_WARNING ("incomplete implementation for paramspec type '%s'",
               G_PARAM_SPEC_TYPE_NAME (pspec));
index 776ffd19945d3e5d032fd3b39ee57b2558da3f84..aececd61697a764ea646d716077c3ddb201ba589 100644 (file)
@@ -129,6 +129,8 @@ typedef struct _GstInterpolateMethod
   InterpolateGetValueArray get_double_value_array;
   InterpolateGet get_boolean;
   InterpolateGetValueArray get_boolean_value_array;
+  InterpolateGet get_enum;
+  InterpolateGetValueArray get_enum_value_array;
 } GstInterpolateMethod;
 
 /**
index 31e031f9631a04936d5489b0b028b7bf1bcb1e00..1cb8feec12b60e79745bd90ba52ca87e0d578615 100644 (file)
@@ -115,22 +115,41 @@ DEFINE_NONE_GET (float)
 DEFINE_NONE_GET (double)
 DEFINE_NONE_GET (boolean)
 
-     static GstInterpolateMethod interpolate_none = {
-       interpolate_none_get,
-       interpolate_none_get_int_value_array,
-       interpolate_none_get,
-       interpolate_none_get_uint_value_array,
-       interpolate_none_get,
-       interpolate_none_get_long_value_array,
-       interpolate_none_get,
-       interpolate_none_get_ulong_value_array,
-       interpolate_none_get,
-       interpolate_none_get_float_value_array,
-       interpolate_none_get,
-       interpolate_none_get_double_value_array,
-       interpolate_none_get,
-       interpolate_none_get_boolean_value_array
-     };
+     static gboolean
+         interpolate_none_get_enum_value_array (GstControlledProperty * prop,
+    GstClockTime timestamp, GstValueArray * value_array)
+{
+  gint i;
+  GstClockTime ts = timestamp;
+  gint *values = (gint *) value_array->values;
+
+  for (i = 0; i < value_array->nbsamples; i++) {
+    *values = g_value_get_enum (interpolate_none_get (prop, ts));
+    ts += value_array->sample_interval;
+    values++;
+  }
+  return (TRUE);
+}
+
+
+static GstInterpolateMethod interpolate_none = {
+  interpolate_none_get,
+  interpolate_none_get_int_value_array,
+  interpolate_none_get,
+  interpolate_none_get_uint_value_array,
+  interpolate_none_get,
+  interpolate_none_get_long_value_array,
+  interpolate_none_get,
+  interpolate_none_get_ulong_value_array,
+  interpolate_none_get,
+  interpolate_none_get_float_value_array,
+  interpolate_none_get,
+  interpolate_none_get_double_value_array,
+  interpolate_none_get,
+  interpolate_none_get_boolean_value_array,
+  interpolate_none_get,
+  interpolate_none_get_enum_value_array
+};
 
 /*  returns the default value of the property, except for times with specific values */
 /*  needed for one-shot events, such as notes and triggers */
@@ -173,6 +192,8 @@ static GstInterpolateMethod interpolate_trigger = {
   interpolate_trigger_get,
   NULL,
   interpolate_trigger_get,
+  NULL,
+  interpolate_trigger_get,
   NULL
 };
 
@@ -253,6 +274,8 @@ DEFINE_LINEAR_GET (double)
        interpolate_linear_get_double,
        interpolate_linear_get_double_value_array,
        NULL,
+       NULL,
+       NULL,
        NULL
      };