controller: merge controller into gstobject
authorStefan Sauer <ensonic@users.sf.net>
Thu, 10 Nov 2011 17:37:28 +0000 (19:37 +0200)
committerStefan Sauer <ensonic@users.sf.net>
Thu, 10 Nov 2011 20:47:07 +0000 (22:47 +0200)
This make the controller even more lightweight (no extra object, no extra lock,
less indirections). For object that don't use the controller the only 'overhead'
is a 3 unused fields in the gst_object structure.

14 files changed:
docs/gst/gstreamer-docs.sgml
docs/gst/gstreamer-sections.txt
docs/gst/gstreamer.types.in
docs/random/porting-to-0.11.txt
gst/Makefile.am
gst/gst.h
gst/gstcontroller.c [deleted file]
gst/gstcontroller.h [deleted file]
gst/gstcontrolsource.c
gst/gstobject.c
gst/gstobject.h
tests/benchmarks/controller.c
tests/check/libs/controller.c
tests/examples/controller/audio-example.c

index 2efc2b2..e03fbc3 100644 (file)
@@ -67,7 +67,6 @@ Windows.  It is released under the GNU Library General Public License
     <xi:include href="xml/gstchildproxy.xml" />
     <xi:include href="xml/gstclock.xml" />
     <xi:include href="xml/gstconfig.xml" />
-    <xi:include href="xml/gstcontroller.xml" />
     <xi:include href="xml/gstcontrolsource.xml" />
     <xi:include href="xml/gstdatetime.xml" />
     <xi:include href="xml/gstelement.xml" />
index 482663b..5ab04e8 100644 (file)
@@ -556,41 +556,6 @@ GST_PADDING_INIT
 GST_USING_PRINTF_EXTENSION
 </SECTION>
 
-<SECTION>
-<FILE>gstcontroller</FILE>
-<TITLE>GstController</TITLE>
-GstController
-gst_controller_new
-gst_controller_new_list
-gst_controller_new_valist
-gst_controller_add_properties
-gst_controller_add_properties_list
-gst_controller_add_properties_valist
-gst_controller_remove_properties
-gst_controller_remove_properties_list
-gst_controller_remove_properties_valist
-gst_controller_is_active
-gst_controller_set_disabled
-gst_controller_set_property_disabled
-gst_controller_suggest_next_sync
-gst_controller_sync_values
-gst_controller_get_control_source
-gst_controller_set_control_source
-gst_controller_get
-gst_controller_get_value_arrays
-gst_controller_get_value_array
-<SUBSECTION Standard>
-GstControllerClass
-GstControllerPrivate
-GST_CONTROLLER
-GST_IS_CONTROLLER
-GST_CONTROLLER_CLASS
-GST_IS_CONTROLLER_CLASS
-GST_CONTROLLER_GET_CLASS
-GST_TYPE_CONTROLLER
-<SUBSECTION Private>
-gst_controller_get_type
-</SECTION>
 
 <SECTION>
 <FILE>gstcontrolsource</FILE>
@@ -1568,9 +1533,9 @@ gst_object_control_properties
 gst_object_uncontrol_properties
 gst_object_suggest_next_sync
 gst_object_sync_values
-gst_object_has_active_automation
-gst_object_set_automation_disabled
-gst_object_set_property_automation_disabled
+gst_object_has_active_controlled_properties
+gst_object_set_controlled_properties_disabled
+gst_object_set_controlled_property_disabled
 gst_object_get_control_source
 gst_object_set_control_source
 gst_object_get_value
index 696a6a7..4bf9129 100644 (file)
@@ -12,7 +12,6 @@ gst_bin_get_type
 gst_bus_get_type
 gst_child_proxy_get_type
 gst_clock_get_type
-gst_controller_get_type
 gst_control_source_get_type
 gst_element_factory_get_type
 gst_element_get_type
index 40824fe..01b1b79 100644 (file)
@@ -399,3 +399,18 @@ The 0.11 porting guide
     gst_tag_list_new() has been renamed to gst_tag_list_new_empty().
     gst_tag_list_new_full*() have been renamed to gst_tag_list_new*().
 
+* GstController:
+    has now been merged into GstObject. The control sources are in the 
+    controller library still.
+    
+    For plugins the effect is that gst_controller_init() is gone and
+    gst_object_sync_values() is taking a GstObject * instead of GObject *.
+    
+    For applications the effect is larger. The whole gst_controller_* API is
+    gone and now available in simplified form under gst_object_*.
+    
+    gst_controller_new* -> gst_object_control_properties
+    gst_controller_add_properties -> gst_object_control_properties
+    gst_controller_set_control_source -> gst_object_set_control_source
+    gst_controller_get_control_source -> gst_object_get_control_source
+    gst_controller_set_property_disabled -> gst_object_set_controlled_property_disabled
index c6ae827..5e43042 100644 (file)
@@ -56,7 +56,6 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
        gstcaps.c               \
        gstchildproxy.c         \
        gstclock.c              \
-       gstcontroller.c \
        gstcontrolsource.c \
        gstdatetime.c           \
        gstdebugutils.c         \
@@ -150,7 +149,6 @@ gst_headers =                       \
        gstchildproxy.h         \
        gstclock.h              \
        gstcompat.h             \
-       gstcontroller.h \
        gstcontrolsource.h \
        gstdatetime.h           \
        gstdebugutils.h         \
index cd26f0f..3fb6ec5 100644 (file)
--- a/gst/gst.h
+++ b/gst/gst.h
@@ -44,7 +44,6 @@
 #include <gst/gstcaps.h>
 #include <gst/gstchildproxy.h>
 #include <gst/gstclock.h>
-#include <gst/gstcontroller.h>
 #include <gst/gstcontrolsource.h>
 #include <gst/gstdatetime.h>
 #include <gst/gstdebugutils.h>
