Rewrite handling of default values. Fix overflow with unsigned types in linear interpolation. Remove now obsolete _fi...

Original commit message from CVS:
* libs/gst/controller/gstinterpolation.c:
* libs/gst/controller/gstinterpolationcontrolsource.c:
* tests/check/libs/controller.c:
Rewrite handling of default values. Fix overflow with unsigned types
in linear interpolation. Remove now obsolete _first_value() function.
Add more tests. Fixes #538201.
This commit is contained in:
Stefan Kost 2008-06-20 08:17:08 +00:00
parent 1380508f53
commit 27243ac326
4 changed files with 372 additions and 251 deletions

View file

@ -1,3 +1,12 @@
2008-06-20 Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/gstinterpolation.c:
* libs/gst/controller/gstinterpolationcontrolsource.c:
* tests/check/libs/controller.c:
Rewrite handling of default values. Fix overflow with unsigned types
in linear interpolation. Remove now obsolete _first_value() function.
Add more tests. Fixes #538201.
2008-06-20 Wim Taymans <wim.taymans@collabora.co.uk> 2008-06-20 Wim Taymans <wim.taymans@collabora.co.uk>
* libs/gst/base/gstbasetransform.c: * libs/gst/base/gstbasetransform.c:

View file

@ -80,27 +80,6 @@ static GList *gst_interpolation_control_source_find_control_point_node
return prev_node; return prev_node;
} }
/*
* 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;
}
}
/* steps-like (no-)interpolation, default */ /* steps-like (no-)interpolation, default */
/* just returns the value for the most recent key-frame */ /* just returns the value for the most recent key-frame */
@ -123,7 +102,7 @@ _interpolate_none_get_##type (GstInterpolationControlSource *self, GstClockTime
else \ else \
ret = &cp->value; \ ret = &cp->value; \
} else { \ } else { \
ret = gst_interpolation_control_source_get_first_value (self); \ ret = &self->priv->default_value; \
} \ } \
return ret; \ return ret; \
} \ } \
@ -193,7 +172,7 @@ _interpolate_none_get (GstInterpolationControlSource * self,
ret = &cp->value; ret = &cp->value;
} else { } else {
ret = gst_interpolation_control_source_get_first_value (self); ret = &self->priv->default_value;
} }
return ret; return ret;
} }
@ -535,51 +514,53 @@ static GstInterpolateMethod interpolate_trigger = {
/* linear interpolation */ /* linear interpolation */
/* smoothes inbetween values */ /* smoothes inbetween values */
#define DEFINE_LINEAR_GET(type,round,convert) \ #define DEFINE_LINEAR_GET(vtype,round,convert) \
static inline gboolean \ 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; \ GList *node; \
GstControlPoint *cp1 = NULL, *cp2, cp={0,}; \
\ \
if ((node = gst_interpolation_control_source_find_control_point_node (self, timestamp))) { \ node = gst_interpolation_control_source_find_control_point_node (self, timestamp); \
GstControlPoint *cp1, *cp2; \ if (node) { \
\
cp1 = node->data; \ cp1 = node->data; \
if ((node = g_list_next (node))) { \ 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 { \ } else { \
GValue *first = gst_interpolation_control_source_get_first_value (self); \ cp.timestamp = G_GUINT64_CONSTANT(0); \
if (!first) \ g_value_init (&cp.value, self->priv->type); \
return FALSE; \ g_value_copy (&self->priv->default_value, &cp.value); \
*ret = g_value_get_##type (first); \ cp1 = &cp; \
node = self->priv->values; \
} \ } \
*ret = CLAMP (*ret, g_value_get_##type (&self->priv->minimum_value), g_value_get_##type (&self->priv->maximum_value)); \ if (node) { \
gdouble slope; \
g##vtype value1,value2; \
\
cp2 = node->data; \
\
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); \
} \
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; \ return TRUE; \
} \ } \
\ \
static gboolean \ 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); \ g_mutex_lock (self->lock); \
if (_interpolate_linear_get_##type (self, timestamp, &ret)) { \ if (_interpolate_linear_get_##vtype (self, timestamp, &ret)) { \
g_value_set_##type (value, ret); \ g_value_set_##vtype (value, ret); \
g_mutex_unlock (self->lock); \ g_mutex_unlock (self->lock); \
return TRUE; \ return TRUE; \
} \ } \
@ -588,16 +569,16 @@ interpolate_linear_get_##type (GstInterpolationControlSource *self, GstClockTime
} \ } \
\ \
static gboolean \ static gboolean \
interpolate_linear_get_##type##_value_array (GstInterpolationControlSource *self, \ interpolate_linear_get_##vtype##_value_array (GstInterpolationControlSource *self, \
GstClockTime timestamp, GstValueArray * value_array) \ GstClockTime timestamp, GstValueArray * value_array) \
{ \ { \
gint i; \ gint i; \
GstClockTime ts = timestamp; \ GstClockTime ts = timestamp; \
g##type *values = (g##type *) value_array->values; \ g##vtype *values = (g##vtype *) value_array->values; \
\ \
g_mutex_lock (self->lock); \ g_mutex_lock (self->lock); \
for(i = 0; i < value_array->nbsamples; i++) { \ 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); \ g_mutex_unlock (self->lock); \
return FALSE; \ return FALSE; \
} \ } \
@ -661,9 +642,9 @@ static GstInterpolateMethod interpolate_linear = {
* . . . . . * . . . . .
*/ */
#define DEFINE_CUBIC_GET(type,round, convert) \ #define DEFINE_CUBIC_GET(vtype,round, convert) \
static void \ static void \
_interpolate_cubic_update_cache_##type (GstInterpolationControlSource *self) \ _interpolate_cubic_update_cache_##vtype (GstInterpolationControlSource *self) \
{ \ { \
gint i, n = self->priv->nvalues; \ gint i, n = self->priv->nvalues; \
gdouble *o = g_new0 (gdouble, n); \ gdouble *o = g_new0 (gdouble, n); \
@ -677,20 +658,20 @@ _interpolate_cubic_update_cache_##type (GstInterpolationControlSource *self) \
GList *node; \ GList *node; \
GstControlPoint *cp; \ GstControlPoint *cp; \
GstClockTime x_prev, x, x_next; \ 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 */ \ /* Fill linear system of equations */ \
node = self->priv->values; \ node = self->priv->values; \
cp = node->data; \ cp = node->data; \
x = cp->timestamp; \ x = cp->timestamp; \
y = g_value_get_##type (&cp->value); \ y = g_value_get_##vtype (&cp->value); \
\ \
p[0] = 1.0; \ p[0] = 1.0; \
\ \
node = node->next; \ node = node->next; \
cp = node->data; \ cp = node->data; \
x_next = cp->timestamp; \ x_next = cp->timestamp; \
y_next = g_value_get_##type (&cp->value); \ y_next = g_value_get_##vtype (&cp->value); \
h[0] = gst_util_guint64_to_gdouble (x_next - x); \ h[0] = gst_util_guint64_to_gdouble (x_next - x); \
\ \
for (i = 1; i < n-1; i++) { \ for (i = 1; i < n-1; i++) { \
@ -702,7 +683,7 @@ _interpolate_cubic_update_cache_##type (GstInterpolationControlSource *self) \
node = node->next; \ node = node->next; \
cp = node->data; \ cp = node->data; \
x_next = cp->timestamp; \ 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_util_guint64_to_gdouble (x_next - x); \
o[i] = h[i-1]; \ o[i] = h[i-1]; \
@ -744,64 +725,66 @@ _interpolate_cubic_update_cache_##type (GstInterpolationControlSource *self) \
} \ } \
\ \
static inline gboolean \ 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; \ GList *node; \
GstControlPoint *cp1 = NULL, *cp2, cp={0,}; \
\ \
if (self->priv->nvalues <= 2) \ 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) { \ if (!self->priv->valid_cache) { \
_interpolate_cubic_update_cache_##type (self); \ _interpolate_cubic_update_cache_##vtype (self); \
self->priv->valid_cache = TRUE; \ self->priv->valid_cache = TRUE; \
} \ } \
\ \
if ((node = gst_interpolation_control_source_find_control_point_node (self, timestamp))) { \ node = gst_interpolation_control_source_find_control_point_node (self, timestamp); \
GstControlPoint *cp1, *cp2; \ if (node) { \
\
cp1 = node->data; \ cp1 = node->data; \
if ((node = g_list_next (node))) { \ 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 { \ } else { \
GValue *first = gst_interpolation_control_source_get_first_value (self); \ cp.timestamp = G_GUINT64_CONSTANT(0); \
if (!first) \ g_value_init (&cp.value, self->priv->type); \
return FALSE; \ g_value_copy (&self->priv->default_value, &cp.value); \
*ret = g_value_get_##type (first); \ cp1 = &cp; \
node = self->priv->values; \
} \ } \
*ret = CLAMP (*ret, g_value_get_##type (&self->priv->minimum_value), g_value_get_##type (&self->priv->maximum_value)); \ if (node) { \
gdouble diff1, diff2; \
g##vtype value1,value2; \
gdouble out; \
\
cp2 = node->data; \
\
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; \
} \
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; \ return TRUE; \
} \ } \
\ \
static gboolean \ 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); \ g_mutex_lock (self->lock); \
if (_interpolate_cubic_get_##type (self, timestamp, &ret)) { \ if (_interpolate_cubic_get_##vtype (self, timestamp, &ret)) { \
g_value_set_##type (value, ret); \ g_value_set_##vtype (value, ret); \
g_mutex_unlock (self->lock); \ g_mutex_unlock (self->lock); \
return TRUE; \ return TRUE; \
} \ } \
@ -810,16 +793,16 @@ interpolate_cubic_get_##type (GstInterpolationControlSource *self, GstClockTime
} \ } \
\ \
static gboolean \ static gboolean \
interpolate_cubic_get_##type##_value_array (GstInterpolationControlSource *self, \ interpolate_cubic_get_##vtype##_value_array (GstInterpolationControlSource *self, \
GstClockTime timestamp, GstValueArray * value_array) \ GstClockTime timestamp, GstValueArray * value_array) \
{ \ { \
gint i; \ gint i; \
GstClockTime ts = timestamp; \ GstClockTime ts = timestamp; \
g##type *values = (g##type *) value_array->values; \ g##vtype *values = (g##vtype *) value_array->values; \
\ \
g_mutex_lock (self->lock); \ g_mutex_lock (self->lock); \
for(i = 0; i < value_array->nbsamples; i++) { \ 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); \ g_mutex_unlock (self->lock); \
return FALSE; \ return FALSE; \
} \ } \

