- if (self->priv->base == G_TYPE_INVALID) {
- GST_WARNING ("not bound to a property yet");
- return FALSE;
- }
-
- switch (self->priv->base) {
- case G_TYPE_INT:
- csource->get_value = waveforms[waveform]->get_int;
- csource->get_value_array = waveforms[waveform]->get_int_value_array;
- break;
- case G_TYPE_UINT:{
- csource->get_value = waveforms[waveform]->get_uint;
- csource->get_value_array = waveforms[waveform]->get_uint_value_array;
- break;
- }
- case G_TYPE_LONG:{
- csource->get_value = waveforms[waveform]->get_long;
- csource->get_value_array = waveforms[waveform]->get_long_value_array;
- break;
- }
- case G_TYPE_ULONG:{
- csource->get_value = waveforms[waveform]->get_ulong;
- csource->get_value_array = waveforms[waveform]->get_ulong_value_array;
- break;
- }
- case G_TYPE_INT64:{
- csource->get_value = waveforms[waveform]->get_int64;
- csource->get_value_array = waveforms[waveform]->get_int64_value_array;
- break;
- }
- case G_TYPE_UINT64:{
- csource->get_value = waveforms[waveform]->get_uint64;
- csource->get_value_array = waveforms[waveform]->get_uint64_value_array;
- break;
- }
- case G_TYPE_FLOAT:{
- csource->get_value = waveforms[waveform]->get_float;
- csource->get_value_array = waveforms[waveform]->get_float_value_array;
- break;
- }
- case G_TYPE_DOUBLE:{
- csource->get_value = waveforms[waveform]->get_double;
- csource->get_value_array = waveforms[waveform]->get_double_value_array;
- break;
- }
- default:
- ret = FALSE;
- break;
- }
-
- if (ret)
- self->priv->waveform = waveform;
- else
- GST_WARNING ("incomplete implementation for type '%s'",
- GST_STR_NULL (g_type_name (self->priv->type)));
-
- return ret;
-}
-
-static gboolean
-gst_lfo_control_source_bind (GstControlSource * source, GParamSpec * pspec)
-{
- GType type, base;
- GstLFOControlSource *self = GST_LFO_CONTROL_SOURCE (source);
- gboolean ret = TRUE;
-
- /* get the fundamental base type */
- self->priv->type = base = type = G_PARAM_SPEC_VALUE_TYPE (pspec);
- while ((type = g_type_parent (type)))
- base = type;
-
- self->priv->base = base;
- /* restore type */
- type = self->priv->type;
-
- switch (base) {
- case G_TYPE_INT:{
- GParamSpecInt *tpspec = G_PARAM_SPEC_INT (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_int (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_int (&self->priv->maximum_value, tpspec->maximum);
-
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_int (&self->priv->amplitude, 0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_int (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_UINT:{
- GParamSpecUInt *tpspec = G_PARAM_SPEC_UINT (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_uint (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_uint (&self->priv->maximum_value, tpspec->maximum);
-
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_uint (&self->priv->amplitude, 0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_uint (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_LONG:{
- GParamSpecLong *tpspec = G_PARAM_SPEC_LONG (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_long (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_long (&self->priv->maximum_value, tpspec->maximum);
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_long (&self->priv->amplitude, 0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_long (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_ULONG:{
- GParamSpecULong *tpspec = G_PARAM_SPEC_ULONG (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_ulong (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_ulong (&self->priv->maximum_value, tpspec->maximum);
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_ulong (&self->priv->amplitude, 0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_ulong (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_INT64:{
- GParamSpecInt64 *tpspec = G_PARAM_SPEC_INT64 (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_int64 (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_int64 (&self->priv->maximum_value, tpspec->maximum);
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_int64 (&self->priv->amplitude, 0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_int64 (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_UINT64:{
- GParamSpecUInt64 *tpspec = G_PARAM_SPEC_UINT64 (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_uint64 (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_uint64 (&self->priv->maximum_value, tpspec->maximum);
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_uint64 (&self->priv->amplitude, 0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_uint64 (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_FLOAT:{
- GParamSpecFloat *tpspec = G_PARAM_SPEC_FLOAT (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_float (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_float (&self->priv->maximum_value, tpspec->maximum);
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_float (&self->priv->amplitude, 0.0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_float (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- case G_TYPE_DOUBLE:{
- GParamSpecDouble *tpspec = G_PARAM_SPEC_DOUBLE (pspec);
-
- g_value_init (&self->priv->minimum_value, type);
- g_value_set_double (&self->priv->minimum_value, tpspec->minimum);
- g_value_init (&self->priv->maximum_value, type);
- g_value_set_double (&self->priv->maximum_value, tpspec->maximum);
- if (!G_IS_VALUE (&self->priv->amplitude)) {
- g_value_init (&self->priv->amplitude, type);
- g_value_set_double (&self->priv->amplitude, 0.0);
- }
-
- if (!G_IS_VALUE (&self->priv->offset)) {
- g_value_init (&self->priv->offset, type);
- g_value_set_double (&self->priv->offset, tpspec->default_value);
- }
- break;
- }
- default:
- GST_WARNING ("incomplete implementation for paramspec type '%s'",
- G_PARAM_SPEC_TYPE_NAME (pspec));
- ret = FALSE;
- break;
- }
-
- if (ret) {
- GValue amp = { 0, }
- , off = {
- 0,};
-
- /* This should never fail unless the user already set amplitude or offset
- * with an incompatible type before _bind () */
- if (!g_value_type_transformable (G_VALUE_TYPE (&self->priv->amplitude),
- base)
- || !g_value_type_transformable (G_VALUE_TYPE (&self->priv->offset),
- base)) {
- GST_WARNING ("incompatible types for amplitude or offset");
- gst_lfo_control_source_reset (self);
- return FALSE;
- }
-
- /* Generate copies and transform to the correct type */
- g_value_init (&, base);
- g_value_transform (&self->priv->amplitude, &);
- g_value_init (&off, base);
- g_value_transform (&self->priv->offset, &off);
-
- ret = gst_lfo_control_source_set_waveform (self, self->priv->waveform);
-
- g_value_unset (&self->priv->amplitude);
- g_value_init (&self->priv->amplitude, self->priv->base);
- g_value_transform (&, &self->priv->amplitude);
-
- g_value_unset (&self->priv->offset);
- g_value_init (&self->priv->offset, self->priv->base);
- g_value_transform (&off, &self->priv->offset);
-
- g_value_unset (&);
- g_value_unset (&off);
- }