diff --git a/gst/gstcontroller.c b/gst/gstcontroller.c
deleted file mode 100644 (file)
index 5e43fdb..0000000
+++ /dev/null
@@ -1,1042 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2005 Stefan Kost <ensonic at users dot sf dot net>
- *               2007 Sebastian Dröge <slomo@circular-chaos.org>
- *               2011 Stefan Sauer <ensonic at users dot sf dot net>
- *
- * gstcontroller.c: dynamic parameter control subsystem
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstcontroller
- * @short_description: dynamic parameter control subsystem
- *
- * The controller subsystem offers a lightweight way to adjust gobject
- * properties over stream-time. It works by using time-stamped value pairs that
- * are queued for element-properties. At run-time the elements continously pull
- * values changes for the current stream-time.
- *
- * What needs to be changed in a #GstElement?
- * Very little - it is just two steps to make a plugin controllable!
- * <orderedlist>
- *   <listitem><para>
- *     mark gobject-properties paramspecs that make sense to be controlled,
- *     by GST_PARAM_CONTROLLABLE.
- *   </para></listitem>
- *   <listitem><para>
- *     when processing data (get, chain, loop function) at the beginning call
- *     gst_object_sync_values(element,timestamp).
- *     This will made the controller to update all gobject properties that are under
- *     control with the current values based on timestamp.
- *   </para></listitem>
- * </orderedlist>
- *
- * What needs to be done in applications?
- * Again its not a lot to change.
- * <orderedlist>
- *   <listitem><para>
- *     first put some properties under control, by calling
- *     controller = gst_object_control_properties (object, "prop1", "prop2",...);
- *   </para></listitem>
- *   <listitem><para>
- *     create a #GstControlSource.
- *     csource = gst_interpolation_control_source_new ();
- *     gst_interpolation_control_source_set_interpolation_mode(csource, mode);
- *   </para></listitem>
- *   <listitem><para>
- *     Attach the #GstControlSource on the controller to a property.
- *     gst_controller_set_control_source (controller, "prop1", csource);
- *   </para></listitem>
- *   <listitem><para>
- *     Set the control values
- *     gst_interpolation_control_source_set (csource,0 * GST_SECOND, value1);
- *     gst_interpolation_control_source_set (csource,1 * GST_SECOND, value2);
- *   </para></listitem>
- *   <listitem><para>
- *     start your pipeline
- *   </para></listitem>
- * </orderedlist>
- */
-
-#include "gst_private.h"
-
-#include "gstobject.h"
-#include "gstclock.h"
-#include "gstinfo.h"
-#include "gstcontroller.h"
-#include "gstcontrolsource.h"
-#include "gstparamspecs.h"
-
-#define GST_CAT_DEFAULT controller_debug
-GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
-
-static GObjectClass *parent_class = NULL;
-
-/* property ids */
-enum
-{
-  PROP_CONTROL_RATE = 1
-};
-
-struct _GstControllerPrivate
-{
-  GstClockTime control_rate;
-  GstClockTime last_sync;
-};
-
-/* helper */
-
-/*
- * GstControlledProperty:
- */
-typedef struct _GstControlledProperty
-{
-  GParamSpec *pspec;            /* GParamSpec for this property */
-  const gchar *name;            /* name of the property */
-  GstControlSource *csource;    /* GstControlSource for this property */
-  gboolean disabled;
-  GValue last_value;
-} GstControlledProperty;
-
-#define GST_CONTROLLED_PROPERTY(obj)    ((GstControlledProperty *)(obj))
-
-/*
- * gst_controlled_property_new:
- * @object: for which object the controlled property should be set up
- * @name: the name of the property to be controlled
- *
- * Private method which initializes the fields of a new controlled property
- * structure.
- *
- * Returns: a freshly allocated structure or %NULL
- */
-static GstControlledProperty *
-gst_controlled_property_new (GstObject * object, const gchar * name)
-{
-  GstControlledProperty *prop = NULL;
-  GParamSpec *pspec;
-
-  GST_INFO ("trying to put property '%s' under control", name);
-
-  /* check if the object has a property of that name */
-  if ((pspec =
-          g_object_class_find_property (G_OBJECT_GET_CLASS (object), name))) {
-    GST_DEBUG ("  psec->flags : 0x%08x", pspec->flags);
-
-    /* check if this param is witable && controlable && !construct-only */
-    g_return_val_if_fail ((pspec->flags & (G_PARAM_WRITABLE |
-                GST_PARAM_CONTROLLABLE | G_PARAM_CONSTRUCT_ONLY)) ==
-        (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE), NULL);
-
-    if ((prop = g_slice_new (GstControlledProperty))) {
-      prop->pspec = pspec;
-      prop->name = pspec->name;
-      prop->csource = NULL;
-      prop->disabled = FALSE;
-      memset (&prop->last_value, 0, sizeof (GValue));
-      g_value_init (&prop->last_value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
-    }
-  } else {
-    GST_WARNING ("class '%s' has no property '%s'", G_OBJECT_TYPE_NAME (object),
-        name);
-  }
-  return prop;
-}
-
-/*
- * gst_controlled_property_free:
- * @prop: the object to free
- *
- * Private method which frees all data allocated by a #GstControlledProperty
- * instance.
- */
-static void
-gst_controlled_property_free (GstControlledProperty * prop)
-{
-  if (prop->csource)
-    g_object_unref (prop->csource);
-  g_value_unset (&prop->last_value);
-  g_slice_free (GstControlledProperty, prop);
-}
-
-/*
- * gst_controller_find_controlled_property:
- * @self: the controller object to search for a property in
- * @name: the gobject property name to look for
- *
- * Searches the list of properties under control.
- *
- * Returns: a #GstControlledProperty object of %NULL if the property is not
- * being controlled.
- */
-static GstControlledProperty *
-gst_controller_find_controlled_property (GstController * self,
-    const gchar * name)
-{
-  GstControlledProperty *prop;
-  GList *node;
-
-  for (node = self->properties; node; node = g_list_next (node)) {
-    prop = node->data;
-    /* FIXME: eventually use GQuark to speed it up */
-    if (!strcmp (prop->name, name)) {
-      return prop;
-    }
-  }
-  GST_DEBUG ("controller does not (yet) manage property '%s'", name);
-
-  return NULL;
-}
-
-/*
- * gst_controller_add_property:
- * @self: the controller object
- * @name: name of projecty in @object
- *
- * Creates a new #GstControlledProperty if there is none for property @name yet.
- *
- * Returns: %TRUE if the property has been added to the controller
- */
-static gboolean
-gst_controller_add_property (GstController * self, const gchar * name)
-{
-  gboolean res = TRUE;
-
-  /* test if this property isn't yet controlled */
-  if (!gst_controller_find_controlled_property (self, name)) {
-    GstControlledProperty *prop;
-
-    /* create GstControlledProperty and add to self->properties list */
-    if ((prop = gst_controlled_property_new (self->object, name))) {
-      self->properties = g_list_prepend (self->properties, prop);
-      GST_DEBUG_OBJECT (self->object, "property %s added", name);
-    } else
-      res = FALSE;
-  } else {
-    GST_WARNING_OBJECT (self->object, "trying to control property %s again",
-        name);
-  }
-  return res;
-}
-
-/*
- * gst_controller_remove_property:
- * @self: the controller object
- * @name: name of projecty in @object
- *
- * Removes a #GstControlledProperty for property @name.
- *
- * Returns: %TRUE if the property has been removed from the controller
- */
-static gboolean
-gst_controller_remove_property (GstController * self, const gchar * name)
-{
-  gboolean res = TRUE;
-  GstControlledProperty *prop;
-
-  if ((prop = gst_controller_find_controlled_property (self, name))) {
-    self->properties = g_list_remove (self->properties, prop);
-    //g_signal_handler_disconnect (self->object, prop->notify_handler_id);
-    gst_controlled_property_free (prop);
-    GST_DEBUG_OBJECT (self->object, "property %s removed", name);
-  } else {
-    res = FALSE;
-  }
-  return res;
-}
-
-/* methods */
-
-/**
- * gst_controller_new_valist:
- * @object: the object of which some properties should be controlled
- * @var_args: %NULL terminated list of property names that should be controlled
- *
- * Creates a new GstController for the given object's properties
- *
- * Returns: the new controller.
- */
-GstController *
-gst_controller_new_valist (GstObject * object, va_list var_args)
-{
-  GstController *self;
-  gchar *name;
-
-  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
-
-  /* FIXME: storing the controller into the object is ugly
-   * we'd like to make the controller object completely internal
-   */
-  self = g_object_newv (GST_TYPE_CONTROLLER, 0, NULL);
-  self->object = g_object_ref (object);
-  object->ctrl = g_object_ref (self);
-
-  /* create GstControlledProperty for each property */
-  while ((name = va_arg (var_args, gchar *))) {
-    gst_controller_add_property (self, name);
-  }
-  va_end (var_args);
-
-  return self;
-}
-
-/**
- * gst_controller_new_list:
- * @object: the object of which some properties should be controlled
- * @list: (transfer none) (element-type utf8): list of property names
- *   that should be controlled
- *
- * Creates a new GstController for the given object's properties
- *
- * Rename to: gst_controller_new
- *
- * Returns: the new controller.
- */
-GstController *
-gst_controller_new_list (GstObject * object, GList * list)
-{
-  GstController *self;
-  gchar *name;
-  GList *node;
-
-  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
-
-  self = g_object_newv (GST_TYPE_CONTROLLER, 0, NULL);
-  self->object = g_object_ref (object);
-  object->ctrl = g_object_ref (self);
-
-  /* create GstControlledProperty for each property */
-  for (node = list; node; node = g_list_next (node)) {
-    name = (gchar *) node->data;
-    gst_controller_add_property (self, name);
-  }
-
-  return self;
-}
-
-/**
- * gst_controller_new:
- * @object: the object of which some properties should be controlled
- * @...: %NULL terminated list of property names that should be controlled
- *
- * Creates a new GstController for the given object's properties
- *
- * Returns: the new controller.
- */
-GstController *
-gst_controller_new (GstObject * object, ...)
-{
-  GstController *self;
-  va_list var_args;
-
-  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
-
-  va_start (var_args, object);
-  self = gst_controller_new_valist (object, var_args);
-  va_end (var_args);
-
-  return self;
-}
-
-// FIXME: docs
-gboolean
-gst_controller_add_properties_valist (GstController * self, va_list var_args)
-{
-  gboolean res = TRUE;
-  gchar *name;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  while ((name = va_arg (var_args, gchar *))) {
-    /* find the property in the properties list of the controller, remove and free it */
-    g_mutex_lock (self->lock);
-    res &= gst_controller_add_property (self, name);
-    g_mutex_unlock (self->lock);
-  }
-
-  return res;
-}
-
-// FIXME: docs
-gboolean
-gst_controller_add_properties_list (GstController * self, GList * list)
-{
-  gboolean res = TRUE;
-  gchar *name;
-  GList *tmp;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  for (tmp = list; tmp; tmp = g_list_next (tmp)) {
-    name = (gchar *) tmp->data;
-
-    /* find the property in the properties list of the controller, remove and free it */
-    g_mutex_lock (self->lock);
-    res &= gst_controller_add_property (self, name);
-    g_mutex_unlock (self->lock);
-  }
-
-  return res;
-}
-
-// FIXME: docs
-gboolean
-gst_controller_add_properties (GstController * self, ...)
-{
-  gboolean res;
-  va_list var_args;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  va_start (var_args, self);
-  res = gst_controller_add_properties_valist (self, var_args);
-  va_end (var_args);
-
-  return res;
-}
-
-/**
- * gst_controller_remove_properties_valist:
- * @self: the controller object from which some properties should be removed
- * @var_args: %NULL terminated list of property names that should be removed
- *
- * Removes the given object properties from the controller
- *
- * Returns: %FALSE if one of the given property isn't handled by the controller, %TRUE otherwise
- */
-gboolean
-gst_controller_remove_properties_valist (GstController * self, va_list var_args)
-{
-  gboolean res = TRUE;
-  gchar *name;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  while ((name = va_arg (var_args, gchar *))) {
-    /* find the property in the properties list of the controller, remove and free it */
-    g_mutex_lock (self->lock);
-    res &= gst_controller_remove_property (self, name);
-    g_mutex_unlock (self->lock);
-  }
-
-  return res;
-}
-
-/**
- * gst_controller_remove_properties_list:
- * @self: the controller object from which some properties should be removed
- * @list: (transfer none) (element-type utf8): #GList of property names that
- *   should be removed
- *
- * Removes the given object properties from the controller
- *
- * Rename to: gst_controller_remove_properties
- *
- * Returns: %FALSE if one of the given property isn't handled by the controller, %TRUE otherwise
- */
-gboolean
-gst_controller_remove_properties_list (GstController * self, GList * list)
-{
-  gboolean res = TRUE;
-  gchar *name;
-  GList *tmp;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  for (tmp = list; tmp; tmp = g_list_next (tmp)) {
-    name = (gchar *) tmp->data;
-
-    /* find the property in the properties list of the controller, remove and free it */
-    g_mutex_lock (self->lock);
-    res &= gst_controller_remove_property (self, name);
-    g_mutex_unlock (self->lock);
-  }
-
-  return res;
-}
-
-/**
- * gst_controller_remove_properties:
- * @self: the controller object from which some properties should be removed
- * @...: %NULL terminated list of property names that should be removed
- *
- * Removes the given object properties from the controller
- *
- * Returns: %FALSE if one of the given property isn't handled by the controller, %TRUE otherwise
- */
-gboolean
-gst_controller_remove_properties (GstController * self, ...)
-{
-  gboolean res;
-  va_list var_args;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  va_start (var_args, self);
-  res = gst_controller_remove_properties_valist (self, var_args);
-  va_end (var_args);
-
-  return res;
-}
-
-/**
- * gst_controller_is_active:
- * @self: the #GstController which should be disabled
- *
- * Check if the controller is active. It is active if it has at least one
- * controlled property that is not disabled.
- *
- * Returns: %TRUE if the controller is active
- */
-gboolean
-gst_controller_is_active (GstController * self)
-{
-  gboolean active = FALSE;
-  GList *node;
-  GstControlledProperty *prop;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-
-  g_mutex_lock (self->lock);
-  for (node = self->properties; node; node = node->next) {
-    prop = node->data;
-    active |= !prop->disabled;
-  }
-  g_mutex_unlock (self->lock);
-
-  return active;
-}
-
-/**
- * gst_controller_set_property_disabled:
- * @self: the #GstController which should be disabled
- * @property_name: property to disable
- * @disabled: boolean that specifies whether to disable the controller
- * or not.
- *
- * This function is used to disable the #GstController on a property for
- * some time, i.e. gst_controller_sync_values() will do nothing for the
- * property.
- */
-void
-gst_controller_set_property_disabled (GstController * self,
-    const gchar * property_name, gboolean disabled)
-{
-  GstControlledProperty *prop;
-
-  g_return_if_fail (GST_IS_CONTROLLER (self));
-  g_return_if_fail (property_name);
-
-  g_mutex_lock (self->lock);
-  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
-    prop->disabled = disabled;
-  }
-  g_mutex_unlock (self->lock);
-}
-
-/**
- * gst_controller_set_disabled:
- * @self: the #GstController which should be disabled
- * @disabled: boolean that specifies whether to disable the controller
- * or not.
- *
- * This function is used to disable all properties of the #GstController
- * for some time, i.e. gst_controller_sync_values() will do nothing.
- */
-
-void
-gst_controller_set_disabled (GstController * self, gboolean disabled)
-{
-  GList *node;
-  GstControlledProperty *prop;
-
-  g_return_if_fail (GST_IS_CONTROLLER (self));
-
-  g_mutex_lock (self->lock);
-  for (node = self->properties; node; node = node->next) {
-    prop = node->data;
-    prop->disabled = disabled;
-  }
-  g_mutex_unlock (self->lock);
-}
-
-/**
- * gst_controller_set_control_source:
- * @self: the controller object
- * @property_name: name of the property for which the #GstControlSource should be set
- * @csource: the #GstControlSource that should be used for the property
- *
- * Sets the #GstControlSource for @property_name. If there already was a #GstControlSource
- * for this property it will be unreferenced.
- *
- * Returns: %FALSE if the given property isn't handled by the controller or the new #GstControlSource
- * couldn't be bound to the property, %TRUE if everything worked as expected.
- */
-gboolean
-gst_controller_set_control_source (GstController * self,
-    const gchar * property_name, GstControlSource * csource)
-{
-  GstControlledProperty *prop;
-  gboolean ret = FALSE;
-
-  g_mutex_lock (self->lock);
-  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
-    GstControlSource *old = prop->csource;
-
-    if (csource && (ret = gst_control_source_bind (csource, prop->pspec))) {
-      g_object_ref (csource);
-      prop->csource = csource;
-    } else if (!csource) {
-      ret = TRUE;
-      prop->csource = NULL;
-    }
-
-    if (ret && old)
-      g_object_unref (old);
-  }
-  g_mutex_unlock (self->lock);
-
-  return ret;
-}
-
-/**
- * gst_controller_get_control_source:
- * @self: the controller object
- * @property_name: name of the property for which the #GstControlSource should be get
- *
- * Gets the corresponding #GstControlSource for the property. This should be unreferenced
- * again after use.
- *
- * Returns: (transfer full): the #GstControlSource for @property_name or NULL if
- * the property is not controlled by this controller or no #GstControlSource was
- * assigned yet.
- */
-GstControlSource *
-gst_controller_get_control_source (GstController * self,
-    const gchar * property_name)
-{
-  GstControlledProperty *prop;
-  GstControlSource *ret = NULL;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), NULL);
-  g_return_val_if_fail (property_name, NULL);
-
-  g_mutex_lock (self->lock);
-  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
-    ret = prop->csource;
-  }
-  g_mutex_unlock (self->lock);
-
-  if (ret)
-    g_object_ref (ret);
-
-  return ret;
-}
-
-/**
- * gst_controller_get:
- * @self: the controller object which handles the properties
- * @property_name: the name of the property to get
- * @timestamp: the time the control-change should be read from
- *
- * Gets the value for the given controller-handled property at the requested
- * time.
- *
- * Returns: the GValue of the property at the given time, or %NULL if the
- * property isn't handled by the controller
- */
-GValue *
-gst_controller_get (GstController * self, const gchar * property_name,
-    GstClockTime timestamp)
-{
-  GstControlledProperty *prop;
-  GValue *val = NULL;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), NULL);
-  g_return_val_if_fail (property_name, NULL);
-  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), NULL);
-
-  g_mutex_lock (self->lock);
-  if ((prop = gst_controller_find_controlled_property (self, property_name))) {
-    val = g_new0 (GValue, 1);
-    g_value_init (val, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
-    if (prop->csource) {
-      gboolean res;
-
-      /* get current value via control source */
-      res = gst_control_source_get_value (prop->csource, timestamp, val);
-      if (!res) {
-        g_free (val);
-        val = NULL;
-      }
-    } else {
-      g_object_get_property ((GObject *) self->object, prop->name, val);
-    }
-  }
-  g_mutex_unlock (self->lock);
-
-  return val;
-}
-
-/**
- * gst_controller_suggest_next_sync:
- * @self: the controller that handles the values
- *
- * Returns a suggestion for timestamps where buffers should be split
- * to get best controller results.
- *
- * Returns: Returns the suggested timestamp or %GST_CLOCK_TIME_NONE
- * if no control-rate was set.
- */
-GstClockTime
-gst_controller_suggest_next_sync (GstController * self)
-{
-  GstClockTime ret;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), GST_CLOCK_TIME_NONE);
-  g_return_val_if_fail (self->priv->control_rate != GST_CLOCK_TIME_NONE,
-      GST_CLOCK_TIME_NONE);
-
-  g_mutex_lock (self->lock);
-
-  /* TODO: Implement more logic, depending on interpolation mode
-   * and control points
-   * FIXME: we need playback direction
-   */
-  ret = self->priv->last_sync + self->priv->control_rate;
-
-  g_mutex_unlock (self->lock);
-
-  return ret;
-}
-
-/**
- * gst_controller_sync_values:
- * @self: the controller that handles the values
- * @timestamp: the time that should be processed
- *
- * Sets the properties of the element, according to the controller that (maybe)
- * handles them and for the given timestamp.
- *
- * If this function fails, it is most likely the application developers fault.
- * Most probably the control sources are not setup correctly.
- *
- * Returns: %TRUE if the controller values could be applied to the object
- * properties, %FALSE otherwise
- */
-gboolean
-gst_controller_sync_values (GstController * self, GstClockTime timestamp)
-{
-  GstControlledProperty *prop;
-  GList *node;
-  gboolean ret = TRUE, val_ret;
-  GValue value = { 0, };
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
-
-  GST_LOG ("sync_values");
-
-  g_mutex_lock (self->lock);
-  g_object_freeze_notify ((GObject *) self->object);
-  /* go over the controlled properties of the controller */
-  for (node = self->properties; node; node = g_list_next (node)) {
-    prop = node->data;
-
-    if (!prop->csource || prop->disabled)
-      continue;
-
-    GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp);
-
-    /* we can make this faster
-     * http://bugzilla.gnome.org/show_bug.cgi?id=536939
-     */
-    g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
-    val_ret = gst_control_source_get_value (prop->csource, timestamp, &value);
-    if (G_LIKELY (val_ret)) {
-      /* always set the value for first time, but then only if it changed
-       * this should limit g_object_notify invocations.
-       * FIXME: can we detect negative playback rates?
-       */
-      if ((timestamp < self->priv->last_sync) ||
-          gst_value_compare (&value, &prop->last_value) != GST_VALUE_EQUAL) {
-        g_object_set_property ((GObject *) self->object, prop->name, &value);
-        g_value_copy (&value, &prop->last_value);
-      }
-    } else {
-      GST_DEBUG ("no control value for param %s", prop->name);
-    }
-    g_value_unset (&value);
-    ret &= val_ret;
-  }
-  self->priv->last_sync = timestamp;
-  g_object_thaw_notify ((GObject *) self->object);
-
-  g_mutex_unlock (self->lock);
-
-  return ret;
-}
-
-/**
- * gst_controller_get_value_arrays:
- * @self: the controller that handles the values
- * @timestamp: the time that should be processed
- * @value_arrays: list to return the control-values in
- *
- * Function to be able to get an array of values for one or more given element
- * properties.
- *
- * All fields of the %GstValueArray in the list must be filled correctly.
- * Especially the GstValueArray->values arrays must be big enough to keep
- * the requested amount of values.
- *
- * The types of the values in the array are the same as the property's type.
- *
- * <note><para>This doesn't modify the controlled GObject properties!</para></note>
- *
- * Returns: %TRUE if the given array(s) could be filled, %FALSE otherwise
- */
-gboolean
-gst_controller_get_value_arrays (GstController * self,
-    GstClockTime timestamp, GSList * value_arrays)
-{
-  gboolean res = TRUE;
-  GSList *node;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
-  g_return_val_if_fail (value_arrays, FALSE);
-
-  for (node = value_arrays; (res && node); node = g_slist_next (node)) {
-    res = gst_controller_get_value_array (self, timestamp, node->data);
-  }
-
-  return (res);
-}
-
-/**
- * gst_controller_get_value_array:
- * @self: the controller that handles the values
- * @timestamp: the time that should be processed
- * @value_array: array to put control-values in
- *
- * Function to be able to get an array of values for one element property.
- *
- * All fields of @value_array must be filled correctly. Especially the
- * @value_array->values array must be big enough to keep the requested amount
- * of values (as indicated by the nbsamples field).
- *
- * The type of the values in the array is the same as the property's type.
- *
- * <note><para>This doesn't modify the controlled GObject property!</para></note>
- *
- * Returns: %TRUE if the given array could be filled, %FALSE otherwise
- */
-gboolean
-gst_controller_get_value_array (GstController * self, GstClockTime timestamp,
-    GstValueArray * value_array)
-{
-  gboolean res = FALSE;
-  GstControlledProperty *prop;
-
-  g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
-  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
-  g_return_val_if_fail (value_array, FALSE);
-  g_return_val_if_fail (value_array->property_name, FALSE);
-  g_return_val_if_fail (value_array->values, FALSE);
-
-  g_mutex_lock (self->lock);
-
-  if ((prop =
-          gst_controller_find_controlled_property (self,
-              value_array->property_name))) {
-    /* get current value_array via control source */
-
-    if (!prop->csource)
-      goto out;
-
-    res =
-        gst_control_source_get_value_array (prop->csource, timestamp,
-        value_array);
-  }
-
-out:
-  g_mutex_unlock (self->lock);
-  return res;
-}
-
-/* gobject handling */
-
-static void
-_gst_controller_get_property (GObject * object, guint property_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstController *self = GST_CONTROLLER (object);
-
-  switch (property_id) {
-    case PROP_CONTROL_RATE:{
-      /* FIXME: don't change if element is playing, controller works for GObject
-         so this wont work
-
-         GstState c_state, p_state;
-         GstStateChangeReturn ret;
-
-         ret = gst_element_get_state (self->object, &c_state, &p_state, 0);
-         if ((ret == GST_STATE_CHANGE_SUCCESS &&
-         (c_state == GST_STATE_NULL || c_state == GST_STATE_READY)) ||
-         (ret == GST_STATE_CHANGE_ASYNC &&
-         (p_state == GST_STATE_NULL || p_state == GST_STATE_READY))) {
-       */
-      g_value_set_uint64 (value, self->priv->control_rate);
-      /*
-         }
-         else {
-         GST_WARNING ("Changing the control rate is only allowed if the elemnt"
-         " is in NULL or READY");
-         }
-       */
-    }
-      break;
-    default:{
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-    }
-      break;
-  }
-}
-
-/* sets the given properties for this object */
-static void
-_gst_controller_set_property (GObject * object, guint property_id,
-    const GValue * value, GParamSpec * pspec)
-{
-  GstController *self = GST_CONTROLLER (object);
-
-  switch (property_id) {
-    case PROP_CONTROL_RATE:{
-      self->priv->control_rate = g_value_get_uint64 (value);
-    }
-      break;
-    default:{
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-    }
-      break;
-  }
-}
-
-static void
-_gst_controller_dispose (GObject * object)
-{
-  GstController *self = GST_CONTROLLER (object);
-
-  if (self->object != NULL) {
-    g_mutex_lock (self->lock);
-    /* free list of properties */
-    if (self->properties) {
-      GList *node;
-
-      for (node = self->properties; node; node = g_list_next (node)) {
-        GstControlledProperty *prop = node->data;
-
-        gst_controlled_property_free (prop);
-      }
-      g_list_free (self->properties);
-      self->properties = NULL;
-    }
-
-    g_object_unref (self->object);
-    self->object = NULL;
-    g_mutex_unlock (self->lock);
-  }
-
-  if (G_OBJECT_CLASS (parent_class)->dispose)
-    (G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-_gst_controller_finalize (GObject * object)
-{
-  GstController *self = GST_CONTROLLER (object);
-
-  g_mutex_free (self->lock);
-
-  if (G_OBJECT_CLASS (parent_class)->finalize)
-    (G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-_gst_controller_init (GTypeInstance * instance, gpointer g_class)
-{
-  GstController *self = GST_CONTROLLER (instance);
-
-  self->lock = g_mutex_new ();
-  self->priv =
-      G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_CONTROLLER,
-      GstControllerPrivate);
-  self->priv->last_sync = GST_CLOCK_TIME_NONE;
-  self->priv->control_rate = 100 * GST_MSECOND;
-}
-
-static void
-_gst_controller_class_init (GstControllerClass * klass)
-{
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
-  parent_class = g_type_class_peek_parent (klass);
-  g_type_class_add_private (klass, sizeof (GstControllerPrivate));
-
-  gobject_class->set_property = _gst_controller_set_property;
-  gobject_class->get_property = _gst_controller_get_property;
-  gobject_class->dispose = _gst_controller_dispose;
-  gobject_class->finalize = _gst_controller_finalize;
-
-  /* register properties */
-  g_object_class_install_property (gobject_class, PROP_CONTROL_RATE,
-      g_param_spec_uint64 ("control-rate",
-          "control rate",
-          "Controlled properties will be updated at least every control-rate nanoseconds",
-          1, G_MAXUINT, 100 * GST_MSECOND,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gstcontroller", 0,
-      "dynamic parameter control for gstreamer elements");
-}
-
-GType
-gst_controller_get_type (void)
-{
-  static volatile gsize type = 0;
-
-  if (g_once_init_enter (&type)) {
-    GType _type;
-    static const GTypeInfo info = {
-      sizeof (GstControllerClass),
-      NULL,                     /* base_init */
-      NULL,                     /* base_finalize */
-      (GClassInitFunc) _gst_controller_class_init,      /* class_init */
-      NULL,                     /* class_finalize */
-      NULL,                     /* class_data */
-      sizeof (GstController),
-      0,                        /* n_preallocs */
-      (GInstanceInitFunc) _gst_controller_init, /* instance_init */
-      NULL                      /* value_table */
-    };
-    _type = g_type_register_static (G_TYPE_OBJECT, "GstController", &info, 0);
-    g_once_init_leave (&type, _type);
-  }
-  return type;
-}
diff --git a/gst/gstcontroller.h b/gst/gstcontroller.h
deleted file mode 100644 (file)
index ec090c6..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2005 Stefan Kost <ensonic at users dot sf dot net>
- *               2011 Stefan Sauer <ensonic at users dot sf dot net>
- *
- * gstcontroller.h: dynamic parameter control subsystem
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_CONTROLLER_H__
-#define __GST_CONTROLLER_H__
-
-#include <gst/gstconfig.h>
-
-#include <string.h>
-
-#include <glib.h>
-#include <glib-object.h>
-#include <glib/gprintf.h>
-
-#include <gst/gstobject.h>
-#include <gst/gstcontrolsource.h>
-
-G_BEGIN_DECLS
-
-/* type macros */
-
-#define GST_TYPE_CONTROLLER           (gst_controller_get_type ())
-#define GST_CONTROLLER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CONTROLLER, GstController))
-#define GST_CONTROLLER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CONTROLLER, GstControllerClass))
-#define GST_IS_CONTROLLER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CONTROLLER))
-#define GST_IS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CONTROLLERE))
-#define GST_CONTROLLER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTROLLER, GstControllerClass))
-
-typedef struct _GstController GstController;
-typedef struct _GstControllerClass GstControllerClass;
-typedef struct _GstControllerPrivate GstControllerPrivate;
-
-/**
- * GstController:
- *
- * The instance structure of GstController
- */
-
-struct _GstController
-{
-  GObject parent;
-
-  GList *properties;  /* List of GstControlledProperty */
-  GMutex *lock;       /* Secure property access, elements will access from threads */
-  GstObject *object;  /* the object we control */
-
-  /*< private >*/
-  GstControllerPrivate *priv;
-  gpointer       _gst_reserved[GST_PADDING - 1];
-};
-
-struct _GstControllerClass
-{
-  GObjectClass parent_class;
-
-  /*< private >*/
-  gpointer       _gst_reserved[GST_PADDING];
-};
-
-GType gst_controller_get_type (void);
-
-/* GstController functions */
-
-GstController *gst_controller_new_valist (GstObject * object, va_list var_args);
-GstController *gst_controller_new_list (GstObject * object, GList *list);
-GstController *gst_controller_new (GstObject * object, ...) G_GNUC_NULL_TERMINATED;
-
-gboolean gst_controller_add_properties_valist (GstController * self, va_list var_args);
-gboolean gst_controller_add_properties_list (GstController * self, GList *list);
-gboolean gst_controller_add_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
-
-gboolean gst_controller_remove_properties_valist (GstController * self, va_list var_args);
-gboolean gst_controller_remove_properties_list (GstController * self, GList *list);
-gboolean gst_controller_remove_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
-
-gboolean gst_controller_is_active (GstController * self);
-void gst_controller_set_disabled (GstController *self, gboolean disabled);
-void gst_controller_set_property_disabled (GstController *self, const gchar * property_name, gboolean disabled);
-gboolean gst_controller_set_control_source (GstController *self, const gchar * property_name, GstControlSource *csource);
-GstControlSource * gst_controller_get_control_source (GstController *self, const gchar * property_name);
-
-GstClockTime gst_controller_suggest_next_sync (GstController *self);
-gboolean gst_controller_sync_values (GstController * self,
-    GstClockTime timestamp);
-
-GValue *gst_controller_get (GstController * self, const gchar * property_name,
-    GstClockTime timestamp);
-gboolean gst_controller_get_value_arrays (GstController * self,
-    GstClockTime timestamp, GSList * value_arrays);
-gboolean gst_controller_get_value_array (GstController * self,
-    GstClockTime timestamp, GstValueArray * value_array);
-
-
-G_END_DECLS
-
-#endif /* __GST_CONTROLLER_H__ */
index bc9e125..3d87670 100644 (file)
@@ -48,8 +48,8 @@
 
 #include "gstcontrolsource.h"
 
-#define GST_CAT_DEFAULT controller_debug
-GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DEFAULT);
+#define GST_CAT_DEFAULT control_source_debug
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
 
 G_DEFINE_ABSTRACT_TYPE (GstControlSource, gst_control_source, G_TYPE_OBJECT);
 
@@ -64,6 +64,9 @@ gst_control_source_class_init (GstControlSourceClass * klass)
 
   /* Has to be implemented by children */
   klass->bind = NULL;
+
+  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gstcontrolsource", 0,
+      "dynamic parameter control sources");
 }
 
 static void
index 47cd08b..d4b3cfa 100644 (file)
  * gst_object_set_name() and gst_object_get_name() are used to set/get the name
  * of the object.
  *
+ *
+ * <refsect2>
+ * <title>controlled properties</title>
+ * Controlled properties offers a lightweight way to adjust gobject
+ * properties over stream-time. It works by using time-stamped value pairs that
+ * are queued for element-properties. At run-time the elements continously pull
+ * values changes for the current stream-time.
+ *
+ * What needs to be changed in a #GstElement?
+ * Very little - it is just two steps to make a plugin controllable!
+ * <orderedlist>
+ *   <listitem><para>
+ *     mark gobject-properties paramspecs that make sense to be controlled,
+ *     by GST_PARAM_CONTROLLABLE.
+ *   </para></listitem>
+ *   <listitem><para>
+ *     when processing data (get, chain, loop function) at the beginning call
+ *     gst_object_sync_values(element,timestamp).
+ *     This will made the controller to update all gobject properties that are under
+ *     control with the current values based on timestamp.
+ *   </para></listitem>
+ * </orderedlist>
+ *
+ * What needs to be done in applications?
+ * Again its not a lot to change.
+ * <orderedlist>
+ *   <listitem><para>
+ *     first put some properties under control, by calling
+ *     gst_object_control_properties (object, "prop1", "prop2",...);
+ *   </para></listitem>
+ *   <listitem><para>
+ *     create a #GstControlSource.
+ *     csource = gst_interpolation_control_source_new ();
+ *     gst_interpolation_control_source_set_interpolation_mode(csource, mode);
+ *   </para></listitem>
+ *   <listitem><para>
+ *     Attach the #GstControlSource on the controller to a property.
+ *     gst_object_set_control_source (object, "prop1", csource);
+ *   </para></listitem>
+ *   <listitem><para>
+ *     Set the control values
+ *     gst_interpolation_control_source_set (csource,0 * GST_SECOND, value1);
+ *     gst_interpolation_control_source_set (csource,1 * GST_SECOND, value2);
+ *   </para></listitem>
+ *   <listitem><para>
+ *     start your pipeline
+ *   </para></listitem>
+ * </orderedlist>
+ * </refsect2>
+ *
  * Last reviewed on 2005-11-09 (0.9.4)
  */
 
 
 #include "gstobject.h"
 #include "gstmarshal.h"
-#include "gstcontroller.h"
+#include "gstclock.h"
+#include "gstcontrolsource.h"
 #include "gstinfo.h"
+#include "gstparamspecs.h"
 #include "gstutils.h"
 
 #ifndef GST_DISABLE_TRACE
@@ -142,6 +194,21 @@ static guint gst_object_signals[LAST_SIGNAL] = { 0 };
 
 static GParamSpec *properties[PROP_LAST];
 
+/*
+ * GstControlledProperty:
+ */
+typedef struct _GstControlledProperty
+{
+  GParamSpec *pspec;            /* GParamSpec for this property */
+  const gchar *name;            /* name of the property */
+  GstControlSource *csource;    /* GstControlSource for this property */
+  gboolean disabled;
+  GValue last_value;
+} GstControlledProperty;
+
+static void gst_controlled_property_free (GstControlledProperty * prop);
+
+
 G_DEFINE_ABSTRACT_TYPE (GstObject, gst_object, G_TYPE_INITIALLY_UNOWNED);
 
 static void
@@ -208,6 +275,9 @@ gst_object_init (GstObject * object)
 #endif
 
   object->flags = 0;
+
+  object->control_rate = 100 * GST_MSECOND;
+  object->last_sync = GST_CLOCK_TIME_NONE;
 }
 
 /**
@@ -354,9 +424,14 @@ gst_object_dispose (GObject * object)
   GST_OBJECT_PARENT (object) = NULL;
   GST_OBJECT_UNLOCK (object);
 
-  if (self->ctrl) {
-    g_object_unref (self->ctrl);
-    self->ctrl = NULL;
+  if (self->properties) {
+    GList *node;
+
+    for (node = self->properties; node; node = g_list_next (node)) {
+      gst_controlled_property_free ((GstControlledProperty *) node->data);
+    }
+    g_list_free (self->properties);
+    self->properties = NULL;
   }
 
   ((GObjectClass *) gst_object_parent_class)->dispose (object);
@@ -958,6 +1033,151 @@ gst_object_get_path_string (GstObject * object)
   return path;
 }
 
+/* controller helper functions */
+
+/*
+ * gst_controlled_property_new:
+ * @object: for which object the controlled property should be set up
+ * @name: the name of the property to be controlled
+ *
+ * Private method which initializes the fields of a new controlled property
+ * structure.
+ *
+ * Returns: a freshly allocated structure or %NULL
+ */
+static GstControlledProperty *
+gst_controlled_property_new (GstObject * object, const gchar * name)
+{
+  GstControlledProperty *prop = NULL;
+  GParamSpec *pspec;
+
+  GST_INFO ("trying to put property '%s' under control", name);
+
+  /* check if the object has a property of that name */
+  if ((pspec =
+          g_object_class_find_property (G_OBJECT_GET_CLASS (object), name))) {
+    GST_DEBUG ("  psec->flags : 0x%08x", pspec->flags);
+
+    /* check if this param is witable && controlable && !construct-only */
+    g_return_val_if_fail ((pspec->flags & (G_PARAM_WRITABLE |
+                GST_PARAM_CONTROLLABLE | G_PARAM_CONSTRUCT_ONLY)) ==
+        (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE), NULL);
+
+    if ((prop = g_slice_new (GstControlledProperty))) {
+      prop->pspec = pspec;
+      prop->name = pspec->name;
+      prop->csource = NULL;
+      prop->disabled = FALSE;
+      memset (&prop->last_value, 0, sizeof (GValue));
+      g_value_init (&prop->last_value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
+    }
+  } else {
+    GST_WARNING ("class '%s' has no property '%s'", G_OBJECT_TYPE_NAME (object),
+        name);
+  }
+  return prop;
+}
+
+/*
+ * gst_controlled_property_free:
+ * @prop: the object to free
+ *
+ * Private method which frees all data allocated by a #GstControlledProperty
+ * instance.
+ */
+static void
+gst_controlled_property_free (GstControlledProperty * prop)
+{
+  if (prop->csource)
+    g_object_unref (prop->csource);
+  g_value_unset (&prop->last_value);
+  g_slice_free (GstControlledProperty, prop);
+}
+
+/*
+ * gst_object_find_controlled_property:
+ * @self: the gobject to search for a property in
+ * @name: the gobject property name to look for
+ *
+ * Searches the list of properties under control.
+ *
+ * Returns: a #GstControlledProperty or %NULL if the property is not being
+ * controlled.
+ */
+static GstControlledProperty *
+gst_object_find_controlled_property (GstObject * self, const gchar * name)
+{
+  GstControlledProperty *prop;
+  GList *node;
+
+  for (node = self->properties; node; node = g_list_next (node)) {
+    prop = node->data;
+    /* FIXME: eventually use GQuark to speed it up */
+    if (!strcmp (prop->name, name)) {
+      return prop;
+    }
+  }
+  GST_DEBUG ("controller does not (yet) manage property '%s'", name);
+
+  return NULL;
+}
+
+/*
+ * gst_object_add_controlled_property:
+ * @self: the object
+ * @name: name of projecty in @object
+ *
+ * Creates a new #GstControlledProperty if there is none for property @name yet.
+ *
+ * Returns: %TRUE if the property has been added to the controller
+ */
+static gboolean
+gst_object_add_controlled_property (GstObject * self, const gchar * name)
+{
+  gboolean res = TRUE;
+
+  /* test if this property isn't yet controlled */
+  if (!gst_object_find_controlled_property (self, name)) {
+    GstControlledProperty *prop;
+
+    /* create GstControlledProperty and add to self->properties list */
+    if ((prop = gst_controlled_property_new (self, name))) {
+      self->properties = g_list_prepend (self->properties, prop);
+      GST_DEBUG_OBJECT (self, "property %s added", name);
+    } else
+      res = FALSE;
+  } else {
+    GST_WARNING_OBJECT (self, "trying to control property %s again", name);
+  }
+  return res;
+}
+
+/*
+ * gst_object_remove_controlled_property:
+ * @self: the object
+ * @name: name of projecty in @object
+ *
+ * Removes a #GstControlledProperty for property @name.
+ *
+ * Returns: %TRUE if the property has been removed from the controller
+ */
+static gboolean
+gst_object_remove_controlled_property (GstObject * self, const gchar * name)
+{
+  gboolean res = TRUE;
+  GstControlledProperty *prop;
+
+  if ((prop = gst_object_find_controlled_property (self, name))) {
+    self->properties = g_list_remove (self->properties, prop);
+    //g_signal_handler_disconnect (self->object, prop->notify_handler_id);
+    gst_controlled_property_free (prop);
+    GST_DEBUG_OBJECT (self, "property %s removed", name);
+  } else {
+    res = FALSE;
+  }
+  return res;
+}
+
 /* controller functions */
 
 /**
@@ -975,24 +1195,18 @@ gst_object_get_path_string (GstObject * object)
 gboolean
 gst_object_control_properties (GstObject * object, ...)
 {
-  gboolean res = FALSE;
+  gboolean res = TRUE;
   va_list var_args;
+  gchar *name;
 
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
 
   va_start (var_args, object);
-  if (object->ctrl) {
-    GstController *ctrl = gst_controller_new_valist (object, var_args);
-
-    /* FIXME: see gst_controller_new_*() */
-    g_object_unref (object->ctrl);
-    object->ctrl = ctrl;
-
-    res = (object->ctrl != NULL);
-  } else {
-    res = gst_controller_add_properties_valist ((GstController *) object->ctrl,
-        var_args);
+  GST_OBJECT_LOCK (object);
+  while ((name = va_arg (var_args, gchar *))) {
+    res &= gst_object_add_controlled_property (object, name);
   }
+  GST_OBJECT_UNLOCK (object);
   va_end (var_args);
   return res;
 }
