gstreamer_core/libs/gst/controller/gstinterpolation.c
branchRCL_3
changeset 29 567bb019e3e3
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gstreamer_core/libs/gst/controller/gstinterpolation.c	Wed Mar 31 22:03:18 2010 +0300
+++ b/gstreamer_core/libs/gst/controller/gstinterpolation.c	Tue Aug 31 15:30:33 2010 +0300
@@ -1,7 +1,7 @@
 /* GStreamer
  *
  * Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
+ * Copyright (C) 2007,2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
  *
  * gstinterpolation.c: Interpolation methods for dynamic properties
  *
@@ -41,70 +41,53 @@
 
 /* common helper */
 
+static gint
+gst_control_point_find (gconstpointer p1, gconstpointer p2)
+{
+  GstClockTime ct1 = ((GstControlPoint *) p1)->timestamp;
+  GstClockTime ct2 = *(GstClockTime *) p2;
+
+  return ((ct1 < ct2) ? -1 : ((ct1 == ct2) ? 0 : 1));
+}
+
 /*
- * gst_interpolation_control_source_find_control_point_node:
+ * gst_interpolation_control_source_find_control_point_iter:
  * @self: the interpolation control source to search in
  * @timestamp: the search key
  *
  * Find last value before given timestamp in control point list.
  *
- * Returns: the found #GList node or %NULL
+ * Returns: the found #GSequenceIter or %NULL
  */
-static GList *gst_interpolation_control_source_find_control_point_node
+static GSequenceIter *gst_interpolation_control_source_find_control_point_iter
     (GstInterpolationControlSource * self, GstClockTime timestamp)
 {
-  GList *prev_node = g_list_last (self->priv->values);
-  GList *node;
+  GSequenceIter *iter;
   GstControlPoint *cp;
 
-  /* Check if we can start from the last requested value
-   * to save some time */
-  node = self->priv->values;
-  if (self->priv->last_requested_value) {
-    GstControlPoint *last_cp = self->priv->last_requested_value->data;
-
-    if (timestamp > last_cp->timestamp)
-      node = self->priv->last_requested_value;
-  }
+  if (!self->priv->values)
+    return NULL;
 
-  /* iterate over timed value list */
-  for (; node; node = g_list_next (node)) {
-    cp = node->data;
-    /* this timestamp is newer that the one we look for */
-    if (timestamp < cp->timestamp) {
-      /* get previous one again */
-      prev_node = g_list_previous (node);
-      break;
-    }
-  }
+  iter =
+      g_sequence_search (self->priv->values, &timestamp,
+      (GCompareDataFunc) gst_control_point_find, NULL);
+
+  /* g_sequence_search() returns the iter where timestamp
+   * would be inserted, i.e. the iter > timestamp, so
+   * we need to get the previous one */
+  iter = g_sequence_iter_prev (iter);
 
-  /* If we have something to return save it as a
-   * potential start position for the next search */
-  if (prev_node)
-    self->priv->last_requested_value = prev_node;
-
-  return prev_node;
-}
+  /* g_sequence_iter_prev () on the begin iter returns
+   * the begin iter. Check if the prev iter is still
+   * after our timestamp, in that case return NULL
+   */
+  cp = g_sequence_get (iter);
+  if (cp->timestamp > timestamp)
+    return NULL;
 
-/*
- * gst_interpolation_control_source_get_first_value:
- * @self: the interpolation control source to search in
- *
- * Find the first value and return it.
- *
- * Returns: the found #GValue or %NULL if there are none.
- */
-static inline GValue *
-gst_interpolation_control_source_get_first_value (GstInterpolationControlSource
-    * self)
-{
-  if (self->priv->values && self->priv->nvalues > 0) {
-    GstControlPoint *cp = self->priv->values->data;
-
-    return &cp->value;
-  } else {
-    return NULL;
-  }
+  /* If the iter is the end iter return NULL as no
+   * data is linked to the end iter */
+  return G_UNLIKELY (g_sequence_iter_is_end (iter)) ? NULL : iter;
 }
 
 /*  steps-like (no-)interpolation, default */
