controller: constructures for control sources return GstControlSource

Don't return the specific types. In most cases there is no specific api there
anyway.
This commit is contained in:
Stefan Sauer 2012-01-31 12:20:41 +01:00
parent 39c5f0b28a
commit 5e4c13fc97
11 changed files with 189 additions and 278 deletions

View file

@ -512,7 +512,7 @@ struct _GstInterpolationControlSourcePrivate
* *
* Returns: (transfer full): a new, unbound #GstInterpolationControlSource. * Returns: (transfer full): a new, unbound #GstInterpolationControlSource.
*/ */
GstInterpolationControlSource * GstControlSource *
gst_interpolation_control_source_new (void) gst_interpolation_control_source_new (void)
{ {
return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL); return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL);

View file

@ -90,8 +90,7 @@ GType gst_interpolation_mode_get_type (void);
/* Functions */ /* Functions */
GstInterpolationControlSource * GstControlSource * gst_interpolation_control_source_new (void);
gst_interpolation_control_source_new (void);
G_END_DECLS G_END_DECLS

View file

@ -418,7 +418,7 @@ gst_lfo_control_source_reset (GstLFOControlSource * self)
* *
* Returns: (transfer full): a new, unbound #GstLFOControlSource. * Returns: (transfer full): a new, unbound #GstLFOControlSource.
*/ */
GstLFOControlSource * GstControlSource *
gst_lfo_control_source_new (void) gst_lfo_control_source_new (void)
{ {
return g_object_newv (GST_TYPE_LFO_CONTROL_SOURCE, 0, NULL); return g_object_newv (GST_TYPE_LFO_CONTROL_SOURCE, 0, NULL);

View file

@ -93,7 +93,7 @@ GType gst_lfo_waveform_get_type (void);
/* Functions */ /* Functions */
GstLFOControlSource *gst_lfo_control_source_new (void); GstControlSource *gst_lfo_control_source_new (void);
G_END_DECLS G_END_DECLS

View file

@ -184,7 +184,7 @@ G_DEFINE_TYPE_WITH_CODE (GstTriggerControlSource, gst_trigger_control_source,
* *
* Returns: (transfer full): a new, unbound #GstTriggerControlSource. * Returns: (transfer full): a new, unbound #GstTriggerControlSource.
*/ */
GstTriggerControlSource * GstControlSource *
gst_trigger_control_source_new (void) gst_trigger_control_source_new (void)
{ {
return g_object_newv (GST_TYPE_TRIGGER_CONTROL_SOURCE, 0, NULL); return g_object_newv (GST_TYPE_TRIGGER_CONTROL_SOURCE, 0, NULL);

View file

@ -76,7 +76,7 @@ GType gst_trigger_control_source_get_type (void);
/* Functions */ /* Functions */
GstTriggerControlSource *gst_trigger_control_source_new (void); GstControlSource *gst_trigger_control_source_new (void);
G_END_DECLS G_END_DECLS

View file

@ -83,7 +83,8 @@ main (gint argc, gchar * argv[])
gint i, j; gint i, j;
GstElement *src, *sink; GstElement *src, *sink;
GstElement *bin; GstElement *bin;
GstInterpolationControlSource *csource; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstClockTime bt, ct; GstClockTime bt, ct;
GstClockTimeDiff elapsed; GstClockTimeDiff elapsed;
GstClockTime tick; GstClockTime tick;
@ -111,12 +112,12 @@ main (gint argc, gchar * argv[])
tick = BLOCK_SIZE * GST_SECOND / 44100; tick = BLOCK_SIZE * GST_SECOND / 44100;
/* create and configure control source */ /* create and configure control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
gst_object_add_control_binding (GST_OBJECT (src), tvcs = (GstTimedValueControlSource *) cs;
gst_direct_control_binding_new (GST_OBJECT (src), "freq",
GST_CONTROL_SOURCE (csource)));
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
gst_object_add_control_binding (GST_OBJECT (src),
gst_direct_control_binding_new (GST_OBJECT (src), "freq", cs));
g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values, we set them in a linear order as we would when loading /* set control values, we set them in a linear order as we would when loading
* a stored project * a stored project
@ -124,8 +125,8 @@ main (gint argc, gchar * argv[])
bt = gst_util_get_timestamp (); bt = gst_util_get_timestamp ();
for (i = 0; i < NUM_CP; i++) { for (i = 0; i < NUM_CP; i++) {
gst_timed_value_control_source_set ((GstTimedValueControlSource *) csource, gst_timed_value_control_source_set (tvcs, i * tick,
i * tick, g_random_double_range (50.0, 3000.0)); g_random_double_range (50.0, 3000.0));
} }
ct = gst_util_get_timestamp (); ct = gst_util_get_timestamp ();
@ -141,8 +142,8 @@ main (gint argc, gchar * argv[])
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
j = g_random_int_range (0, NUM_CP - 1); j = g_random_int_range (0, NUM_CP - 1);
gst_timed_value_control_source_set ((GstTimedValueControlSource *) csource, gst_timed_value_control_source_set (tvcs, j * tick,
j * tick, g_random_double_range (50.0, 3000.0)); g_random_double_range (50.0, 3000.0));
} }
ct = gst_util_get_timestamp (); ct = gst_util_get_timestamp ();
@ -156,8 +157,8 @@ main (gint argc, gchar * argv[])
gdouble *values = g_new0 (gdouble, BLOCK_SIZE * NUM_CP); gdouble *values = g_new0 (gdouble, BLOCK_SIZE * NUM_CP);
bt = gst_util_get_timestamp (); bt = gst_util_get_timestamp ();
gst_control_source_get_value_array (GST_CONTROL_SOURCE (csource), 0, gst_control_source_get_value_array (cs, 0, sample_duration,
sample_duration, BLOCK_SIZE * NUM_CP, values); BLOCK_SIZE * NUM_CP, values);
ct = gst_util_get_timestamp (); ct = gst_util_get_timestamp ();
g_free (values); g_free (values);
elapsed = GST_CLOCK_DIFF (bt, ct); elapsed = GST_CLOCK_DIFF (bt, ct);
@ -165,8 +166,6 @@ main (gint argc, gchar * argv[])
GST_TIME_ARGS (elapsed)); GST_TIME_ARGS (elapsed));
} }
gst_object_unref (csource);
/* play, this test sequential reads */ /* play, this test sequential reads */
bt = gst_util_get_timestamp (); bt = gst_util_get_timestamp ();
@ -182,7 +181,8 @@ main (gint argc, gchar * argv[])
GST_TIME_ARGS (elapsed)); GST_TIME_ARGS (elapsed));
/* cleanup */ /* cleanup */
gst_object_unref (G_OBJECT (bin)); gst_object_unref (cs);
gst_object_unref (bin);
res = 0; res = 0;
Error: Error:
return res; return res;

View file

@ -279,22 +279,20 @@ teardown (void)
GST_START_TEST (controller_controlsource_empty1) GST_START_TEST (controller_controlsource_empty1)
{ {
GstElement *elem; GstElement *elem;
GstControlSource *csource; GstControlSource *cs;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
csource = (GstControlSource *) gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
fail_unless (csource != NULL, NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
(GstControlSource *) csource)));
/* don't fail on empty control point lists */ /* don't fail on empty control point lists */
gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
/* unref objects */ /* unref objects */
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -304,30 +302,28 @@ GST_END_TEST;
GST_START_TEST (controller_controlsource_empty2) GST_START_TEST (controller_controlsource_empty2)
{ {
GstElement *elem; GstElement *elem;
GstInterpolationControlSource *csource; GstControlSource *cs;
GstTimedValueControlSource *cs; GstTimedValueControlSource *tvcs;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
fail_unless (csource != NULL, NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
(GstControlSource *) csource)));
/* set control values */ /* set control values */
cs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0); gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0);
/* ... and unset the value */ /* ... and unset the value */
gst_timed_value_control_source_unset (cs, 0 * GST_SECOND); gst_timed_value_control_source_unset (tvcs, 0 * GST_SECOND);
/* don't fail on empty control point lists */ /* don't fail on empty control point lists */
gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
/* unref objects */ /* unref objects */
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -336,25 +332,22 @@ GST_END_TEST;
/* test timed value handling without interpolation */ /* test timed value handling without interpolation */
GST_START_TEST (controller_interpolation_none) GST_START_TEST (controller_interpolation_none)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
gdouble v; gdouble v;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -380,7 +373,7 @@ GST_START_TEST (controller_interpolation_none)
gst_object_sync_values (GST_OBJECT (elem), 3 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 3 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -389,24 +382,21 @@ GST_END_TEST;
/* test timed value handling with linear interpolation */ /* test timed value handling with linear interpolation */
GST_START_TEST (controller_interpolation_linear) GST_START_TEST (controller_interpolation_linear)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -420,7 +410,7 @@ GST_START_TEST (controller_interpolation_linear)
gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -429,24 +419,21 @@ GST_END_TEST;
/* test timed value handling with cubic interpolation */ /* test timed value handling with cubic interpolation */
GST_START_TEST (controller_interpolation_cubic) GST_START_TEST (controller_interpolation_cubic)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -469,7 +456,7 @@ GST_START_TEST (controller_interpolation_cubic)
gst_object_sync_values (GST_OBJECT (elem), 5 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 5 * GST_SECOND);
fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 80.0); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 80.0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -478,24 +465,21 @@ GST_END_TEST;
/* test timed value handling with cubic interpolation */ /* test timed value handling with cubic interpolation */
GST_START_TEST (controller_interpolation_cubic_too_few_cp) GST_START_TEST (controller_interpolation_cubic_too_few_cp)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
/* set 2 control values */ /* set 2 control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -511,7 +495,7 @@ GST_START_TEST (controller_interpolation_cubic_too_few_cp)
gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 40.0); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 40.0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -520,24 +504,21 @@ GST_END_TEST;
/* test _unset() */ /* test _unset() */
GST_START_TEST (controller_interpolation_unset) GST_START_TEST (controller_interpolation_unset)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -567,7 +548,7 @@ GST_START_TEST (controller_interpolation_unset)
gst_timed_value_control_source_unset_all (tvcs); gst_timed_value_control_source_unset_all (tvcs);
fail_if (gst_timed_value_control_source_unset (tvcs, 2 * GST_SECOND)); fail_if (gst_timed_value_control_source_unset (tvcs, 2 * GST_SECOND));
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -576,24 +557,21 @@ GST_END_TEST;
/* test _unset_all() */ /* test _unset_all() */
GST_START_TEST (controller_interpolation_unset_all) GST_START_TEST (controller_interpolation_unset_all)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -613,7 +591,7 @@ GST_START_TEST (controller_interpolation_unset_all)
gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -622,9 +600,8 @@ GST_END_TEST;
/* test retrieval of an array of values with get_value_array() */ /* test retrieval of an array of values with get_value_array() */
GST_START_TEST (controller_interpolation_linear_value_array) GST_START_TEST (controller_interpolation_linear_value_array)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
gdouble *raw_values; gdouble *raw_values;
GValue *g_values; GValue *g_values;
@ -632,16 +609,14 @@ GST_START_TEST (controller_interpolation_linear_value_array)
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -669,7 +644,7 @@ GST_START_TEST (controller_interpolation_linear_value_array)
g_free (g_values); g_free (g_values);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -678,24 +653,21 @@ GST_END_TEST;
/* test if values below minimum and above maximum are clipped */ /* test if values below minimum and above maximum are clipped */
GST_START_TEST (controller_interpolation_linear_invalid_values) GST_START_TEST (controller_interpolation_linear_invalid_values)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "float", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "float", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 2.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 2.0));
@ -722,7 +694,7 @@ GST_START_TEST (controller_interpolation_linear_invalid_values)
gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND);
fail_unless_equals_float (GST_TEST_OBJ (elem)->val_float, 0.0); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_float, 0.0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -730,30 +702,26 @@ GST_END_TEST;
GST_START_TEST (controller_interpolation_linear_default_values) GST_START_TEST (controller_interpolation_linear_default_values)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* Should fail if no value was set yet /* Should fail if no value was set yet
* FIXME: will not fail, as interpolation assumes val[0]=default_value if * FIXME: will not fail, as interpolation assumes val[0]=default_value if
* nothing else is set. * nothing else is set.
fail_if (gst_control_source_get_value (GST_CONTROL_SOURCE (csource), fail_if (gst_timed_value_control_source_set (tvcs, 1 * GST_SECOND, &val_int));
1 * GST_SECOND, &val_int));
*/ */
/* set control values */ /* set control values */
@ -788,7 +756,7 @@ GST_START_TEST (controller_interpolation_linear_default_values)
gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -797,32 +765,27 @@ GST_END_TEST;
/* test gst_controller_set_disabled() with linear interpolation */ /* test gst_controller_set_disabled() with linear interpolation */
GST_START_TEST (controller_interpolation_linear_disabled) GST_START_TEST (controller_interpolation_linear_disabled)
{ {
GstInterpolationControlSource *csource1, *csource2;
GstTimedValueControlSource *tvcs1, *tvcs2;
GstControlSource *cs1, *cs2; GstControlSource *cs1, *cs2;
GstTimedValueControlSource *tvcs1, *tvcs2;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource1 = gst_interpolation_control_source_new (); cs1 = gst_interpolation_control_source_new ();
tvcs1 = (GstTimedValueControlSource *) csource1; tvcs1 = (GstTimedValueControlSource *) cs1;
cs1 = (GstControlSource *) csource1;
csource2 = gst_interpolation_control_source_new (); cs2 = gst_interpolation_control_source_new ();
tvcs2 = (GstTimedValueControlSource *) csource2; tvcs2 = (GstTimedValueControlSource *) cs2;
cs2 = (GstControlSource *) csource2;
fail_unless (csource1 != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs1))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs1)));
fail_unless (csource2 != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs2))); gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs2)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs1, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs1, 0 * GST_SECOND, 0.0));
@ -913,8 +876,8 @@ GST_START_TEST (controller_interpolation_linear_disabled)
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 40.0); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 40.0);
gst_object_unref (csource1); gst_object_unref (cs1);
gst_object_unref (csource2); gst_object_unref (cs2);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -923,9 +886,8 @@ GST_END_TEST;
GST_START_TEST (controller_interpolation_set_from_list) GST_START_TEST (controller_interpolation_set_from_list)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstTimedValue *tval; GstTimedValue *tval;
GstElement *elem; GstElement *elem;
GSList *list = NULL; GSList *list = NULL;
@ -934,16 +896,14 @@ GST_START_TEST (controller_interpolation_set_from_list)
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control value */ /* set control value */
tval = g_new0 (GstTimedValue, 1); tval = g_new0 (GstTimedValue, 1);
@ -961,7 +921,7 @@ GST_START_TEST (controller_interpolation_set_from_list)
/* allocated GstTimedValue now belongs to the controller, but list not */ /* allocated GstTimedValue now belongs to the controller, but list not */
g_free (tval); g_free (tval);
g_slist_free (list); g_slist_free (list);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -971,24 +931,21 @@ GST_END_TEST;
/* test linear interpolation for ts < first control point */ /* test linear interpolation for ts < first control point */
GST_START_TEST (controller_interpolation_linear_before_ts0) GST_START_TEST (controller_interpolation_linear_before_ts0)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 2 * GST_SECOND, 1.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 2 * GST_SECOND, 1.0));
@ -1009,7 +966,7 @@ GST_START_TEST (controller_interpolation_linear_before_ts0)
gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 25); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 25);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1018,24 +975,21 @@ GST_END_TEST;
/* test linear interpolation of enums */ /* test linear interpolation of enums */
GST_START_TEST (controller_interpolation_linear_enums) GST_START_TEST (controller_interpolation_linear_enums)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "enum", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "enum", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0)); fail_unless (gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0));
@ -1053,7 +1007,7 @@ GST_START_TEST (controller_interpolation_linear_enums)
gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 4 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_enum, ENUM_V255); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_enum, ENUM_V255);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1062,24 +1016,21 @@ GST_END_TEST;
/* test timed value counts */ /* test timed value counts */
GST_START_TEST (controller_timed_value_count) GST_START_TEST (controller_timed_value_count)
{ {
GstInterpolationControlSource *csource;
GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
fail_unless (gst_timed_value_control_source_get_count (tvcs) == 0); fail_unless (gst_timed_value_control_source_get_count (tvcs) == 0);
@ -1095,7 +1046,7 @@ GST_START_TEST (controller_timed_value_count)
fail_unless (gst_timed_value_control_source_unset (tvcs, 0 * GST_SECOND)); fail_unless (gst_timed_value_control_source_unset (tvcs, 0 * GST_SECOND));
fail_unless (gst_timed_value_control_source_get_count (tvcs) == 0); fail_unless (gst_timed_value_control_source_get_count (tvcs) == 0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1105,22 +1056,19 @@ GST_END_TEST;
/* test lfo control source with sine waveform */ /* test lfo control source with sine waveform */
GST_START_TEST (controller_lfo_sine) GST_START_TEST (controller_lfo_sine)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */ /* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE, g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SINE,
"frequency", 1.0, "timeshift", (GstClockTime) 0, "frequency", 1.0, "timeshift", (GstClockTime) 0,
"amplitude", 0.5, "offset", 0.5, NULL); "amplitude", 0.5, "offset", 0.5, NULL);
@ -1150,7 +1098,7 @@ GST_START_TEST (controller_lfo_sine)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1159,22 +1107,19 @@ GST_END_TEST;
/* test lfo control source with sine waveform and timeshift */ /* test lfo control source with sine waveform and timeshift */
GST_START_TEST (controller_lfo_sine_timeshift) GST_START_TEST (controller_lfo_sine_timeshift)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */ /* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE, g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SINE,
"frequency", 1.0, "timeshift", 250 * GST_MSECOND, "frequency", 1.0, "timeshift", 250 * GST_MSECOND,
"amplitude", 0.5, "offset", 0.5, NULL); "amplitude", 0.5, "offset", 0.5, NULL);
@ -1204,7 +1149,7 @@ GST_START_TEST (controller_lfo_sine_timeshift)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 50); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 50);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1213,22 +1158,19 @@ 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)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */ /* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SQUARE, g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SQUARE,
"frequency", 1.0, "timeshift", (GstClockTime) 0, "frequency", 1.0, "timeshift", (GstClockTime) 0,
"amplitude", 0.5, "offset", 0.5, NULL); "amplitude", 0.5, "offset", 0.5, NULL);
@ -1258,7 +1200,7 @@ GST_START_TEST (controller_lfo_square)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1267,22 +1209,19 @@ GST_END_TEST;
/* test lfo control source with saw waveform */ /* test lfo control source with saw waveform */
GST_START_TEST (controller_lfo_saw) GST_START_TEST (controller_lfo_saw)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */ /* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SAW, g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SAW,
"frequency", 1.0, "timeshift", (GstClockTime) 0, "frequency", 1.0, "timeshift", (GstClockTime) 0,
"amplitude", 0.5, "offset", 0.5, NULL); "amplitude", 0.5, "offset", 0.5, NULL);
@ -1312,7 +1251,7 @@ GST_START_TEST (controller_lfo_saw)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 25); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 25);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1321,22 +1260,19 @@ GST_END_TEST;
/* test lfo control source with reverse saw waveform */ /* test lfo control source with reverse saw waveform */
GST_START_TEST (controller_lfo_rsaw) GST_START_TEST (controller_lfo_rsaw)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */ /* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW, g_object_set (cs, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW,
"frequency", 1.0, "timeshift", (GstClockTime) 0, "frequency", 1.0, "timeshift", (GstClockTime) 0,
"amplitude", 0.5, "offset", 0.5, NULL); "amplitude", 0.5, "offset", 0.5, NULL);
@ -1366,7 +1302,7 @@ GST_START_TEST (controller_lfo_rsaw)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 75); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 75);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1375,22 +1311,19 @@ GST_END_TEST;
/* test lfo control source with saw waveform */ /* test lfo control source with saw waveform */
GST_START_TEST (controller_lfo_triangle) GST_START_TEST (controller_lfo_triangle)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */ /* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_TRIANGLE, g_object_set (cs, "waveform", GST_LFO_WAVEFORM_TRIANGLE,
"frequency", 1.0, "timeshift", (GstClockTime) 0, "frequency", 1.0, "timeshift", (GstClockTime) 0,
"amplitude", 0.5, "offset", 0.5, NULL); "amplitude", 0.5, "offset", 0.5, NULL);
@ -1420,7 +1353,7 @@ GST_START_TEST (controller_lfo_triangle)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1429,17 +1362,14 @@ GST_END_TEST;
/* test lfo control source with nothing set */ /* test lfo control source with nothing set */
GST_START_TEST (controller_lfo_none) GST_START_TEST (controller_lfo_none)
{ {
GstLFOControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstElement *elem; GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new lfo control source */ /* new lfo control source */
csource = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
@ -1469,7 +1399,7 @@ GST_START_TEST (controller_lfo_none)
gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND); gst_object_sync_values (GST_OBJECT (elem), 1750 * GST_MSECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1478,7 +1408,6 @@ GST_END_TEST;
/* test timed value handling in trigger mode */ /* test timed value handling in trigger mode */
GST_START_TEST (controller_trigger_exact) GST_START_TEST (controller_trigger_exact)
{ {
GstTriggerControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs; GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
@ -1487,11 +1416,9 @@ GST_START_TEST (controller_trigger_exact)
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_trigger_control_source_new (); cs = gst_trigger_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
@ -1516,7 +1443,7 @@ GST_START_TEST (controller_trigger_exact)
gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }
@ -1524,7 +1451,6 @@ GST_END_TEST;
GST_START_TEST (controller_trigger_tolerance) GST_START_TEST (controller_trigger_tolerance)
{ {
GstTriggerControlSource *csource;
GstControlSource *cs; GstControlSource *cs;
GstTimedValueControlSource *tvcs; GstTimedValueControlSource *tvcs;
GstElement *elem; GstElement *elem;
@ -1533,15 +1459,13 @@ GST_START_TEST (controller_trigger_tolerance)
elem = gst_element_factory_make ("testobj", NULL); elem = gst_element_factory_make ("testobj", NULL);
/* new interpolation control source */ /* new interpolation control source */
csource = gst_trigger_control_source_new (); cs = gst_trigger_control_source_new ();
tvcs = (GstTimedValueControlSource *) csource; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs)));
g_object_set (csource, "tolerance", G_GINT64_CONSTANT (10), NULL); g_object_set (cs, "tolerance", G_GINT64_CONSTANT (10), NULL);
fail_if (gst_control_source_get_value (cs, 0 * GST_SECOND, &raw_val)); fail_if (gst_control_source_get_value (cs, 0 * GST_SECOND, &raw_val));
@ -1564,7 +1488,7 @@ GST_START_TEST (controller_trigger_tolerance)
gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND); gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100);
gst_object_unref (csource); gst_object_unref (cs);
gst_object_unref (elem); gst_object_unref (elem);
} }

View file

@ -17,8 +17,8 @@ main (gint argc, gchar ** argv)
gint res = 1; gint res = 1;
GstElement *src, *sink; GstElement *src, *sink;
GstElement *bin; GstElement *bin;
GstInterpolationControlSource *csource1, *csource2; GstControlSource *cs1, *cs2;
GstTimedValueControlSource *cs; GstTimedValueControlSource *tvcs;
GstClock *clock; GstClock *clock;
GstClockID clock_id; GstClockID clock_id;
GstClockReturn wait_ret; GstClockReturn wait_ret;
@ -46,34 +46,32 @@ main (gint argc, gchar ** argv)
} }
/* setup control sources */ /* setup control sources */
csource1 = gst_interpolation_control_source_new (); cs1 = gst_interpolation_control_source_new ();
csource2 = gst_interpolation_control_source_new (); cs2 = gst_interpolation_control_source_new ();
gst_object_add_control_binding (GST_OBJECT_CAST (src), gst_object_add_control_binding (GST_OBJECT_CAST (src),
gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", cs1));
GST_CONTROL_SOURCE (csource1)));
gst_object_add_control_binding (GST_OBJECT_CAST (src), gst_object_add_control_binding (GST_OBJECT_CAST (src),
gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", cs2));
GST_CONTROL_SOURCE (csource2)));
/* set interpolation mode */ /* set interpolation mode */
g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
/* set control values */ /* set control values */
cs = (GstTimedValueControlSource *) csource1; tvcs = (GstTimedValueControlSource *) cs1;
gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0.0); gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
gst_timed_value_control_source_set (cs, 5 * GST_SECOND, 1.0); gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0);
gst_object_unref (csource1); gst_object_unref (cs1);
cs = (GstTimedValueControlSource *) csource2; tvcs = (GstTimedValueControlSource *) cs2;
gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 220.0 / 20000.0); gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 220.0 / 20000.0);
gst_timed_value_control_source_set (cs, 3 * GST_SECOND, 3520.0 / 20000.0); gst_timed_value_control_source_set (tvcs, 3 * GST_SECOND, 3520.0 / 20000.0);
gst_timed_value_control_source_set (cs, 6 * GST_SECOND, 440.0 / 20000.0); gst_timed_value_control_source_set (tvcs, 6 * GST_SECOND, 440.0 / 20000.0);
gst_object_unref (csource2); gst_object_unref (cs2);
/* run for 7 seconds */ /* run for 7 seconds */
clock_id = clock_id =
@ -89,8 +87,8 @@ main (gint argc, gchar ** argv)
/* cleanup */ /* cleanup */
gst_clock_id_unref (clock_id); gst_clock_id_unref (clock_id);
gst_object_unref (G_OBJECT (clock)); gst_object_unref (clock);
gst_object_unref (G_OBJECT (bin)); gst_object_unref (bin);
res = 0; res = 0;
Error: Error:
return (res); return (res);

