Commit 7b347681 authored by Stefan Kost's avatar Stefan Kost

gst/gstelement.c: don't loop forever

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
parent 676421cf
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:
......
......@@ -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)) {
......
......@@ -48,6 +48,10 @@
* ...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;
......
......@@ -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 *
......
......@@ -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));
......
......@@ -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;
/**
......
......@@ -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
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment