From 5f11755575796a27d6d90eb95dbb939209583fc4 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 28 Nov 2005 13:25:14 +0000 Subject: [PATCH] docs/random/ensonic/dparams.txt: some TODOs for the next dev cycle Original commit message from CVS: * docs/random/ensonic/dparams.txt: some TODOs for the next dev cycle * libs/gst/controller/gstcontroller.c: (gst_controlled_property_set_interpolation_mode), (gst_controlled_property_new): * libs/gst/controller/gstcontroller.h: use base type to assign acccessor functions --- ChangeLog | 10 ++++++ docs/random/ensonic/dparams.txt | 49 ++++++----------------------- libs/gst/controller/gstcontroller.c | 42 +++++++++++++------------ libs/gst/controller/gstcontroller.h | 1 + 4 files changed, 43 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0772482317..38a2edf0e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-11-28 Stefan Kost + + * docs/random/ensonic/dparams.txt: + some TODOs for the next dev cycle + * libs/gst/controller/gstcontroller.c: + (gst_controlled_property_set_interpolation_mode), + (gst_controlled_property_new): + * libs/gst/controller/gstcontroller.h: + use base type to assign acccessor functions + 2005-11-28 Jan Schmidt * check/Makefile.am: diff --git a/docs/random/ensonic/dparams.txt b/docs/random/ensonic/dparams.txt index 9c24d27887..9b2f4a81f2 100644 --- a/docs/random/ensonic/dparams.txt +++ b/docs/random/ensonic/dparams.txt @@ -1,43 +1,14 @@ $Id$ -* cleanup of dparams - * library "namespace" - * even though it is long try to stick to the prefix "dparam" for the whole library - * e.g. avoid namespace clashes with "dataprotocol" which is using "dp" as well :-( - * use a new namespace "ctrl" for control - * resolve g_return_if_fail() into GST_WARNING and return() - in cases where the caller has to handle the problem - * rename - GST_TYPE_DPSMOOTH to GST_TYPE_DPARAM_SMOOTH - GST_TYPE_DP_LININT to GST_TYPE_DPARAM_LININT - there seems to be nobody using them, as they still look unfinished - * move modes into extra modules - dparam_mode_synchronous - dparam_mode_asynchronous - dparam_mode_disabled - * split dparam manager api (like e.g. GConf does it) - * plugin api : GstCtrlManagerServer - * application api : GstCtrlManagerClient - * remove "value-changed" signal from DParam? - * one can connect to e.g. "notify::value-double" as well - * dparam update callback needs to pass more info - * GstElement as the first arg - * GstDPram as the second arg +* controller changes + * handling of G_TYPE_XXX is distributed over + gst-controller.c::gst_controlled_property_set_interpolation_mode() + gst-controller.c::gst_controlled_property_new + gst-interpolation.c + * it would be better to put handlers for each type into a struct + and register it into a hashmap with the G_TYPE as the key + * functions in gst-controller.c could try the key, + if no handler is registered the try the type_parent and so on -* documentation - * state of unitconvert - * state of sychronous params - * dpman_set/get_rate - if element_sampling_rate is 44100 and dpman_rate is 22050, dparams are updated twice a second - -* dparams ng - * concept for global, voice params - one plugin instance can repeate the processing for the same input, but with - different parameter sets (sound synthesizers, effects) - * based on gobject params, so that e.g. the GUI can connect to "notify:param" - events and update the GUI - * implement timelined dparams via queues - * the queue contains dparams and timestamps - * GST_DPARAM_DO_UPDATE() checks the head of the queue for events that are due now - and sets the values +* implement quadric/qubic interpolation diff --git a/libs/gst/controller/gstcontroller.c b/libs/gst/controller/gstcontroller.c index 3745bb54bf..78490c8f3e 100644 --- a/libs/gst/controller/gstcontroller.c +++ b/libs/gst/controller/gstcontroller.c @@ -170,12 +170,7 @@ 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) { + switch (self->base) { case G_TYPE_INT: self->get = interpolation_methods[mode]->get_int; self->get_value_array = @@ -215,19 +210,15 @@ gst_controlled_property_set_interpolation_mode (GstControlledProperty * self, self->get = interpolation_methods[mode]->get_uint; self->get_value_array = interpolation_methods[mode]->get_enum_value_array; + break; default: - 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; - } + self->get = NULL; + self->get_value_array = NULL; } if (!self->get) { /* || !self->get_value_array) */ - GST_WARNING ("incomplete implementation for type '%d':'%s'", self->type, - g_type_name (self->type)); + GST_WARNING ("incomplete implementation for type %d/%d:'%s'/'%s'", + self->type, self->base, + g_type_name (self->type), g_type_name (self->base)); res = FALSE; } } else { @@ -282,16 +273,24 @@ gst_controlled_property_new (GObject * object, const gchar * name) if ((prop = g_new0 (GstControlledProperty, 1))) { gchar *signal_name; + GType base; prop->name = pspec->name; /* so we don't use the same mem twice */ prop->type = G_PARAM_SPEC_VALUE_TYPE (pspec); - gst_controlled_property_set_interpolation_mode (prop, - GST_INTERPOLATE_NONE); + /* get the fundamental base type */ + prop->base = prop->type; + while ((base = g_type_parent (prop->base))) { + prop->base = base; + } + /* initialize mode specific accessor callbacks */ + if (!gst_controlled_property_set_interpolation_mode (prop, + GST_INTERPOLATE_NONE)) + goto Error; /* prepare our gvalues */ g_value_init (&prop->default_value, prop->type); g_value_init (&prop->result_value, prop->type); g_value_init (&prop->last_value.value, prop->type); - switch (prop->type) { + switch (prop->base) { case G_TYPE_INT:{ GParamSpecInt *tpspec = G_PARAM_SPEC_INT (pspec); @@ -360,8 +359,11 @@ gst_controlled_property_new (GObject * object, const gchar * name) GST_WARNING ("class '%s' has no property '%s'", G_OBJECT_TYPE_NAME (object), name); } - return (prop); +Error: + if (prop) + g_free (prop); + return (NULL); } /* diff --git a/libs/gst/controller/gstcontroller.h b/libs/gst/controller/gstcontroller.h index aececd6169..00e2208ce9 100644 --- a/libs/gst/controller/gstcontroller.h +++ b/libs/gst/controller/gstcontroller.h @@ -140,6 +140,7 @@ typedef struct _GstControlledProperty { gchar *name; /* name of the property */ GType type; /* type of the handled property */ + GType base; /* base-type of the handled property */ GValue default_value; /* default value for the handled property */ GValue result_value; /* result value location for the interpolation method */ GstTimedValue last_value; /* the last value a _sink call wrote */