@@ -1010,17 +1224,19 @@ gst_object_control_properties (GstObject * object, ...)
 gboolean
 gst_object_uncontrol_properties (GstObject * object, ...)
 {
-  gboolean res = FALSE;
-  g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
+  gboolean res = TRUE;
+  va_list var_args;
+  gchar *name;
 
-  if (object->ctrl) {
-    va_list var_args;
+  g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
 
-    va_start (var_args, object);
-    res = gst_controller_remove_properties_valist (
-        (GstController *) object->ctrl, var_args);
-    va_end (var_args);
+  va_start (var_args, object);
+  GST_OBJECT_LOCK (object);
+  while ((name = va_arg (var_args, gchar *))) {
+    res &= gst_object_remove_controlled_property (object, name);
   }
+  GST_OBJECT_UNLOCK (object);
+  va_end (var_args);
   return (res);
 }
 
@@ -1028,18 +1244,32 @@ gst_object_uncontrol_properties (GstObject * object, ...)
  * gst_object_suggest_next_sync:
  * @object: the object that has controlled properties
  *
- * Convenience function for GObject
+ * Returns a suggestion for timestamps where buffers should be split
+ * to get best controller results.
  *
- * Returns: same thing as gst_controller_suggest_next_sync()
+ * Returns: Returns the suggested timestamp or %GST_CLOCK_TIME_NONE
+ * if no control-rate was set.
  */
 GstClockTime
 gst_object_suggest_next_sync (GstObject * object)
 {
+  GstClockTime ret;
+
   g_return_val_if_fail (GST_IS_OBJECT (object), GST_CLOCK_TIME_NONE);
+  g_return_val_if_fail (object->control_rate != GST_CLOCK_TIME_NONE,
+      GST_CLOCK_TIME_NONE);
+
+  GST_OBJECT_LOCK (object);
+
+  /* TODO: Implement more logic, depending on interpolation mode and control
+   * points
+   * FIXME: we need playback direction
+   */
+  ret = object->last_sync + object->control_rate;
+
+  GST_OBJECT_UNLOCK (object);
 
-  if (object->ctrl)
-    return gst_controller_suggest_next_sync ((GstController *) object->ctrl);
-  return (GST_CLOCK_TIME_NONE);
+  return ret;
 }
 
 /**
@@ -1047,64 +1277,122 @@ gst_object_suggest_next_sync (GstObject * object)
  * @object: the object that has controlled properties
  * @timestamp: the time that should be processed
  *
- * Convenience function for GObject
+ * Sets the properties of the object, according to the #GstControlSources that
+ * (maybe) handle them and for the given timestamp.
  *
- * Returns: same thing as gst_controller_sync_values()
+ * If this function fails, it is most likely the application developers fault.
+ * Most probably the control sources are not setup correctly.
+ *
+ * Returns: %TRUE if the controller values could be applied to the object
+ * properties, %FALSE otherwise
  */
 gboolean
 gst_object_sync_values (GstObject * object, GstClockTime timestamp)
 {
+  GstControlledProperty *prop;
+  GList *node;
+  gboolean ret = TRUE, val_ret;
+  GValue value = { 0, };
+
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
+  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
+
+  GST_LOG ("sync_values");
+
+  /* FIXME: this deadlocks */
+  /* GST_OBJECT_LOCK (object); */
+  g_object_freeze_notify ((GObject *) object);
+  /* go over the controlled properties of the controller */
+  for (node = object->properties; node; node = g_list_next (node)) {
+    prop = node->data;
+
+    if (!prop->csource || prop->disabled)
+      continue;
+
+    GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp);
+
+    /* we can make this faster
+     * http://bugzilla.gnome.org/show_bug.cgi?id=536939
+     */
+    g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
+    val_ret = gst_control_source_get_value (prop->csource, timestamp, &value);
+    if (G_LIKELY (val_ret)) {
+      /* always set the value for first time, but then only if it changed
+       * this should limit g_object_notify invocations.
+       * FIXME: can we detect negative playback rates?
+       */
+      if ((timestamp < object->last_sync) ||
+          gst_value_compare (&value, &prop->last_value) != GST_VALUE_EQUAL) {
+        g_object_set_property ((GObject *) object, prop->name, &value);
+        g_value_copy (&value, &prop->last_value);
+      }
+    } else {
+      GST_DEBUG ("no control value for param %s", prop->name);
+    }
+    g_value_unset (&value);
+    ret &= val_ret;
+  }
+  object->last_sync = timestamp;
+  g_object_thaw_notify ((GObject *) object);
+  /* GST_OBJECT_UNLOCK (object); */
 
-  if (object->ctrl)
-    return gst_controller_sync_values ((GstController *) object->ctrl,
-        timestamp);
-  /* this is no failure, its called by elements regardless if there is a
-   * controller assigned or not */
-  return (TRUE);
+  return ret;
 }
 
 /**
- * gst_object_has_active_automation:
+ * gst_object_has_active_controlled_properties:
  * @object: the object that has controlled properties
  *
- * Check if the object has an active controller. It has one if it has at least
- * one controlled property that is not disabled.
+ * Check if the @object has an active controlled properties.
  *
- * Returns: %TRUE if the controller is active
+ * Returns: %TRUE if the object has active controlled properties
  */
 gboolean