View file

@ -179,7 +179,6 @@ static void
test_interpolation (void) test_interpolation (void)
{ {
GstObject *e; GstObject *e;
GstInterpolationControlSource *ics;
GstTimedValueControlSource *tvcs; GstTimedValueControlSource *tvcs;
GstControlSource *cs; GstControlSource *cs;
gint t, i1, i2, i3; gint t, i1, i2, i3;
@ -189,9 +188,8 @@ test_interpolation (void)
e = (GstObject *) gst_element_factory_make ("testobj", NULL); e = (GstObject *) gst_element_factory_make ("testobj", NULL);
ics = gst_interpolation_control_source_new (); cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) ics; tvcs = (GstTimedValueControlSource *) cs;
cs = (GstControlSource *) ics;
gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int", gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int",
cs)); cs));
@ -207,15 +205,15 @@ test_interpolation (void)
fprintf (f, "# Time None Linear Cubic\n"); fprintf (f, "# Time None Linear Cubic\n");
for (t = 0; t < 40; t++) { for (t = 0; t < 40; t++) {
g_object_set (ics, "mode", GST_INTERPOLATION_MODE_NONE, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i1 = GST_TEST_OBJ (e)->val_int; i1 = GST_TEST_OBJ (e)->val_int;
g_object_set (ics, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i2 = GST_TEST_OBJ (e)->val_int; i2 = GST_TEST_OBJ (e)->val_int;
g_object_set (ics, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i3 = GST_TEST_OBJ (e)->val_int; i3 = GST_TEST_OBJ (e)->val_int;
@ -230,15 +228,15 @@ test_interpolation (void)
fprintf (f, "# Time None Linear Cubic\n"); fprintf (f, "# Time None Linear Cubic\n");
n_values = 40 * 10; n_values = 40 * 10;
g_object_set (ics, "mode", GST_INTERPOLATION_MODE_NONE, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
v1 = g_new0 (GValue, n_values); v1 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v1); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v1);
g_object_set (ics, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
v2 = g_new0 (GValue, n_values); v2 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v2); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v2);
g_object_set (ics, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL); g_object_set (cs, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
v3 = g_new0 (GValue, n_values); v3 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v3); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v3);
@ -257,7 +255,7 @@ test_interpolation (void)
fclose (f); fclose (f);
gst_object_unref (ics); gst_object_unref (cs);
gst_object_unref (e); gst_object_unref (e);
} }
@ -265,7 +263,6 @@ static void
test_lfo (void) test_lfo (void)
{ {
GstObject *e; GstObject *e;
GstLFOControlSource *lfocs;
GstControlSource *cs; GstControlSource *cs;
gint t, i1, i2, i3, i4, i5; gint t, i1, i2, i3, i4, i5;
GValue *v1, *v2, *v3, *v4, *v5; GValue *v1, *v2, *v3, *v4, *v5;
@ -274,13 +271,12 @@ test_lfo (void)
e = (GstObject *) gst_element_factory_make ("testobj", NULL); e = (GstObject *) gst_element_factory_make ("testobj", NULL);
lfocs = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
cs = (GstControlSource *) lfocs;
gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int", gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int",
cs)); cs));
g_object_set (lfocs, g_object_set (cs,
"frequency", (gdouble) 0.05, "frequency", (gdouble) 0.05,
"timeshift", (GstClockTime) 0, "timeshift", (GstClockTime) 0,
"amplitude", (gdouble) 0.5, "offset", (gdouble) 0.5, NULL); "amplitude", (gdouble) 0.5, "offset", (gdouble) 0.5, NULL);
@ -291,23 +287,23 @@ test_lfo (void)
fprintf (f, "# Time Sine Square Saw RevSaw Triangle\n"); fprintf (f, "# Time Sine Square Saw RevSaw Triangle\n");
for (t = 0; t < 40; t++) { for (t = 0; t < 40; t++) {
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_SINE, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SINE, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i1 = GST_TEST_OBJ (e)->val_int; i1 = GST_TEST_OBJ (e)->val_int;
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_SQUARE, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SQUARE, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i2 = GST_TEST_OBJ (e)->val_int; i2 = GST_TEST_OBJ (e)->val_int;
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_SAW, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SAW, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i3 = GST_TEST_OBJ (e)->val_int; i3 = GST_TEST_OBJ (e)->val_int;
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i4 = GST_TEST_OBJ (e)->val_int; i4 = GST_TEST_OBJ (e)->val_int;
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_TRIANGLE, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_TRIANGLE, NULL);
gst_object_sync_values (e, t * GST_SECOND); gst_object_sync_values (e, t * GST_SECOND);
i5 = GST_TEST_OBJ (e)->val_int; i5 = GST_TEST_OBJ (e)->val_int;
@ -322,23 +318,23 @@ test_lfo (void)
fprintf (f, "# Time Sine Square Saw RevSaw Triangle\n"); fprintf (f, "# Time Sine Square Saw RevSaw Triangle\n");
n_values = 40 * 10; n_values = 40 * 10;
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_SINE, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SINE, NULL);
v1 = g_new0 (GValue, n_values); v1 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v1); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v1);
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_SQUARE, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SQUARE, NULL);
v2 = g_new0 (GValue, n_values); v2 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v2); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v2);
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_SAW, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_SAW, NULL);
v3 = g_new0 (GValue, n_values); v3 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v3); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v3);
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW, NULL);
v4 = g_new0 (GValue, n_values); v4 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v4); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v4);
g_object_set (lfocs, "waveform", GST_LFO_WAVEFORM_TRIANGLE, NULL); g_object_set (cs, "waveform", GST_LFO_WAVEFORM_TRIANGLE, NULL);
v5 = g_new0 (GValue, n_values); v5 = g_new0 (GValue, n_values);
gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v5); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v5);
@ -364,7 +360,7 @@ test_lfo (void)
fclose (f); fclose (f);
gst_object_unref (lfocs); gst_object_unref (cs);
gst_object_unref (e); gst_object_unref (e);
} }
@ -372,7 +368,6 @@ static void
test_chained_lfo (void) test_chained_lfo (void)
{ {
GstObject *e; GstObject *e;
GstLFOControlSource *lfocs1, *lfocs2;
GstControlSource *cs1, *cs2; GstControlSource *cs1, *cs2;
gint t, i1; gint t, i1;
GValue *v1; GValue *v1;
@ -381,24 +376,22 @@ test_chained_lfo (void)
e = (GstObject *) gst_element_factory_make ("testobj", NULL); e = (GstObject *) gst_element_factory_make ("testobj", NULL);
lfocs1 = gst_lfo_control_source_new (); cs1 = gst_lfo_control_source_new ();
cs1 = (GstControlSource *) lfocs1;
gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int", gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int",
cs1)); cs1));
g_object_set (lfocs1, g_object_set (cs1,
"waveform", GST_LFO_WAVEFORM_SINE, "waveform", GST_LFO_WAVEFORM_SINE,
"frequency", (gdouble) 0.05, "frequency", (gdouble) 0.05,
"timeshift", (GstClockTime) 0, "offset", (gdouble) 0.5, NULL); "timeshift", (GstClockTime) 0, "offset", (gdouble) 0.5, NULL);
lfocs2 = gst_lfo_control_source_new (); cs2 = gst_lfo_control_source_new ();
cs2 = (GstControlSource *) lfocs2;
gst_object_add_control_binding ((GstObject *) lfocs1, gst_object_add_control_binding ((GstObject *) cs1,
gst_direct_control_binding_new ((GstObject *) lfocs1, "amplitude", cs2)); gst_direct_control_binding_new ((GstObject *) cs1, "amplitude", cs2));
g_object_set (lfocs2, g_object_set (cs2,
"waveform", GST_LFO_WAVEFORM_SINE, "waveform", GST_LFO_WAVEFORM_SINE,
"frequency", (gdouble) 0.05, "frequency", (gdouble) 0.05,
"timeshift", (GstClockTime) 0, "timeshift", (GstClockTime) 0,
@ -436,8 +429,8 @@ test_chained_lfo (void)
fclose (f); fclose (f);
gst_object_unref (lfocs1); gst_object_unref (cs1);
gst_object_unref (lfocs2); gst_object_unref (cs2);
gst_object_unref (e); gst_object_unref (e);
} }