@@ -115,11 +98,11 @@
 _interpolate_none_get_##type (GstInterpolationControlSource *self, GstClockTime timestamp) \
 { \
   GValue *ret; \
-  GList *node; \
+  GSequenceIter *iter; \
   \
-  if ((node = \
-          gst_interpolation_control_source_find_control_point_node (self, timestamp))) { \
-    GstControlPoint *cp = node->data; \
+  if ((iter = \
+          gst_interpolation_control_source_find_control_point_iter (self, timestamp))) { \
+    GstControlPoint *cp = g_sequence_get (iter); \
     g##type ret_val = g_value_get_##type (&cp->value); \
     \
     if (g_value_get_##type (&self->priv->minimum_value) > ret_val) \
@@ -129,7 +112,7 @@
     else \
       ret = &cp->value; \
   } else { \
-    ret = gst_interpolation_control_source_get_first_value (self); \
+    ret = &self->priv->default_value; \
   } \
   return ret; \
 } \
@@ -161,7 +144,7 @@
   \
   g_mutex_lock (self->lock); \
   for(i = 0; i < value_array->nbsamples; i++) { \
-    ret = _interpolate_none_get_##type (self, timestamp); \
+    ret = _interpolate_none_get_##type (self, ts); \
     if (!ret) { \
       g_mutex_unlock (self->lock); \
       return FALSE; \
@@ -189,17 +172,17 @@
 _interpolate_none_get (GstInterpolationControlSource * self,
     GstClockTime timestamp)
 {
-  GList *node;
+  GSequenceIter *iter;
   GValue *ret;
 
-  if ((node =
-          gst_interpolation_control_source_find_control_point_node (self,
+  if ((iter =
+          gst_interpolation_control_source_find_control_point_iter (self,
               timestamp))) {
-    GstControlPoint *cp = node->data;
+    GstControlPoint *cp = g_sequence_get (iter);
 
     ret = &cp->value;
   } else {
-    ret = gst_interpolation_control_source_get_first_value (self);
+    ret = &self->priv->default_value;
   }
   return ret;
 }
@@ -234,7 +217,7 @@
 
   g_mutex_lock (self->lock);
   for (i = 0; i < value_array->nbsamples; i++) {
-    ret = _interpolate_none_get (self, timestamp);
+    ret = _interpolate_none_get (self, ts);
     if (!ret) {
       g_mutex_unlock (self->lock);
       return FALSE;
@@ -258,7 +241,7 @@
 
   g_mutex_lock (self->lock);
   for (i = 0; i < value_array->nbsamples; i++) {
-    ret = _interpolate_none_get (self, timestamp);
+    ret = _interpolate_none_get (self, ts);
     if (!ret) {
       g_mutex_unlock (self->lock);
       return FALSE;
@@ -282,7 +265,7 @@
 
   g_mutex_lock (self->lock);
   for (i = 0; i < value_array->nbsamples; i++) {
-    ret = _interpolate_none_get (self, timestamp);
+    ret = _interpolate_none_get (self, ts);
     if (!ret) {
       g_mutex_unlock (self->lock);
       return FALSE;
@@ -327,13 +310,13 @@
 static inline GValue * \
 _interpolate_trigger_get_##type (GstInterpolationControlSource *self, GstClockTime timestamp) \
 { \
-  GList *node; \
+  GSequenceIter *iter; \
   GstControlPoint *cp; \
   \
   /* check if there is a value at the registered timestamp */ \
-  if ((node = \
-          gst_interpolation_control_source_find_control_point_node (self, timestamp))) { \
-    cp = node->data; \
+  if ((iter = \
+          gst_interpolation_control_source_find_control_point_iter (self, timestamp))) { \
+    cp = g_sequence_get (iter); \
     if (timestamp == cp->timestamp) { \
       g##type ret = g_value_get_##type (&cp->value); \
       if (g_value_get_##type (&self->priv->minimum_value) > ret) \
@@ -377,7 +360,7 @@
   \
   g_mutex_lock (self->lock); \
   for(i = 0; i < value_array->nbsamples; i++) { \
-    ret = _interpolate_trigger_get_##type (self, timestamp); \
+    ret = _interpolate_trigger_get_##type (self, ts); \
     if (!ret) { \
       g_mutex_unlock (self->lock); \
       return FALSE; \
@@ -406,14 +389,14 @@
 _interpolate_trigger_get (GstInterpolationControlSource * self,
     GstClockTime timestamp)
 {
-  GList *node;
+  GSequenceIter *iter;
   GstControlPoint *cp;
 
   /* check if there is a value at the registered timestamp */
-  if ((node =
-          gst_interpolation_control_source_find_control_point_node (self,
+  if ((iter =
+          gst_interpolation_control_source_find_control_point_iter (self,
               timestamp))) {
-    cp = node->data;
+    cp = g_sequence_get (iter);
     if (timestamp == cp->timestamp) {
       return &cp->value;
     }
@@ -452,7 +435,7 @@
 
   g_mutex_lock (self->lock);
   for (i = 0; i < value_array->nbsamples; i++) {
-    ret = _interpolate_trigger_get (self, timestamp);
+    ret = _interpolate_trigger_get (self, ts);
     if (!ret) {
       g_mutex_unlock (self->lock);
       return FALSE;
@@ -476,7 +459,7 @@
 
   g_mutex_lock (self->lock);
   for (i = 0; i < value_array->nbsamples; i++) {
-    ret = _interpolate_trigger_get (self, timestamp);
+    ret = _interpolate_trigger_get (self, ts);
     if (!ret) {
       g_mutex_unlock (self->lock);
       return FALSE;
@@ -500,7 +483,7 @@
 
   g_mutex_lock (self->lock);
   for (i = 0; i < value_array->nbsamples; i++) {
-    ret = _interpolate_trigger_get (self, timestamp);
+    ret = _interpolate_trigger_get (self, ts);
     if (!ret) {
       g_mutex_unlock (self->lock);
       return FALSE;
@@ -541,51 +524,55 @@
 /*  linear interpolation */
 /*  smoothes inbetween values */
 
-#define DEFINE_LINEAR_GET(type,round,convert) \
+#define DEFINE_LINEAR_GET(vtype,round,convert) \
 static inline gboolean \
-_interpolate_linear_get_##type (GstInterpolationControlSource *self, GstClockTime timestamp, g##type *ret) \
+_interpolate_linear_get_##vtype (GstInterpolationControlSource *self, GstClockTime timestamp, g##vtype *ret) \
 { \
-  GList *node; \
+  GSequenceIter *iter; \
+  GstControlPoint *cp1 = NULL, *cp2, cp={0,}; \
   \
-  if ((node = gst_interpolation_control_source_find_control_point_node (self, timestamp))) { \
-    GstControlPoint *cp1, *cp2; \
+  iter = gst_interpolation_control_source_find_control_point_iter (self, timestamp); \
+  if (iter) { \
+    cp1 = g_sequence_get (iter); \
+    iter = g_sequence_iter_next (iter); \
+    iter = g_sequence_iter_is_end (iter) ? NULL : iter; \
+  } else { \
+    cp.timestamp = G_GUINT64_CONSTANT(0); \
+    g_value_init (&cp.value, self->priv->type); \
+    g_value_copy (&self->priv->default_value, &cp.value); \
+    cp1 = &cp; \
+    if (G_LIKELY (self->priv->values)) \
+      iter = g_sequence_get_begin_iter (self->priv->values); \
+  } \
+  if (iter) { \
+    gdouble slope; \
+    g##vtype value1,value2; \
     \
-    cp1 = node->data; \
-    if ((node = g_list_next (node))) { \
-      gdouble slope; \
-      g##type value1,value2; \
-      \
-      cp2 = node->data; \
-      \
-      value1 = g_value_get_##type (&cp1->value); \
-      value2 = g_value_get_##type (&cp2->value); \
-      slope = (gdouble) convert (value2 - value1) / gst_guint64_to_gdouble (cp2->timestamp - cp1->timestamp); \
-      \
-      if (round) \
-        *ret = (g##type) (convert (value1) + gst_guint64_to_gdouble (timestamp - cp1->timestamp) * slope + 0.5); \
-      else \
-        *ret = (g##type) (convert (value1) + gst_guint64_to_gdouble (timestamp - cp1->timestamp) * slope); \
-    } \
-    else { \
-      *ret = g_value_get_##type (&cp1->value); \
-    } \
-  } else { \
-    GValue *first = gst_interpolation_control_source_get_first_value (self); \
-    if (!first) \
-      return FALSE; \
-    *ret = g_value_get_##type (first); \
+    cp2 = g_sequence_get (iter); \
+    \
+    value1 = g_value_get_##vtype (&cp1->value); \
+    value2 = g_value_get_##vtype (&cp2->value); \
+    slope = ((gdouble) convert (value2) - (gdouble) convert (value1)) / gst_guint64_to_gdouble (cp2->timestamp - cp1->timestamp); \
+    \
+    if (round) \
+      *ret = (g##vtype) (convert (value1) + gst_guint64_to_gdouble (timestamp - cp1->timestamp) * slope + 0.5); \
+    else \
+      *ret = (g##vtype) (convert (value1) + gst_guint64_to_gdouble (timestamp - cp1->timestamp) * slope); \
   } \
-  *ret = CLAMP (*ret, g_value_get_##type (&self->priv->minimum_value), g_value_get_##type (&self->priv->maximum_value)); \
+  else { \
+    *ret = g_value_get_##vtype (&cp1->value); \
+  } \
+  *ret = CLAMP (*ret, g_value_get_##vtype (&self->priv->minimum_value), g_value_get_##vtype (&self->priv->maximum_value)); \
   return TRUE; \
 } \
 \
 static gboolean \
-interpolate_linear_get_##type (GstInterpolationControlSource *self, GstClockTime timestamp, GValue *value) \
+interpolate_linear_get_##vtype (GstInterpolationControlSource *self, GstClockTime timestamp, GValue *value) \
 { \
-  g##type ret; \
+  g##vtype ret; \
   g_mutex_lock (self->lock); \
-  if (_interpolate_linear_get_##type (self, timestamp, &ret)) { \
-    g_value_set_##type (value, ret); \
+  if (_interpolate_linear_get_##vtype (self, timestamp, &ret)) { \
+    g_value_set_##vtype (value, ret); \
     g_mutex_unlock (self->lock); \
     return TRUE; \
   } \
@@ -594,16 +581,16 @@
 } \
 \
 static gboolean \
-interpolate_linear_get_##type##_value_array (GstInterpolationControlSource *self, \
+interpolate_linear_get_##vtype##_value_array (GstInterpolationControlSource *self, \
     GstClockTime timestamp, GstValueArray * value_array) \
 { \
   gint i; \
   GstClockTime ts = timestamp; \
-  g##type *values = (g##type *) value_array->values; \
+  g##vtype *values = (g##vtype *) value_array->values; \
   \
   g_mutex_lock (self->lock); \
   for(i = 0; i < value_array->nbsamples; i++) { \
-    if (! _interpolate_linear_get_##type (self, ts, values)) { \
+    if (! _interpolate_linear_get_##vtype (self, ts, values)) { \
       g_mutex_unlock (self->lock); \
       return FALSE; \
     } \
@@ -621,7 +608,7 @@
 
 DEFINE_LINEAR_GET (ulong, TRUE, EMPTY);
 DEFINE_LINEAR_GET (int64, TRUE, EMPTY);
-DEFINE_LINEAR_GET (uint64, TRUE, gst_util_guint64_to_gdouble);
+DEFINE_LINEAR_GET (uint64, TRUE, gst_guint64_to_gdouble);
 DEFINE_LINEAR_GET (float, FALSE, EMPTY);
 DEFINE_LINEAR_GET (double, FALSE, EMPTY);
 
@@ -667,9 +654,9 @@
  *    .    .    .    .    .
  */
 
-#define DEFINE_CUBIC_GET(type,round, convert) \
+#define DEFINE_CUBIC_GET(vtype,round, convert) \
 static void \
-_interpolate_cubic_update_cache_##type (GstInterpolationControlSource *self) \
+_interpolate_cubic_update_cache_##vtype (GstInterpolationControlSource *self) \
 { \
   gint i, n = self->priv->nvalues; \
   gdouble *o = g_new0 (gdouble, n); \
@@ -680,24 +667,24 @@
   gdouble *b = g_new0 (gdouble, n); \
   gdouble *z = g_new0 (gdouble, n); \
   \
-  GList *node; \
+  GSequenceIter *iter; \
   GstControlPoint *cp; \
   GstClockTime x_prev, x, x_next; \
-  g##type y_prev, y, y_next; \
+  g##vtype y_prev, y, y_next; \
   \
   /* Fill linear system of equations */ \
-  node = self->priv->values; \
-  cp = node->data; \
+  iter = g_sequence_get_begin_iter (self->priv->values); \
+  cp = g_sequence_get (iter); \
   x = cp->timestamp; \
-  y = g_value_get_##type (&cp->value); \
+  y = g_value_get_##vtype (&cp->value); \
   \
   p[0] = 1.0; \
   \
-  node = node->next; \
-  cp = node->data; \
+  iter = g_sequence_iter_next (iter); \
+  cp = g_sequence_get (iter); \
   x_next = cp->timestamp; \
-  y_next = g_value_get_##type (&cp->value); \
-  h[0] = gst_util_guint64_to_gdouble (x_next - x); \
+  y_next = g_value_get_##vtype (&cp->value); \
+  h[0] = gst_guint64_to_gdouble (x_next - x); \
   \
   for (i = 1; i < n-1; i++) { \
     /* Shuffle x and y values */ \
@@ -705,12 +692,12 @@
     y_prev = y; \
     x = x_next; \
     y = y_next; \
-    node = node->next; \
-    cp = node->data; \
+    iter = g_sequence_iter_next (iter); \
+    cp = g_sequence_get (iter); \
     x_next = cp->timestamp; \
-    y_next = g_value_get_##type (&cp->value); \
+    y_next = g_value_get_##vtype (&cp->value); \
     \
-    h[i] = gst_util_guint64_to_gdouble (x_next - x); \
+    h[i] = gst_guint64_to_gdouble (x_next - x); \
     o[i] = h[i-1]; \
     p[i] = 2.0 * (h[i-1] + h[i]); \
     q[i] = h[i]; \
@@ -732,12 +719,12 @@
   \
   /* Save cache next in the GstControlPoint */ \
   \
-  node = self->priv->values; \
+  iter = g_sequence_get_begin_iter (self->priv->values); \
   for (i = 0; i < n; i++) { \
-    cp = node->data; \
+    cp = g_sequence_get (iter); \
     cp->cache.cubic.h = h[i]; \
     cp->cache.cubic.z = z[i]; \
-    node = node->next; \
+    iter = g_sequence_iter_next (iter); \
   } \
   \
   /* Free our temporary arrays */ \
@@ -750,64 +737,67 @@
 } \
 \
 static inline gboolean \
-_interpolate_cubic_get_##type (GstInterpolationControlSource *self, GstClockTime timestamp, g##type *ret) \
+_interpolate_cubic_get_##vtype (GstInterpolationControlSource *self, GstClockTime timestamp, g##vtype *ret) \
 { \
-  GList *node; \
+  GSequenceIter *iter; \
+  GstControlPoint *cp1 = NULL, *cp2, cp={0,}; \
   \
   if (self->priv->nvalues <= 2) \
-    return _interpolate_linear_get_##type (self, timestamp, ret); \
+    return _interpolate_linear_get_##vtype (self, timestamp, ret); \
   \
   if (!self->priv->valid_cache) { \
-    _interpolate_cubic_update_cache_##type (self); \
+    _interpolate_cubic_update_cache_##vtype (self); \
     self->priv->valid_cache = TRUE; \
   } \
   \
-  if ((node = gst_interpolation_control_source_find_control_point_node (self, timestamp))) { \
-    GstControlPoint *cp1, *cp2; \
+  iter = gst_interpolation_control_source_find_control_point_iter (self, timestamp); \
+  if (iter) { \
+    cp1 = g_sequence_get (iter); \
+    iter = g_sequence_iter_next (iter); \
+    iter = g_sequence_iter_is_end (iter) ? NULL : iter; \
+  } else { \
+    cp.timestamp = G_GUINT64_CONSTANT(0); \
+    g_value_init (&cp.value, self->priv->type); \
+    g_value_copy (&self->priv->default_value, &cp.value); \
+    cp1 = &cp; \
+    iter = g_sequence_get_begin_iter (self->priv->values); \
+  } \
+  if (iter) { \
+    gdouble diff1, diff2; \
+    g##vtype value1,value2; \
+    gdouble out; \
+    \
+    cp2 = g_sequence_get (iter); \
     \
-    cp1 = node->data; \
-    if ((node = g_list_next (node))) { \
-      gdouble diff1, diff2; \
-      g##type value1,value2; \
-      gdouble out; \
-      \
-      cp2 = node->data; \
-      \
-      value1 = g_value_get_##type (&cp1->value); \
-      value2 = g_value_get_##type (&cp2->value); \
-      \
-      diff1 = gst_guint64_to_gdouble (timestamp - cp1->timestamp); \
-      diff2 = gst_guint64_to_gdouble (cp2->timestamp - timestamp); \
-      \
-      out = (cp2->cache.cubic.z * diff1 * diff1 * diff1 + cp1->cache.cubic.z * diff2 * diff2 * diff2) / cp1->cache.cubic.h; \
-      out += (convert (value2) / cp1->cache.cubic.h - cp1->cache.cubic.h * cp2->cache.cubic.z) * diff1; \
-      out += (convert (value1) / cp1->cache.cubic.h - cp1->cache.cubic.h * cp1->cache.cubic.z) * diff2; \
-      \
-      if (round) \
-        *ret = (g##type) (out + 0.5); \
-      else \
-        *ret = (g##type) out; \
-    } \
-    else { \
-      *ret = g_value_get_##type (&cp1->value); \
-    } \
-  } else { \
-    GValue *first = gst_interpolation_control_source_get_first_value (self); \
-    if (!first) \
-      return FALSE; \
-    *ret = g_value_get_##type (first); \
+    value1 = g_value_get_##vtype (&cp1->value); \
+    value2 = g_value_get_##vtype (&cp2->value); \
+    \
+    diff1 = gst_guint64_to_gdouble (timestamp - cp1->timestamp); \
+    diff2 = gst_guint64_to_gdouble (cp2->timestamp - timestamp); \
+    \
+    out = (cp2->cache.cubic.z * diff1 * diff1 * diff1 + cp1->cache.cubic.z * diff2 * diff2 * diff2) / cp1->cache.cubic.h; \
+    out += (convert (value2) / cp1->cache.cubic.h - cp1->cache.cubic.h * cp2->cache.cubic.z) * diff1; \
+    out += (convert (value1) / cp1->cache.cubic.h - cp1->cache.cubic.h * cp1->cache.cubic.z) * diff2; \
+    \
+    if (round) \
+      *ret = (g##vtype) (out + 0.5); \
+    else \
+      *ret = (g##vtype) out; \
   } \
-  *ret = CLAMP (*ret, g_value_get_##type (&self->priv->minimum_value), g_value_get_##type (&self->priv->maximum_value)); \
+  else { \
+    *ret = g_value_get_##vtype (&cp1->value); \
+  } \
+  *ret = CLAMP (*ret, g_value_get_##vtype (&self->priv->minimum_value), g_value_get_##vtype (&self->priv->maximum_value)); \
   return TRUE; \
 } \
 \
 static gboolean \
-interpolate_cubic_get_##type (GstInterpolationControlSource *self, GstClockTime timestamp, GValue *value) \
+interpolate_cubic_get_##vtype (GstInterpolationControlSource *self, GstClockTime timestamp, GValue *value) \
 { \
-  g##type ret; \
+  g##vtype ret; \
   g_mutex_lock (self->lock); \
-  if (_interpolate_cubic_get_##type (self, timestamp, &ret)) { \
-    g_value_set_##type (value, ret); \
+  if (_interpolate_cubic_get_##vtype (self, timestamp, &ret)) { \
+    g_value_set_##vtype (value, ret); \
     g_mutex_unlock (self->lock); \
     return TRUE; \
   } \
@@ -816,16 +806,16 @@
 } \
 \
 static gboolean \
-interpolate_cubic_get_##type##_value_array (GstInterpolationControlSource *self, \
+interpolate_cubic_get_##vtype##_value_array (GstInterpolationControlSource *self, \
     GstClockTime timestamp, GstValueArray * value_array) \
 { \
   gint i; \
   GstClockTime ts = timestamp; \
-  g##type *values = (g##type *) value_array->values; \
+  g##vtype *values = (g##vtype *) value_array->values; \
   \
   g_mutex_lock (self->lock); \
   for(i = 0; i < value_array->nbsamples; i++) { \
-    if (! _interpolate_cubic_get_##type (self, ts, values)) { \
+    if (! _interpolate_cubic_get_##vtype (self, ts, values)) { \
       g_mutex_unlock (self->lock); \
       return FALSE; \
     } \
@@ -843,7 +833,7 @@
 
 DEFINE_CUBIC_GET (ulong, TRUE, EMPTY);
 DEFINE_CUBIC_GET (int64, TRUE, EMPTY);
-DEFINE_CUBIC_GET (uint64, TRUE, gst_util_guint64_to_gdouble);
+DEFINE_CUBIC_GET (uint64, TRUE, gst_guint64_to_gdouble);
 DEFINE_CUBIC_GET (float, FALSE, EMPTY);
 DEFINE_CUBIC_GET (double, FALSE, EMPTY);
 
@@ -872,9 +862,8 @@
   (GstControlSourceGetValueArray) NULL
 };
 
-
 /*  register all interpolation methods */
-GstInterpolateMethod *interpolation_methods[] = {
+GstInterpolateMethod *priv_gst_interpolation_methods[] = {
   &interpolate_none,
   &interpolate_trigger,
   &interpolate_linear,
@@ -882,4 +871,5 @@
   &interpolate_cubic
 };
 
-guint num_interpolation_methods = G_N_ELEMENTS (interpolation_methods);
+guint priv_gst_num_interpolation_methods =
+G_N_ELEMENTS (priv_gst_interpolation_methods);