-gst_object_has_active_automation (GstObject * object)
+gst_object_has_active_controlled_properties (GstObject * object)
 {
   gboolean res = FALSE;
+  GList *node;
+  GstControlledProperty *prop;
 
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
 
-  if (object->ctrl)
-    res = gst_controller_is_active ((GstController *) object->ctrl);
+  GST_OBJECT_LOCK (object);
+  for (node = object->properties; node; node = node->next) {
+    prop = node->data;
+    res |= !prop->disabled;
+  }
+  GST_OBJECT_UNLOCK (object);
   return res;
 }
 
 /**
- * gst_object_set_automation_disabled:
+ * gst_object_set_controlled_properties_disabled:
  * @object: the object that has controlled properties
  * @disabled: boolean that specifies whether to disable the controller
  * or not.
  *
- * This function is used to disable all properties of the #GstController
- * for some time, i.e. gst_object_sync_values() will do nothing..
+ * This function is used to disable all controlled properties of the @object for
+ * some time, i.e. gst_object_sync_values() will do nothing..
  */
 void
-gst_object_set_automation_disabled (GstObject * object, gboolean disabled)
+gst_object_set_controlled_properties_disabled (GstObject * object,
+    gboolean disabled)
 {
+  GList *node;
+  GstControlledProperty *prop;
+
   g_return_if_fail (GST_IS_OBJECT (object));
 
-  if (object->ctrl)
-    gst_controller_set_disabled (object->ctrl, disabled);
+  GST_OBJECT_LOCK (object);
+  for (node = object->properties; node; node = node->next) {
+    prop = node->data;
+    prop->disabled = disabled;
+  }
+  GST_OBJECT_UNLOCK (object);
 }
 
 /**
- * gst_object_set_property_automation_disabled:
+ * gst_object_set_controlled_property_disabled:
  * @object: the object that has controlled properties
  * @property_name: property to disable
  * @disabled: boolean that specifies whether to disable the controller
@@ -1115,15 +1403,19 @@ gst_object_set_automation_disabled (GstObject * object, gboolean disabled)
  * property.
  */
 void