View file

@ -533,19 +533,11 @@ gst_interpolation_control_source_unset (GstInterpolationControlSource * self,
/* check if a control point for the timestamp exists */ /* check if a control point for the timestamp exists */
if ((node = g_list_find_custom (self->priv->values, &timestamp, if ((node = g_list_find_custom (self->priv->values, &timestamp,
gst_control_point_find))) { gst_control_point_find))) {
GstControlPoint *cp = node->data; if (node == self->priv->last_requested_value)
self->priv->last_requested_value = NULL;
if (cp->timestamp == 0) { gst_control_point_free (node->data); /* free GstControlPoint */
/* Restore the default node */ self->priv->values = g_list_delete_link (self->priv->values, node);
g_value_reset (&cp->value); self->priv->nvalues--;
g_value_copy (&self->priv->default_value, &cp->value);
} else {
if (node == self->priv->last_requested_value)
self->priv->last_requested_value = NULL;
gst_control_point_free (node->data); /* free GstControlPoint */
self->priv->values = g_list_delete_link (self->priv->values, node);
self->priv->nvalues--;
}
self->priv->valid_cache = FALSE; self->priv->valid_cache = FALSE;
res = TRUE; res = TRUE;
} }

View file

@ -104,15 +104,19 @@ gst_test_mono_source_set_property (GObject * object,
switch (property_id) { switch (property_id) {
case ARG_ULONG: case ARG_ULONG:
self->val_ulong = g_value_get_ulong (value); self->val_ulong = g_value_get_ulong (value);
GST_DEBUG ("test value ulong=%lu", self->val_ulong);
break; break;
case ARG_FLOAT: case ARG_FLOAT:
self->val_float = g_value_get_float (value); self->val_float = g_value_get_float (value);
GST_DEBUG ("test value float=%f", self->val_float);
break; break;
case ARG_DOUBLE: case ARG_DOUBLE:
self->val_double = g_value_get_double (value); self->val_double = g_value_get_double (value);
GST_DEBUG ("test value double=%f", self->val_double);
break; break;
case ARG_BOOLEAN: case ARG_BOOLEAN:
self->val_boolean = g_value_get_boolean (value); self->val_boolean = g_value_get_boolean (value);
GST_DEBUG ("test value boolean=%d", self->val_boolean);
break; break;
case ARG_CONSTRUCTONLY: case ARG_CONSTRUCTONLY:
break; break;
@ -580,11 +584,11 @@ GST_START_TEST (controller_interpolate_none)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -642,15 +646,15 @@ GST_START_TEST (controller_interpolate_trigger)
fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
0 * GST_SECOND, &val_ulong)); 0 * GST_SECOND, &val_ulong));
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
1 * GST_SECOND, &val_ulong)); 1 * GST_SECOND, &val_ulong));
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), fail_unless (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
2 * GST_SECOND, &val_ulong)); 2 * GST_SECOND, &val_ulong));
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (G_OBJECT (csource)); g_object_unref (G_OBJECT (csource));
@ -705,11 +709,11 @@ GST_START_TEST (controller_interpolate_linear)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -876,11 +880,11 @@ GST_START_TEST (controller_interpolation_unset)
/* verify values */ /* verify values */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
/* unset second */ /* unset second */
res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND); res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND);
@ -890,9 +894,9 @@ GST_START_TEST (controller_interpolation_unset)
/* verify value again */ /* verify value again */
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -944,18 +948,18 @@ GST_START_TEST (controller_interpolation_unset_all)
/* verify values */ /* verify values */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
/* unset second */ /* unset all */
gst_interpolation_control_source_unset_all (csource); gst_interpolation_control_source_unset_all (csource);
g_object_unref (csource); g_object_unref (csource);
/* verify value again */ /* verify value again */
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1125,10 +1129,14 @@ GST_START_TEST (controller_interpolation_linear_default_values)
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource, fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
GST_INTERPOLATE_LINEAR)); GST_INTERPOLATE_LINEAR));
/* Should fail if no value was set yet */
g_value_init (&val_ulong, G_TYPE_ULONG); g_value_init (&val_ulong, G_TYPE_ULONG);
fail_if (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
0 * GST_SECOND, &val_ulong)); /* Should fail if no value was set yet
* FIXME: will not fail, as interpolation assumes val[0]=default_value if
* nothing else is set.
fail_if (gst_control_source_get_value (GST_CONTROL_SOURCE (csource),
1 * GST_SECOND, &val_ulong));
*/
/* set control values */ /* set control values */
g_value_set_ulong (&val_ulong, 0); g_value_set_ulong (&val_ulong, 0);
@ -1145,13 +1153,13 @@ GST_START_TEST (controller_interpolation_linear_default_values)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
/* should give the value of the first control point for timestamps before it */ /* should give the value of the first control point for timestamps before it */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 3 * GST_SECOND); gst_controller_sync_values (ctrl, 3 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
/* set control values */ /* set control values */
g_value_set_ulong (&val_ulong, 0); g_value_set_ulong (&val_ulong, 0);
@ -1174,11 +1182,11 @@ GST_START_TEST (controller_interpolation_linear_default_values)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
/* should now give our value for timestamp 0 */ /* should now give our value for timestamp 0 */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
g_object_unref (G_OBJECT (csource)); g_object_unref (G_OBJECT (csource));
@ -1257,13 +1265,13 @@ GST_START_TEST (controller_interpolate_linear_disabled)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
/* now pull in values for some timestamps, prop double disabled */ /* now pull in values for some timestamps, prop double disabled */
@ -1271,13 +1279,13 @@ GST_START_TEST (controller_interpolate_linear_disabled)
GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
gst_controller_set_property_disabled (ctrl, "double", TRUE); gst_controller_set_property_disabled (ctrl, "double", TRUE);
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
/* now pull in values for some timestamps, after enabling double again */ /* now pull in values for some timestamps, after enabling double again */
@ -1285,13 +1293,13 @@ GST_START_TEST (controller_interpolate_linear_disabled)
GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
gst_controller_set_property_disabled (ctrl, "double", FALSE); gst_controller_set_property_disabled (ctrl, "double", FALSE);
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
/* now pull in values for some timestamps, after disabling all props */ /* now pull in values for some timestamps, after disabling all props */
@ -1299,13 +1307,13 @@ GST_START_TEST (controller_interpolate_linear_disabled)
GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
gst_controller_set_disabled (ctrl, TRUE); gst_controller_set_disabled (ctrl, TRUE);
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 0.0, NULL);
/* now pull in values for some timestamps, enabling double again */ /* now pull in values for some timestamps, enabling double again */
@ -1313,13 +1321,13 @@ GST_START_TEST (controller_interpolate_linear_disabled)
GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
gst_controller_set_property_disabled (ctrl, "double", FALSE); gst_controller_set_property_disabled (ctrl, "double", FALSE);
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
/* now pull in values for some timestamps, enabling all */ /* now pull in values for some timestamps, enabling all */
@ -1327,13 +1335,13 @@ GST_START_TEST (controller_interpolate_linear_disabled)
GST_TEST_MONO_SOURCE (elem)->val_double = 0.0; GST_TEST_MONO_SOURCE (elem)->val_double = 0.0;
gst_controller_set_disabled (ctrl, FALSE); gst_controller_set_disabled (ctrl, FALSE);
gst_controller_sync_values (ctrl, 0 * GST_SECOND); gst_controller_sync_values (ctrl, 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 2.0, NULL);
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 3.0, NULL);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL); fail_unless (GST_TEST_MONO_SOURCE (elem)->val_double == 4.0, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
@ -1438,29 +1446,29 @@ GST_START_TEST (controller_lfo_sine)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1509,29 +1517,29 @@ GST_START_TEST (controller_lfo_sine_timeshift)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1540,7 +1548,6 @@ GST_START_TEST (controller_lfo_sine_timeshift)
GST_END_TEST; GST_END_TEST;
/* test lfo control source with square waveform */ /* test lfo control source with square waveform */
GST_START_TEST (controller_lfo_square) GST_START_TEST (controller_lfo_square)
{ {
@ -1581,29 +1588,29 @@ GST_START_TEST (controller_lfo_square)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1652,29 +1659,29 @@ GST_START_TEST (controller_lfo_saw)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1723,29 +1730,29 @@ GST_START_TEST (controller_lfo_rsaw)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 150);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1794,29 +1801,29 @@ GST_START_TEST (controller_lfo_triangle)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 200);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1851,29 +1858,29 @@ GST_START_TEST (controller_lfo_none)
/* now pull in values for some timestamps */ /* now pull in values for some timestamps */
gst_controller_sync_values (ctrl, 0 * GST_MSECOND); gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 250 * GST_MSECOND); gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 500 * GST_MSECOND); gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 750 * GST_MSECOND); gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND); gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND); gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND); gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND); gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND); gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);; fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
@ -1979,6 +1986,134 @@ GST_START_TEST (controller_refcount_new_list)
GST_END_TEST; 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;
GValue val_ulong = { 0, };
gst_controller_init (NULL, NULL);
elem = gst_element_factory_make ("testmonosource", "test_source");
/* that property should exist and should be controllable */
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
fail_unless (ctrl != NULL, NULL);
/* Get interpolation control source */
csource = gst_interpolation_control_source_new ();
fail_unless (csource != NULL);
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
GST_INTERPOLATE_LINEAR));
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
g_value_set_ulong (&val_ulong, 100);
res =
gst_interpolation_control_source_set (csource, 2 * GST_SECOND,
&val_ulong);
fail_unless (res, NULL);
g_value_set_ulong (&val_ulong, 0);
res =
gst_interpolation_control_source_set (csource, 4 * GST_SECOND,
&val_ulong);
fail_unless (res, NULL);
g_object_unref (G_OBJECT (csource));
/* now pull in values for some timestamps after first control point */
gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 100);
gst_controller_sync_values (ctrl, 3 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 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);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
gst_controller_sync_values (ctrl, 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);
}
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;
GValue val_ulong = { 0, };
gst_controller_init (NULL, NULL);
elem = gst_element_factory_make ("testmonosource", "test_source");
/* that property should exist and should be controllable */
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
fail_unless (ctrl != NULL, NULL);
/* Get interpolation control source */
csource = gst_interpolation_control_source_new ();
fail_unless (csource != NULL);
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
GST_CONTROL_SOURCE (csource)));
/* set interpolation mode */
fail_unless (gst_interpolation_control_source_set_interpolation_mode (csource,
GST_INTERPOLATE_NONE));
fail_unless (gst_interpolation_control_source_get_count (csource) == 0);
/* set control values */
g_value_init (&val_ulong, G_TYPE_ULONG);
g_value_set_ulong (&val_ulong, 0);
res =
gst_interpolation_control_source_set (csource, 0 * GST_SECOND,
&val_ulong);
fail_unless (res, NULL);
fail_unless (gst_interpolation_control_source_get_count (csource) == 1);
g_value_set_ulong (&val_ulong, 100);
res =
gst_interpolation_control_source_set (csource, 2 * GST_SECOND,
&val_ulong);
fail_unless (res, NULL);
fail_unless (gst_interpolation_control_source_get_count (csource) == 2);
/* now unset control values */
res = gst_interpolation_control_source_unset (csource, 2 * GST_SECOND);
fail_unless (res, NULL);
fail_unless (gst_interpolation_control_source_get_count (csource) == 1);
res = gst_interpolation_control_source_unset (csource, 0 * GST_SECOND);
fail_unless (res, NULL);
fail_unless (gst_interpolation_control_source_get_count (csource) == 0);
g_object_unref (G_OBJECT (csource));
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl);
gst_object_unref (elem);
}
GST_END_TEST;
static Suite * static Suite *
gst_controller_suite (void) gst_controller_suite (void)
{ {
@ -2019,6 +2154,8 @@ gst_controller_suite (void)
tcase_add_test (tc, controller_lfo_triangle); tcase_add_test (tc, controller_lfo_triangle);
tcase_add_test (tc, controller_lfo_none); tcase_add_test (tc, controller_lfo_none);
tcase_add_test (tc, controller_helper_any_gobject); tcase_add_test (tc, controller_helper_any_gobject);
tcase_add_test (tc, controller_interpolate_linear_before_ts0);
tcase_add_test (tc, controller_interpolation_cp_count);
return s; return s;
} }