View file

@ -19,8 +19,8 @@ main (gint argc, gchar ** argv)
gint res = 1; gint res = 1;
GstElement *src, *text, *sink; GstElement *src, *text, *sink;
GstElement *bin; GstElement *bin;
GstLFOControlSource *cs; GstControlSource *cs;
GstLFOControlSource *cs_r, *cs_g, *cs_b; GstControlSource *cs_r, *cs_g, *cs_b;
GstClock *clock; GstClock *clock;
GstClockID clock_id; GstClockID clock_id;
GstClockReturn wait_ret; GstClockReturn wait_ret;
@ -65,8 +65,7 @@ main (gint argc, gchar ** argv)
"frequency", (gdouble) 0.11, "frequency", (gdouble) 0.11,
"amplitude", (gdouble) 0.2, "offset", (gdouble) 0.5, NULL); "amplitude", (gdouble) 0.2, "offset", (gdouble) 0.5, NULL);
gst_object_add_control_binding (GST_OBJECT_CAST (text), gst_object_add_control_binding (GST_OBJECT_CAST (text),
gst_direct_control_binding_new (GST_OBJECT_CAST (text), "xpos", gst_direct_control_binding_new (GST_OBJECT_CAST (text), "xpos", cs));
GST_CONTROL_SOURCE (cs)));
gst_object_unref (cs); gst_object_unref (cs);
cs = gst_lfo_control_source_new (); cs = gst_lfo_control_source_new ();
@ -74,8 +73,7 @@ main (gint argc, gchar ** argv)
"frequency", (gdouble) 0.04, "frequency", (gdouble) 0.04,
"amplitude", (gdouble) 0.4, "offset", (gdouble) 0.5, NULL); "amplitude", (gdouble) 0.4, "offset", (gdouble) 0.5, NULL);
gst_object_add_control_binding (GST_OBJECT_CAST (text), gst_object_add_control_binding (GST_OBJECT_CAST (text),
gst_direct_control_binding_new (GST_OBJECT_CAST (text), "ypos", gst_direct_control_binding_new (GST_OBJECT_CAST (text), "ypos", cs));
GST_CONTROL_SOURCE (cs)));
gst_object_unref (cs); gst_object_unref (cs);
cs_r = gst_lfo_control_source_new (); cs_r = gst_lfo_control_source_new ();
@ -92,8 +90,7 @@ main (gint argc, gchar ** argv)
"amplitude", (gdouble) 0.5, "offset", (gdouble) 0.5, NULL); "amplitude", (gdouble) 0.5, "offset", (gdouble) 0.5, NULL);
gst_object_add_control_binding (GST_OBJECT_CAST (text), gst_object_add_control_binding (GST_OBJECT_CAST (text),
gst_argb_control_binding_new (GST_OBJECT_CAST (text), "color", NULL, gst_argb_control_binding_new (GST_OBJECT_CAST (text), "color", NULL,
GST_CONTROL_SOURCE (cs_r), GST_CONTROL_SOURCE (cs_g), cs_r, cs_g, cs_b));
GST_CONTROL_SOURCE (cs_b)));
gst_object_unref (cs_r); gst_object_unref (cs_r);
gst_object_unref (cs_g); gst_object_unref (cs_g);
gst_object_unref (cs_b); gst_object_unref (cs_b);