-gst_object_set_property_automation_disabled (GstObject * object,
+gst_object_set_controlled_property_disabled (GstObject * object,
     const gchar * property_name, gboolean disabled)
 {
+  GstControlledProperty *prop;
+
   g_return_if_fail (GST_IS_OBJECT (object));
   g_return_if_fail (property_name);
 
-  if (object->ctrl)
-    gst_controller_set_property_disabled ((GstController *) object->ctrl,
-        property_name, disabled);
+  GST_OBJECT_LOCK (object);
+  if ((prop = gst_object_find_controlled_property (object, property_name))) {
+    prop->disabled = disabled;
+  }
+  GST_OBJECT_UNLOCK (object);
 }
 
 /**
@@ -1142,14 +1434,30 @@ gboolean
 gst_object_set_control_source (GstObject * object, const gchar * property_name,
     GstControlSource * csource)
 {
+  GstControlledProperty *prop;
+  gboolean ret = FALSE;
+
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
   g_return_val_if_fail (property_name, FALSE);
-  g_return_val_if_fail (GST_IS_CONTROL_SOURCE (csource), FALSE);
+  g_return_val_if_fail ((!csource || GST_IS_CONTROL_SOURCE (csource)), FALSE);
 
-  if (object->ctrl)
-    return gst_controller_set_control_source ((GstController *) object->ctrl,
-        property_name, csource);
-  return FALSE;
+  GST_OBJECT_LOCK (object);
+  if ((prop = gst_object_find_controlled_property (object, property_name))) {
+    GstControlSource *old = prop->csource;
+
+    if (csource && (ret = gst_control_source_bind (csource, prop->pspec))) {
+      prop->csource = g_object_ref (csource);
+    } else if (!csource) {
+      ret = TRUE;
+      prop->csource = NULL;
+    }
+
+    if (ret && old)
+      g_object_unref (old);
+  }
+  GST_OBJECT_UNLOCK (object);
+
+  return ret;
 }
 
 /**
@@ -1167,26 +1475,64 @@ gst_object_set_control_source (GstObject * object, const gchar * property_name,
 GstControlSource *
 gst_object_get_control_source (GstObject * object, const gchar * property_name)
 {
+  GstControlledProperty *prop;
+  GstControlSource *ret = NULL;
+
   g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
   g_return_val_if_fail (property_name, NULL);
 
-  if (object->ctrl)
-    return gst_controller_get_control_source ((GstController *) object->ctrl,
-        property_name);
-  return NULL;
+  GST_OBJECT_LOCK (object);
+  if ((prop = gst_object_find_controlled_property (object, property_name))) {
+    if ((ret = prop->csource))
+      g_object_ref (ret);
+  }
+  GST_OBJECT_UNLOCK (object);
+
+  return ret;
 }
 
-// FIXME: docs
+/**
+ * gst_object_get_value:
+ * @object: the object that has controlled properties
+ * @property_name: the name of the property to get
+ * @timestamp: the time the control-change should be read from
+ *
+ * Gets the value for the given controllered property at the requested time.
+ *
+ * Returns: the GValue of the property at the given time, or %NULL if the
+ * property isn't controlled.
+ */
 GValue *
 gst_object_get_value (GstObject * object, const gchar * property_name,
     GstClockTime timestamp)
 {
+  GstControlledProperty *prop;
+  GValue *val = NULL;
+
   g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
   g_return_val_if_fail (property_name, NULL);
+  g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), NULL);
 
-  if (object->ctrl)
-    return gst_controller_get (object->ctrl, property_name, timestamp);
-  return NULL;
+  GST_OBJECT_LOCK (object);
+  if ((prop = gst_object_find_controlled_property (object, property_name))) {
+    val = g_new0 (GValue, 1);
+    g_value_init (val, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
+    if (prop->csource) {
+      gboolean res;
+
+      /* get current value via control source */
+      res = gst_control_source_get_value (prop->csource, timestamp, val);
+      if (!res) {
+        g_free (val);
+        val = NULL;
+      }
+    } else {
+      g_object_get_property ((GObject *) object, prop->name, val);
+    }
+  }
+  GST_OBJECT_UNLOCK (object);
+
+  return val;
 }
 
 /**
@@ -1210,13 +1556,17 @@ gboolean
 gst_object_get_value_arrays (GstObject * object, GstClockTime timestamp,
     GSList * value_arrays)
 {
+  gboolean res = TRUE;
+  GSList *node;
+
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
   g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
+  g_return_val_if_fail (value_arrays, FALSE);
 
-  if (object->ctrl)
-    return gst_controller_get_value_arrays ((GstController *) object->ctrl,
-        timestamp, value_arrays);
-  return (FALSE);
+  for (node = value_arrays; (res && node); node = g_slist_next (node)) {
+    res = gst_object_get_value_array (object, timestamp, node->data);
+  }
+  return res;
 }
 
 /**
@@ -1238,13 +1588,30 @@ gboolean
 gst_object_get_value_array (GstObject * object, GstClockTime timestamp,
     GstValueArray * value_array)
 {
+  gboolean res = FALSE;
+  GstControlledProperty *prop;
+
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
   g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
+  g_return_val_if_fail (value_array, FALSE);
+  g_return_val_if_fail (value_array->property_name, FALSE);
+  g_return_val_if_fail (value_array->values, FALSE);
 
-  if (object->ctrl)
-    return gst_controller_get_value_array ((GstController *) object->ctrl,
-        timestamp, value_array);
-  return (FALSE);
+  GST_OBJECT_LOCK (object);
+
+  if ((prop = gst_object_find_controlled_property (object,
+              value_array->property_name))) {
+    /* get current value_array via control source */
+    if (!prop->csource)
+      goto out;
+
+    res = gst_control_source_get_value_array (prop->csource, timestamp,
+        value_array);
+  }
+
+out:
+  GST_OBJECT_UNLOCK (object);
+  return res;
 }
 
 /**
@@ -1267,13 +1634,9 @@ gst_object_get_value_array (GstObject * object, GstClockTime timestamp,
 GstClockTime
 gst_object_get_control_rate (GstObject * object)
 {
-  GstClockTime control_rate = GST_CLOCK_TIME_NONE;
-
   g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
 
-  if (object->ctrl)
-    g_object_get (object->ctrl, "control-rate", &control_rate, NULL);
-  return (control_rate);
+  return object->control_rate;
 }
 
 /**
@@ -1294,6 +1657,5 @@ gst_object_set_control_rate (GstObject * object, GstClockTime control_rate)
 {
   g_return_if_fail (GST_IS_OBJECT (object));
 
-  if (object->ctrl)
-    g_object_set (object->ctrl, "control-rate", control_rate, NULL);
+  object->control_rate = control_rate;
 }
index 5c15065..e6a61a3 100644 (file)
@@ -171,7 +171,10 @@ struct _GstObject {
   guint32        flags;
 
   /*< private >*/
-  gpointer ctrl;        /* time controlled properties */
+  GList *properties;  /* List of GstControlledProperty */
+  guint64 control_rate;
+  guint64 last_sync;
+
   gpointer _gst_reserved;
 };
 
@@ -229,7 +232,6 @@ gchar *             gst_object_get_path_string      (GstObject *object);
 gboolean       gst_object_check_uniqueness     (GList *list, const gchar *name);
 
 /* controller functions */
-#include <gst/gstclock.h>
 #include <gst/gstcontrolsource.h>
 
 gboolean gst_object_control_properties (GstObject * object, ...) G_GNUC_NULL_TERMINATED;
@@ -238,9 +240,9 @@ gboolean gst_object_uncontrol_properties (GstObject * object, ...) G_GNUC_NULL_T
 GstClockTime gst_object_suggest_next_sync (GstObject * object);
 gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
 
-gboolean gst_object_has_active_automation (GstObject *object);
-void gst_object_set_automation_disabled (GstObject *object, gboolean disabled);
-void gst_object_set_property_automation_disabled (GstObject *object, const gchar * property_name, gboolean disabled);
+gboolean gst_object_has_active_controlled_properties (GstObject *object);
+void gst_object_set_controlled_properties_disabled (GstObject *object, gboolean disabled);
+void gst_object_set_controlled_property_disabled (GstObject *object, const gchar * property_name, gboolean disabled);
 
 gboolean gst_object_set_control_source (GstObject *object, const gchar * property_name, GstControlSource *csource);
 GstControlSource * gst_object_get_control_source (GstObject *object, const gchar * property_name);
index 7088b6f..9c49de5 100644 (file)
@@ -19,6 +19,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <stdio.h>
+
 #include <gst/gst.h>
 #include <gst/controller/gstinterpolationcontrolsource.h>
 
@@ -80,7 +82,6 @@ main (gint argc, gchar * argv[])
   gint i, j;
   GstElement *src, *sink;
   GstElement *bin;
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GValue freq = { 0, };
   GstClockTime bt, ct;
@@ -109,15 +110,15 @@ main (gint argc, gchar * argv[])
 
   tick = BLOCK_SIZE * GST_SECOND / 44100;
 
-  /* add a controller to the source */
-  if (!(ctrl = gst_controller_new (GST_OBJECT (src), "freq", NULL))) {
+  /* select parameters to control */
+  if (!gst_object_control_properties (GST_OBJECT (src), "freq", NULL)) {
     GST_WARNING ("can't control source element");
     goto Error;
   }
 
   /* create and configure control source */
   csource = gst_interpolation_control_source_new ();
-  gst_controller_set_control_source (ctrl, "freq",
+  gst_object_set_control_source (GST_OBJECT (src), "freq",
       GST_CONTROL_SOURCE (csource));
   gst_interpolation_control_source_set_interpolation_mode (csource,
       GST_INTERPOLATE_LINEAR);
@@ -194,7 +195,6 @@ main (gint argc, gchar * argv[])
       GST_TIME_ARGS (elapsed));
 
   /* cleanup */
-  g_object_unref (G_OBJECT (ctrl));
   gst_object_unref (G_OBJECT (bin));
   res = 0;
 Error:
index 28685ef..23832ba 100644 (file)
@@ -231,18 +231,14 @@ teardown (void)
 /* tests for an element with no controlled params */
 GST_START_TEST (controller_new_fail1)
 {
-  GstController *ctrl;
   GstElement *elem;
   gboolean res;
 
   elem = gst_element_factory_make ("fakesrc", "test_source");
-  ctrl = gst_controller_new (GST_OBJECT (elem), NULL);
-
   /* that property should not exist */
-  res = gst_controller_add_properties (ctrl, "_schrompf_", NULL);
+  res = gst_object_control_properties (GST_OBJECT (elem), "_schrompf_", NULL);
   fail_unless (res == FALSE, NULL);
 
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -251,19 +247,16 @@ GST_END_TEST;
 /* tests for readonly params */
 GST_START_TEST (controller_new_fail2)
 {
-  GstController *ctrl;
   GstElement *elem;
   gboolean res;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
-  ctrl = gst_controller_new (GST_OBJECT (elem), NULL);
 
   /* that property should exist and but is readonly */
   ASSERT_CRITICAL (res =
-      gst_controller_add_properties (ctrl, "readonly", NULL));
+      gst_object_control_properties (GST_OBJECT (elem), "readonly", NULL));
   fail_unless (res == FALSE, NULL);
 
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -272,18 +265,16 @@ GST_END_TEST;
 /* tests for static params */
 GST_START_TEST (controller_new_fail3)
 {
-  GstController *ctrl;
   GstElement *elem;
   gboolean res;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
-  ctrl = gst_controller_new (GST_OBJECT (elem), NULL);
 
   /* that property should exist and but is not controlable */
-  ASSERT_CRITICAL (res = gst_controller_add_properties (ctrl, "static", NULL));
+  ASSERT_CRITICAL (res = gst_object_control_properties (GST_OBJECT (elem),
+          "static", NULL));
   fail_unless (res == FALSE, NULL);
 
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -292,19 +283,17 @@ GST_END_TEST;
 /* tests for construct-only params */
 GST_START_TEST (controller_new_fail4)
 {
-  GstController *ctrl;
   GstElement *elem;
   gboolean res;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
-  ctrl = gst_controller_new (GST_OBJECT (elem), NULL);
 
   /* that property should exist and but is construct-only */
   ASSERT_CRITICAL (res =
-      gst_controller_add_properties (ctrl, "construct-only", NULL));
+      gst_object_control_properties (GST_OBJECT (elem), "construct-only",
+          NULL));
   fail_unless (res == FALSE, NULL);
 
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -314,17 +303,15 @@ GST_END_TEST;
 /* tests for an element with controlled params */
 GST_START_TEST (controller_new_okay1)
 {
-  GstController *ctrl;
   GstElement *elem;
+  gboolean res;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  res = gst_object_control_properties (GST_OBJECT (elem), "ulong", NULL);
+  fail_unless (res == TRUE, NULL);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -333,24 +320,19 @@ GST_END_TEST;
 /* tests for an element with several controlled params */
 GST_START_TEST (controller_new_okay2)
 {
-  GstController *ctrl;
   GstElement *elem;
   gboolean res;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
-  /* that property should exist and should be controllable */
-  ctrl =
-      gst_controller_new (GST_OBJECT (elem), "ulong", "double", "float", NULL);
-  fail_unless (ctrl != NULL, NULL);
-
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1);
+  /* these properties should exist and should be controllable */
+  res = gst_object_control_properties (GST_OBJECT (elem), "ulong", "double",
+      "float", NULL);
+  fail_unless (res == TRUE, NULL);
 
-  res = gst_controller_add_properties (ctrl, "boolean", NULL);
+  res = gst_object_control_properties (GST_OBJECT (elem), "boolean", NULL);
   fail_unless (res == TRUE, NULL);
 
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -359,26 +341,24 @@ GST_END_TEST;
 /* controlling a params twice should be handled */
 GST_START_TEST (controller_param_twice)
 {
-  GstController *ctrl;
   GstElement *elem;
   gboolean res;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  res =
+      gst_object_control_properties (GST_OBJECT (elem), "ulong", "ulong", NULL);
+  fail_unless (res, NULL);
 
   /* it should have been added at least once, let remove it */
-  res = gst_controller_remove_properties (ctrl, "ulong", NULL);
+  res = gst_object_uncontrol_properties (GST_OBJECT (elem), "ulong", NULL);
   fail_unless (res, NULL);
 
   /* removing it again should not work */
-  res = gst_controller_remove_properties (ctrl, "ulong", NULL);
+  res = gst_object_uncontrol_properties (GST_OBJECT (elem), "ulong", NULL);
   fail_unless (!res, NULL);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -387,72 +367,66 @@ GST_END_TEST;
 /* tests if we cleanup properly */
 GST_START_TEST (controller_controlsource_refcounts)
 {
-  GstController *ctrl;
   GstElement *elem;
   GstControlSource *csource, *test_csource;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   csource = (GstControlSource *) gst_interpolation_control_source_new ();
   fail_unless (csource != NULL, NULL);
 
   fail_unless_equals_int (G_OBJECT (csource)->ref_count, 1);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong", csource));
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
+          csource));
   fail_unless_equals_int (G_OBJECT (csource)->ref_count, 2);
 
-  g_object_unref (G_OBJECT (csource));
-
-  test_csource = gst_controller_get_control_source (ctrl, "ulong");
+  test_csource = gst_object_get_control_source (GST_OBJECT (elem), "ulong");
   fail_unless (test_csource != NULL, NULL);
   fail_unless (test_csource == csource);
-  fail_unless_equals_int (G_OBJECT (csource)->ref_count, 2);
+  fail_unless_equals_int (G_OBJECT (csource)->ref_count, 3);
+  g_object_unref (test_csource);
   g_object_unref (csource);
 
-  /* free the controller */
-  g_object_unref (ctrl);
-
   gst_object_unref (elem);
 }
 
 GST_END_TEST;
 
-/* tests if we don't fail on empty controllers */
+/* tests if we don't fail on empty interpolation controlsources */
 GST_START_TEST (controller_controlsource_empty1)
 {
-  GstController *ctrl;
   GstElement *elem;
   GstControlSource *csource;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   csource = (GstControlSource *) gst_interpolation_control_source_new ();
   fail_unless (csource != NULL, NULL);
 
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong", csource));
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
+          csource));
 
   /* don't fail on empty control point lists */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
 
   /* unref objects */
   g_object_unref (csource);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
 GST_END_TEST;
 
-/* tests if we don't fail on controllers that are empty again */
+/* tests if we don't fail on interpolation controlsources that are empty again */
 GST_START_TEST (controller_controlsource_empty2)
 {
-  GstController *ctrl;
   GstElement *elem;
   GstInterpolationControlSource *csource;
   GValue val = { 0, };
@@ -460,13 +434,13 @@ GST_START_TEST (controller_controlsource_empty2)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   csource = gst_interpolation_control_source_new ();
   fail_unless (csource != NULL, NULL);
 
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           (GstControlSource *) csource));
 
   /* set control values */
@@ -478,11 +452,10 @@ GST_START_TEST (controller_controlsource_empty2)
   gst_interpolation_control_source_unset (csource, 0 * GST_SECOND);
 
   /* don't fail on empty control point lists */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
 
   /* unref objects */
   g_object_unref (csource);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -491,7 +464,6 @@ GST_END_TEST;
 /* test timed value handling without interpolation */
 GST_START_TEST (controller_interpolate_none)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -500,14 +472,14 @@ GST_START_TEST (controller_interpolate_none)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -531,18 +503,16 @@ GST_START_TEST (controller_interpolate_none)
   fail_unless (res, NULL);
   fail_unless (gst_interpolation_control_source_get_count (csource) == 2);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -551,7 +521,6 @@ GST_END_TEST;
 /* test timed value handling in trigger mode */
 GST_START_TEST (controller_interpolate_trigger)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -560,14 +529,14 @@ GST_START_TEST (controller_interpolate_trigger)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -594,20 +563,18 @@ GST_START_TEST (controller_interpolate_trigger)
   /* now pull in values for some timestamps */
   fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
           0 * GST_SECOND, &val_ulong));
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
   fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
           1 * GST_SECOND, &val_ulong));
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
           2 * GST_SECOND, &val_ulong));
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (G_OBJECT (csource));
-  g_object_unref (ctrl);
+  g_object_unref (csource);
   gst_object_unref (elem);
 }
 
@@ -616,7 +583,6 @@ GST_END_TEST;
 /* test timed value handling with linear interpolation */
 GST_START_TEST (controller_interpolate_linear)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -625,14 +591,14 @@ GST_START_TEST (controller_interpolate_linear)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -652,18 +618,16 @@ GST_START_TEST (controller_interpolate_linear)
       &val_ulong);
   fail_unless (res, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -672,7 +636,6 @@ GST_END_TEST;
 /* test timed value handling with cubic interpolation */
 GST_START_TEST (controller_interpolate_cubic)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -681,14 +644,14 @@ GST_START_TEST (controller_interpolate_cubic)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "double", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "double",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "double",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -718,25 +681,23 @@ GST_START_TEST (controller_interpolate_cubic)
       &val_double);
   fail_unless (res, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 0.0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 5.0);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 2.0);
-  gst_controller_sync_values (ctrl, 3 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 3 * GST_SECOND);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double > 2.0 &&
       GST_TEST_MONO_SOURCE (elem)->val_double < 8.0, NULL);
-  gst_controller_sync_values (ctrl, 4 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 8.0);
-  gst_controller_sync_values (ctrl, 5 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 5 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 8.0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -745,7 +706,6 @@ GST_END_TEST;
 /* test timed value handling with cubic interpolation */
 GST_START_TEST (controller_interpolate_cubic_too_few_cp)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -754,14 +714,14 @@ GST_START_TEST (controller_interpolate_cubic_too_few_cp)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "double", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "double",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "double",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -781,20 +741,18 @@ GST_START_TEST (controller_interpolate_cubic_too_few_cp)
       &val_double);
   fail_unless (res, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps and verify that it used linear
    * interpolation as we don't gave enough control points
    */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 0.0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 2.0);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_double, 4.0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -804,30 +762,28 @@ GST_END_TEST;
  * mode */
 GST_START_TEST (controller_interpolate_unimplemented)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set completely bogus interpolation mode */
   fail_if (gst_interpolation_control_source_set_interpolation_mode (csource,
           (GstInterpolateMode) 93871));
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -836,7 +792,6 @@ GST_END_TEST;
 /* test _unset() */
 GST_START_TEST (controller_interpolation_unset)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -845,14 +800,14 @@ GST_START_TEST (controller_interpolation_unset)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -878,11 +833,11 @@ GST_START_TEST (controller_interpolation_unset)
   fail_unless (res, NULL);
 
   /* verify values */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
 
   /* unset second */
@@ -890,9 +845,9 @@ GST_START_TEST (controller_interpolation_unset)
   fail_unless (res, NULL);
 
   /* verify value again */
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
 
   /* unset all values, reset and try to unset again */
@@ -905,8 +860,6 @@ GST_START_TEST (controller_interpolation_unset)
 
   g_object_unref (csource);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -915,7 +868,6 @@ GST_END_TEST;
 /* test _unset_all() */
 GST_START_TEST (controller_interpolation_unset_all)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -924,14 +876,14 @@ GST_START_TEST (controller_interpolation_unset_all)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -952,9 +904,9 @@ GST_START_TEST (controller_interpolation_unset_all)
   fail_unless (res, NULL);
 
   /* verify values */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
   /* unset all */
@@ -963,11 +915,9 @@ GST_START_TEST (controller_interpolation_unset_all)
   g_object_unref (csource);
 
   /* verify value again */
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -976,7 +926,6 @@ GST_END_TEST;
 /* test retrieval of an array of values with get_value_array() */
 GST_START_TEST (controller_interpolation_linear_value_array)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -986,14 +935,14 @@ GST_START_TEST (controller_interpolation_linear_value_array)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -1027,9 +976,7 @@ GST_START_TEST (controller_interpolation_linear_value_array)
 
   g_object_unref (csource);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
   g_free (values.values);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1038,7 +985,6 @@ GST_END_TEST;
 /* test if values below minimum and above maximum are clipped */
 GST_START_TEST (controller_interpolation_linear_invalid_values)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -1047,14 +993,14 @@ GST_START_TEST (controller_interpolation_linear_invalid_values)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "float", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "float",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "float",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "float",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -1078,26 +1024,25 @@ GST_START_TEST (controller_interpolation_linear_invalid_values)
 
   /* now pull in values for some timestamps and see if clipping works */
   /* 200.0 */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 100.0);
   /* 100.0 */
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 100.0);
   /* 50.0 */
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND + 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem),
+      1 * GST_SECOND + 500 * GST_MSECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 50.0);
   /* 0.0 */
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 0.0);
   /* -100.0 */
-  gst_controller_sync_values (ctrl, 3 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 3 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 0.0);
   /* -200.0 */
-  gst_controller_sync_values (ctrl, 4 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND);
   fail_unless_equals_float (GST_TEST_MONO_SOURCE (elem)->val_float, 0.0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1105,7 +1050,6 @@ GST_END_TEST;
 
 GST_START_TEST (controller_interpolation_linear_default_values)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -1114,14 +1058,14 @@ GST_START_TEST (controller_interpolation_linear_default_values)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -1151,13 +1095,13 @@ GST_START_TEST (controller_interpolation_linear_default_values)
 
   /* now pull in values for some timestamps */
   /* should give the value of the first control point for timestamps before it */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 3 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 3 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
   /* set control values */
@@ -1180,17 +1124,15 @@ GST_START_TEST (controller_interpolation_linear_default_values)
 
   /* now pull in values for some timestamps */
   /* should now give our value for timestamp 0 */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1199,7 +1141,6 @@ GST_END_TEST;
 /* test gst_controller_set_disabled() with linear interpolation */
 GST_START_TEST (controller_interpolate_linear_disabled)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource, *csource2;
   GstElement *elem;
   gboolean res;
@@ -1210,18 +1151,18 @@ GST_START_TEST (controller_interpolate_linear_disabled)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", "double", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          "double", NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
   csource2 = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
   fail_unless (csource2 != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "double",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double",
           GST_CONTROL_SOURCE (csource2)));
 
   /* set interpolation mode */
@@ -1243,7 +1184,7 @@ GST_START_TEST (controller_interpolate_linear_disabled)
       &val_ulong);
   fail_unless (res, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
 /* set control values */
   g_value_init (&val_double, G_TYPE_DOUBLE);
@@ -1261,88 +1202,89 @@ GST_START_TEST (controller_interpolate_linear_disabled)
   g_object_unref (G_OBJECT (csource2));
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
 
   /* now pull in values for some timestamps, prop double disabled */
   GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
   GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
-  gst_controller_set_property_disabled (ctrl, "double", TRUE);
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_set_controlled_property_disabled (GST_OBJECT (elem), "double",
+      TRUE);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
 
   /* now pull in values for some timestamps, after enabling double again */
   GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
   GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
-  gst_controller_set_property_disabled (ctrl, "double", FALSE);
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_set_controlled_property_disabled (GST_OBJECT (elem), "double",
+      FALSE);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
 
   /* now pull in values for some timestamps, after disabling all props */
   GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
   GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
-  gst_controller_set_disabled (ctrl, TRUE);
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_set_controlled_properties_disabled (GST_OBJECT (elem), TRUE);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
 
   /* now pull in values for some timestamps, enabling double again */
   GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
   GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
-  gst_controller_set_property_disabled (ctrl, "double", FALSE);
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_set_controlled_property_disabled (GST_OBJECT (elem), "double",
+      FALSE);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
 
   /* now pull in values for some timestamps, enabling all */
   GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
   GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
-  gst_controller_set_disabled (ctrl, FALSE);
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_set_controlled_properties_disabled (GST_OBJECT (elem), FALSE);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
   fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1351,7 +1293,6 @@ GST_END_TEST;
 
 GST_START_TEST (controller_interpolation_set_from_list)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstTimedValue *tval;
   GstElement *elem;
@@ -1361,14 +1302,14 @@ GST_START_TEST (controller_interpolation_set_from_list)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -1395,7 +1336,6 @@ GST_START_TEST (controller_interpolation_set_from_list)
   g_value_unset (&tval->value);
   g_free (tval);
   g_slist_free (list);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1404,7 +1344,6 @@ GST_END_TEST;
 /* test lfo control source with sine waveform */
 GST_START_TEST (controller_lfo_sine)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
   GValue amp = { 0, }
@@ -1414,14 +1353,14 @@ GST_START_TEST (controller_lfo_sine)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set amplitude and offset values */
@@ -1435,36 +1374,34 @@ GST_START_TEST (controller_lfo_sine)
       "frequency", 1.0, "timeshift", (GstClockTime) 0,
       "amplitude", &amp, "offset", &off, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1473,7 +1410,6 @@ GST_END_TEST;
 /* test lfo control source with sine waveform and timeshift */
 GST_START_TEST (controller_lfo_sine_timeshift)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
   GValue amp = { 0, }
@@ -1483,14 +1419,14 @@ GST_START_TEST (controller_lfo_sine_timeshift)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set amplitude and offset values */
@@ -1504,36 +1440,34 @@ GST_START_TEST (controller_lfo_sine_timeshift)
       "frequency", 1.0, "timeshift", 250 * GST_MSECOND,
       "amplitude", &amp, "offset", &off, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
 /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1542,7 +1476,6 @@ GST_END_TEST;
 /* test lfo control source with square waveform */
 GST_START_TEST (controller_lfo_square)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
   GValue amp = { 0, }
@@ -1552,14 +1485,14 @@ GST_START_TEST (controller_lfo_square)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set amplitude and offset values */
@@ -1573,36 +1506,34 @@ GST_START_TEST (controller_lfo_square)
       "frequency", 1.0, "timeshift", (GstClockTime) 0,
       "amplitude", &amp, "offset", &off, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1611,7 +1542,6 @@ GST_END_TEST;
 /* test lfo control source with saw waveform */
 GST_START_TEST (controller_lfo_saw)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
   GValue amp = { 0, }
@@ -1621,14 +1551,14 @@ GST_START_TEST (controller_lfo_saw)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set amplitude and offset values */
@@ -1642,36 +1572,34 @@ GST_START_TEST (controller_lfo_saw)
       "frequency", 1.0, "timeshift", (GstClockTime) 0,
       "amplitude", &amp, "offset", &off, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1680,7 +1608,6 @@ GST_END_TEST;
 /* test lfo control source with reverse saw waveform */
 GST_START_TEST (controller_lfo_rsaw)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
   GValue amp = { 0, }
@@ -1690,14 +1617,14 @@ GST_START_TEST (controller_lfo_rsaw)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set amplitude and offset values */
@@ -1711,36 +1638,34 @@ GST_START_TEST (controller_lfo_rsaw)
       "frequency", 1.0, "timeshift", (GstClockTime) 0,
       "amplitude", &amp, "offset", &off, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1749,7 +1674,6 @@ GST_END_TEST;
 /* test lfo control source with saw waveform */
 GST_START_TEST (controller_lfo_triangle)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
   GValue amp = { 0, }
@@ -1759,14 +1683,14 @@ GST_START_TEST (controller_lfo_triangle)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set amplitude and offset values */
@@ -1780,36 +1704,34 @@ GST_START_TEST (controller_lfo_triangle)
       "frequency", 1.0, "timeshift", (GstClockTime) 0,
       "amplitude", &amp, "offset", &off, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1818,53 +1740,50 @@ GST_END_TEST;
 /* test lfo control source with nothing set */
 GST_START_TEST (controller_lfo_none)
 {
-  GstController *ctrl;
   GstLFOControlSource *csource;
   GstElement *elem;
 
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_lfo_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps */
-  gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2000 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1250 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1500 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
-  gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1888,54 +1807,9 @@ GST_START_TEST (controller_helper_any_gobject)
 
 GST_END_TEST;
 
-GST_START_TEST (controller_refcount_new_list)
-{
-  GstController *ctrl;
-  GstElement *elem;
-  GList *list = NULL;
-
-  /* that property should exist and should be controllable */
-  elem = gst_element_factory_make ("testmonosource", "test_source");
-  list = g_list_append (NULL, (char *) "ulong");
-  ctrl = gst_controller_new_list (GST_OBJECT (elem), list);
-  fail_unless (ctrl != NULL, NULL);
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1);
-  g_list_free (list);
-  g_object_unref (ctrl);
-  gst_object_unref (elem);
-
-  /* try the same property twice, make sure the refcount is still 1 */
-  elem = gst_element_factory_make ("testmonosource", "test_source");
-  list = g_list_append (NULL, (char *) "ulong");
-  list = g_list_append (list, (char *) "ulong");
-  ctrl = gst_controller_new_list (GST_OBJECT (elem), list);
-  fail_unless (ctrl != NULL, NULL);
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1);
-  g_list_free (list);
-  g_object_unref (ctrl);
-  gst_object_unref (elem);
-
-  /* try two properties, make sure the refcount is still 1 */
-  elem = gst_element_factory_make ("testmonosource", "test_source");
-  list = g_list_append (NULL, (char *) "ulong");
-  list = g_list_append (list, (char *) "boolean");
-  ctrl = gst_controller_new_list (GST_OBJECT (elem), list);
-  fail_unless (ctrl != NULL, NULL);
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  fail_unless_equals_int (G_OBJECT (ctrl)->ref_count, 1);
-  g_list_free (list);
-  g_object_unref (ctrl);
-  gst_object_unref (elem);
-}
-
-GST_END_TEST;
-
 /* test linear interpolation for ts < first control point */
 GST_START_TEST (controller_interpolate_linear_before_ts0)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -1944,14 +1818,14 @@ GST_START_TEST (controller_interpolate_linear_before_ts0)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -1971,24 +1845,22 @@ GST_START_TEST (controller_interpolate_linear_before_ts0)
       &val_ulong);
   fail_unless (res, NULL);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
   /* now pull in values for some timestamps after first control point */
-  gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
-  gst_controller_sync_values (ctrl, 3 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 3 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 4 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
 
   /* now pull in values for some timestamps before first control point */
-  gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
-  gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+  gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
   fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -1997,7 +1869,6 @@ GST_END_TEST;
 /* test control-point handling in interpolation control source */
 GST_START_TEST (controller_interpolation_cp_count)
 {
-  GstController *ctrl;
   GstInterpolationControlSource *csource;
   GstElement *elem;
   gboolean res;
@@ -2006,14 +1877,14 @@ GST_START_TEST (controller_interpolation_cp_count)
   elem = gst_element_factory_make ("testmonosource", "test_source");
 
   /* that property should exist and should be controllable */
-  ctrl = gst_controller_new (GST_OBJECT (elem), "ulong", NULL);
-  fail_unless (ctrl != NULL, NULL);
+  fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
+          NULL));
 
   /* Get interpolation control source */
   csource = gst_interpolation_control_source_new ();
 
   fail_unless (csource != NULL);
-  fail_unless (gst_controller_set_control_source (ctrl, "ulong",
+  fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "ulong",
           GST_CONTROL_SOURCE (csource)));
 
   /* set interpolation mode */
@@ -2046,10 +1917,8 @@ GST_START_TEST (controller_interpolation_cp_count)
   fail_unless (res, NULL);
   fail_unless (gst_interpolation_control_source_get_count (csource) == 0);
 
-  g_object_unref (G_OBJECT (csource));
+  g_object_unref (csource);
 
-  GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
-  g_object_unref (ctrl);
   gst_object_unref (elem);
 }
 
@@ -2064,7 +1933,6 @@ gst_controller_suite (void)
 
   suite_add_tcase (s, tc);
   tcase_add_checked_fixture (tc, setup, teardown);
-  tcase_add_test (tc, controller_refcount_new_list);
   tcase_add_test (tc, controller_new_fail1);
   tcase_add_test (tc, controller_new_fail2);
   tcase_add_test (tc, controller_new_fail3);
index 22d54b2..39e5ef2 100644 (file)
@@ -16,7 +16,6 @@ main (gint argc, gchar ** argv)
   gint res = 1;
   GstElement *src, *sink;
   GstElement *bin;
-  GstController *ctrl;
   GstInterpolationControlSource *csource1, *csource2;
   GstClock *clock;
   GstClockID clock_id;
@@ -50,7 +49,7 @@ main (gint argc, gchar ** argv)
    */
 
   /* add a controller to the source */
-  if (!(ctrl = gst_controller_new (GST_OBJECT (src), "freq", "volume", NULL))) {
+  if (!gst_object_control_properties (GST_OBJECT (src), "freq", "volume", NULL)) {
     GST_WARNING ("can't control source element");
     goto Error;
   }
@@ -58,9 +57,9 @@ main (gint argc, gchar ** argv)
   csource1 = gst_interpolation_control_source_new ();
   csource2 = gst_interpolation_control_source_new ();
 
-  gst_controller_set_control_source (ctrl, "volume",
+  gst_object_set_control_source (GST_OBJECT (src), "volume",
       GST_CONTROL_SOURCE (csource1));
-  gst_controller_set_control_source (ctrl, "freq",
+  gst_object_set_control_source (GST_OBJECT (src), "freq",
       GST_CONTROL_SOURCE (csource2));
 
   /* Set interpolation mode */
@@ -101,7 +100,6 @@ main (gint argc, gchar ** argv)
   }
 
   /* cleanup */
-  g_object_unref (G_OBJECT (ctrl));
   gst_clock_id_unref (clock_id);
   gst_object_unref (G_OBJECT (clock));
   gst_object_unref (G_OBJECT (bin));