From 5e4c13fc97bd3c887dc27ca1ae6a69a8fa22e963 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 31 Jan 2012 12:20:41 +0100 Subject: [PATCH] controller: constructures for control sources return GstControlSource Don't return the specific types. In most cases there is no specific api there anyway. --- .../gstinterpolationcontrolsource.c | 2 +- .../gstinterpolationcontrolsource.h | 3 +- libs/gst/controller/gstlfocontrolsource.c | 2 +- libs/gst/controller/gstlfocontrolsource.h | 2 +- libs/gst/controller/gsttriggercontrolsource.c | 2 +- libs/gst/controller/gsttriggercontrolsource.h | 2 +- tests/benchmarks/controller.c | 30 +- tests/check/libs/controller.c | 304 +++++++----------- tests/examples/controller/audio-example.c | 40 ++- tests/examples/controller/control-sources.c | 67 ++-- .../examples/controller/text-color-example.c | 13 +- 11 files changed, 189 insertions(+), 278 deletions(-) diff --git a/libs/gst/controller/gstinterpolationcontrolsource.c b/libs/gst/controller/gstinterpolationcontrolsource.c index 0692a06f49..d184f7dbd8 100644 --- a/libs/gst/controller/gstinterpolationcontrolsource.c +++ b/libs/gst/controller/gstinterpolationcontrolsource.c @@ -512,7 +512,7 @@ struct _GstInterpolationControlSourcePrivate * * Returns: (transfer full): a new, unbound #GstInterpolationControlSource. */ -GstInterpolationControlSource * +GstControlSource * gst_interpolation_control_source_new (void) { return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL); diff --git a/libs/gst/controller/gstinterpolationcontrolsource.h b/libs/gst/controller/gstinterpolationcontrolsource.h index c4b602b589..daf17bd853 100644 --- a/libs/gst/controller/gstinterpolationcontrolsource.h +++ b/libs/gst/controller/gstinterpolationcontrolsource.h @@ -90,8 +90,7 @@ GType gst_interpolation_mode_get_type (void); /* Functions */ -GstInterpolationControlSource * - gst_interpolation_control_source_new (void); +GstControlSource * gst_interpolation_control_source_new (void); G_END_DECLS diff --git a/libs/gst/controller/gstlfocontrolsource.c b/libs/gst/controller/gstlfocontrolsource.c index 987caf42cc..d5f23f6256 100644 --- a/libs/gst/controller/gstlfocontrolsource.c +++ b/libs/gst/controller/gstlfocontrolsource.c @@ -418,7 +418,7 @@ gst_lfo_control_source_reset (GstLFOControlSource * self) * * Returns: (transfer full): a new, unbound #GstLFOControlSource. */ -GstLFOControlSource * +GstControlSource * gst_lfo_control_source_new (void) { return g_object_newv (GST_TYPE_LFO_CONTROL_SOURCE, 0, NULL); diff --git a/libs/gst/controller/gstlfocontrolsource.h b/libs/gst/controller/gstlfocontrolsource.h index 581e9d3d44..2ce6d8427b 100644 --- a/libs/gst/controller/gstlfocontrolsource.h +++ b/libs/gst/controller/gstlfocontrolsource.h @@ -93,7 +93,7 @@ GType gst_lfo_waveform_get_type (void); /* Functions */ -GstLFOControlSource *gst_lfo_control_source_new (void); +GstControlSource *gst_lfo_control_source_new (void); G_END_DECLS diff --git a/libs/gst/controller/gsttriggercontrolsource.c b/libs/gst/controller/gsttriggercontrolsource.c index 44a257d4d4..94636bed45 100644 --- a/libs/gst/controller/gsttriggercontrolsource.c +++ b/libs/gst/controller/gsttriggercontrolsource.c @@ -184,7 +184,7 @@ G_DEFINE_TYPE_WITH_CODE (GstTriggerControlSource, gst_trigger_control_source, * * Returns: (transfer full): a new, unbound #GstTriggerControlSource. */ -GstTriggerControlSource * +GstControlSource * gst_trigger_control_source_new (void) { return g_object_newv (GST_TYPE_TRIGGER_CONTROL_SOURCE, 0, NULL); diff --git a/libs/gst/controller/gsttriggercontrolsource.h b/libs/gst/controller/gsttriggercontrolsource.h index f3d9939351..1f1f1326fe 100644 --- a/libs/gst/controller/gsttriggercontrolsource.h +++ b/libs/gst/controller/gsttriggercontrolsource.h @@ -76,7 +76,7 @@ GType gst_trigger_control_source_get_type (void); /* Functions */ -GstTriggerControlSource *gst_trigger_control_source_new (void); +GstControlSource *gst_trigger_control_source_new (void); G_END_DECLS diff --git a/tests/benchmarks/controller.c b/tests/benchmarks/controller.c index 089fb01b1e..850b4c14c7 100644 --- a/tests/benchmarks/controller.c +++ b/tests/benchmarks/controller.c @@ -83,7 +83,8 @@ main (gint argc, gchar * argv[]) gint i, j; GstElement *src, *sink; GstElement *bin; - GstInterpolationControlSource *csource; + GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstClockTime bt, ct; GstClockTimeDiff elapsed; GstClockTime tick; @@ -111,12 +112,12 @@ main (gint argc, gchar * argv[]) tick = BLOCK_SIZE * GST_SECOND / 44100; /* create and configure control source */ - csource = gst_interpolation_control_source_new (); - gst_object_add_control_binding (GST_OBJECT (src), - gst_direct_control_binding_new (GST_OBJECT (src), "freq", - GST_CONTROL_SOURCE (csource))); - g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; + 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 * a stored project @@ -124,8 +125,8 @@ main (gint argc, gchar * argv[]) bt = gst_util_get_timestamp (); for (i = 0; i < NUM_CP; i++) { - gst_timed_value_control_source_set ((GstTimedValueControlSource *) csource, - i * tick, g_random_double_range (50.0, 3000.0)); + gst_timed_value_control_source_set (tvcs, i * tick, + g_random_double_range (50.0, 3000.0)); } ct = gst_util_get_timestamp (); @@ -141,8 +142,8 @@ main (gint argc, gchar * argv[]) for (i = 0; i < 100; i++) { j = g_random_int_range (0, NUM_CP - 1); - gst_timed_value_control_source_set ((GstTimedValueControlSource *) csource, - j * tick, g_random_double_range (50.0, 3000.0)); + gst_timed_value_control_source_set (tvcs, j * tick, + g_random_double_range (50.0, 3000.0)); } ct = gst_util_get_timestamp (); @@ -156,8 +157,8 @@ main (gint argc, gchar * argv[]) gdouble *values = g_new0 (gdouble, BLOCK_SIZE * NUM_CP); bt = gst_util_get_timestamp (); - gst_control_source_get_value_array (GST_CONTROL_SOURCE (csource), 0, - sample_duration, BLOCK_SIZE * NUM_CP, values); + gst_control_source_get_value_array (cs, 0, sample_duration, + BLOCK_SIZE * NUM_CP, values); ct = gst_util_get_timestamp (); g_free (values); elapsed = GST_CLOCK_DIFF (bt, ct); @@ -165,8 +166,6 @@ main (gint argc, gchar * argv[]) GST_TIME_ARGS (elapsed)); } - gst_object_unref (csource); - /* play, this test sequential reads */ bt = gst_util_get_timestamp (); @@ -182,7 +181,8 @@ main (gint argc, gchar * argv[]) GST_TIME_ARGS (elapsed)); /* cleanup */ - gst_object_unref (G_OBJECT (bin)); + gst_object_unref (cs); + gst_object_unref (bin); res = 0; Error: return res; diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c index 78bdad0281..68388c7310 100644 --- a/tests/check/libs/controller.c +++ b/tests/check/libs/controller.c @@ -279,22 +279,20 @@ teardown (void) GST_START_TEST (controller_controlsource_empty1) { GstElement *elem; - GstControlSource *csource; + GstControlSource *cs; elem = gst_element_factory_make ("testobj", NULL); - csource = (GstControlSource *) gst_interpolation_control_source_new (); - fail_unless (csource != NULL, NULL); + cs = gst_interpolation_control_source_new (); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), - gst_direct_control_binding_new (GST_OBJECT (elem), "int", - (GstControlSource *) csource))); + gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* don't fail on empty control point lists */ gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND); /* unref objects */ - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -304,30 +302,28 @@ GST_END_TEST; GST_START_TEST (controller_controlsource_empty2) { GstElement *elem; - GstInterpolationControlSource *csource; - GstTimedValueControlSource *cs; + GstControlSource *cs; + GstTimedValueControlSource *tvcs; elem = gst_element_factory_make ("testobj", NULL); - csource = gst_interpolation_control_source_new (); - fail_unless (csource != NULL, NULL); + cs = gst_interpolation_control_source_new (); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), - gst_direct_control_binding_new (GST_OBJECT (elem), "int", - (GstControlSource *) csource))); + gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* set control values */ - cs = (GstTimedValueControlSource *) csource; - gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0); + tvcs = (GstTimedValueControlSource *) cs; + gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0); /* ... 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 */ gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND); /* unref objects */ - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -336,25 +332,22 @@ GST_END_TEST; /* test timed value handling without interpolation */ GST_START_TEST (controller_interpolation_none) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; gdouble v; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -389,24 +382,21 @@ GST_END_TEST; /* test timed value handling with linear interpolation */ GST_START_TEST (controller_interpolation_linear) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -429,24 +419,21 @@ GST_END_TEST; /* test timed value handling with cubic interpolation */ GST_START_TEST (controller_interpolation_cubic) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs))); /* 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 */ 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); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 80.0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -478,24 +465,21 @@ GST_END_TEST; /* test timed value handling with cubic interpolation */ GST_START_TEST (controller_interpolation_cubic_too_few_cp) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs))); /* 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 */ 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); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_double, 40.0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -520,24 +504,21 @@ GST_END_TEST; /* test _unset() */ GST_START_TEST (controller_interpolation_unset) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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); fail_if (gst_timed_value_control_source_unset (tvcs, 2 * GST_SECOND)); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -576,24 +557,21 @@ GST_END_TEST; /* test _unset_all() */ GST_START_TEST (controller_interpolation_unset_all) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -622,9 +600,8 @@ GST_END_TEST; /* test retrieval of an array of values with get_value_array() */ GST_START_TEST (controller_interpolation_linear_value_array) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; gdouble *raw_values; GValue *g_values; @@ -632,16 +609,14 @@ GST_START_TEST (controller_interpolation_linear_value_array) elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -678,24 +653,21 @@ GST_END_TEST; /* test if values below minimum and above maximum are clipped */ GST_START_TEST (controller_interpolation_linear_invalid_values) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "float", cs))); /* 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 */ 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); fail_unless_equals_float (GST_TEST_OBJ (elem)->val_float, 0.0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -730,30 +702,26 @@ GST_END_TEST; GST_START_TEST (controller_interpolation_linear_default_values) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 * 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_int)); + fail_if (gst_timed_value_control_source_set (tvcs, 1 * GST_SECOND, &val_int)); */ /* 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -797,32 +765,27 @@ GST_END_TEST; /* test gst_controller_set_disabled() with linear interpolation */ GST_START_TEST (controller_interpolation_linear_disabled) { - GstInterpolationControlSource *csource1, *csource2; - GstTimedValueControlSource *tvcs1, *tvcs2; GstControlSource *cs1, *cs2; + GstTimedValueControlSource *tvcs1, *tvcs2; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource1 = gst_interpolation_control_source_new (); - tvcs1 = (GstTimedValueControlSource *) csource1; - cs1 = (GstControlSource *) csource1; + cs1 = gst_interpolation_control_source_new (); + tvcs1 = (GstTimedValueControlSource *) cs1; - csource2 = gst_interpolation_control_source_new (); - tvcs2 = (GstTimedValueControlSource *) csource2; - cs2 = (GstControlSource *) csource2; + cs2 = gst_interpolation_control_source_new (); + tvcs2 = (GstTimedValueControlSource *) cs2; - fail_unless (csource1 != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs1))); - fail_unless (csource2 != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "double", cs2))); /* set interpolation mode */ - g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); - g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); + g_object_set (cs1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); + g_object_set (cs2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); /* set control values */ 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_float (GST_TEST_OBJ (elem)->val_double, 40.0); - gst_object_unref (csource1); - gst_object_unref (csource2); + gst_object_unref (cs1); + gst_object_unref (cs2); gst_object_unref (elem); } @@ -923,9 +886,8 @@ GST_END_TEST; GST_START_TEST (controller_interpolation_set_from_list) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstTimedValue *tval; GstElement *elem; GSList *list = NULL; @@ -934,16 +896,14 @@ GST_START_TEST (controller_interpolation_set_from_list) elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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 */ g_free (tval); g_slist_free (list); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -971,24 +931,21 @@ GST_END_TEST; /* test linear interpolation for ts < first control point */ GST_START_TEST (controller_interpolation_linear_before_ts0) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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 */ 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 25); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1018,24 +975,21 @@ GST_END_TEST; /* test linear interpolation of enums */ GST_START_TEST (controller_interpolation_linear_enums) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "enum", cs))); /* 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 */ 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_enum, ENUM_V255); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1062,24 +1016,21 @@ GST_END_TEST; /* test timed value counts */ GST_START_TEST (controller_timed_value_count) { - GstInterpolationControlSource *csource; - GstTimedValueControlSource *tvcs; GstControlSource *cs; + GstTimedValueControlSource *tvcs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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); @@ -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_get_count (tvcs) == 0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1105,22 +1056,19 @@ GST_END_TEST; /* test lfo control source with sine waveform */ GST_START_TEST (controller_lfo_sine) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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, "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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1159,22 +1107,19 @@ GST_END_TEST; /* test lfo control source with sine waveform and timeshift */ GST_START_TEST (controller_lfo_sine_timeshift) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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, "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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 50); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1213,22 +1158,19 @@ GST_END_TEST; /* test lfo control source with square waveform */ GST_START_TEST (controller_lfo_square) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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, "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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1267,22 +1209,19 @@ GST_END_TEST; /* test lfo control source with saw waveform */ GST_START_TEST (controller_lfo_saw) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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, "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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 25); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1321,22 +1260,19 @@ GST_END_TEST; /* test lfo control source with reverse saw waveform */ GST_START_TEST (controller_lfo_rsaw) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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, "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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 75); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1375,22 +1311,19 @@ GST_END_TEST; /* test lfo control source with saw waveform */ GST_START_TEST (controller_lfo_triangle) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), gst_direct_control_binding_new (GST_OBJECT (elem), "int", cs))); /* 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, "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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1429,17 +1362,14 @@ GST_END_TEST; /* test lfo control source with nothing set */ GST_START_TEST (controller_lfo_none) { - GstLFOControlSource *csource; GstControlSource *cs; GstElement *elem; elem = gst_element_factory_make ("testobj", NULL); /* new lfo control source */ - csource = gst_lfo_control_source_new (); - cs = (GstControlSource *) csource; + cs = gst_lfo_control_source_new (); - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1478,7 +1408,6 @@ GST_END_TEST; /* test timed value handling in trigger mode */ GST_START_TEST (controller_trigger_exact) { - GstTriggerControlSource *csource; GstControlSource *cs; GstTimedValueControlSource *tvcs; GstElement *elem; @@ -1487,11 +1416,9 @@ GST_START_TEST (controller_trigger_exact) elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_trigger_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_trigger_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), 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); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } @@ -1524,7 +1451,6 @@ GST_END_TEST; GST_START_TEST (controller_trigger_tolerance) { - GstTriggerControlSource *csource; GstControlSource *cs; GstTimedValueControlSource *tvcs; GstElement *elem; @@ -1533,15 +1459,13 @@ GST_START_TEST (controller_trigger_tolerance) elem = gst_element_factory_make ("testobj", NULL); /* new interpolation control source */ - csource = gst_trigger_control_source_new (); - tvcs = (GstTimedValueControlSource *) csource; - cs = (GstControlSource *) csource; + cs = gst_trigger_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; - fail_unless (csource != NULL); fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), 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)); @@ -1564,7 +1488,7 @@ GST_START_TEST (controller_trigger_tolerance) gst_object_sync_values (GST_OBJECT (elem), 2 * GST_SECOND); fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 100); - gst_object_unref (csource); + gst_object_unref (cs); gst_object_unref (elem); } diff --git a/tests/examples/controller/audio-example.c b/tests/examples/controller/audio-example.c index 8bf36fdf68..64944988cd 100644 --- a/tests/examples/controller/audio-example.c +++ b/tests/examples/controller/audio-example.c @@ -17,8 +17,8 @@ main (gint argc, gchar ** argv) gint res = 1; GstElement *src, *sink; GstElement *bin; - GstInterpolationControlSource *csource1, *csource2; - GstTimedValueControlSource *cs; + GstControlSource *cs1, *cs2; + GstTimedValueControlSource *tvcs; GstClock *clock; GstClockID clock_id; GstClockReturn wait_ret; @@ -46,34 +46,32 @@ main (gint argc, gchar ** argv) } /* setup control sources */ - csource1 = gst_interpolation_control_source_new (); - csource2 = gst_interpolation_control_source_new (); + cs1 = gst_interpolation_control_source_new (); + cs2 = gst_interpolation_control_source_new (); gst_object_add_control_binding (GST_OBJECT_CAST (src), - gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", - GST_CONTROL_SOURCE (csource1))); + gst_direct_control_binding_new (GST_OBJECT_CAST (src), "volume", cs1)); gst_object_add_control_binding (GST_OBJECT_CAST (src), - gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", - GST_CONTROL_SOURCE (csource2))); + gst_direct_control_binding_new (GST_OBJECT_CAST (src), "freq", cs2)); /* set interpolation mode */ - g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); - g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); + g_object_set (cs1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); + g_object_set (cs2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); /* set control values */ - cs = (GstTimedValueControlSource *) csource1; - gst_timed_value_control_source_set (cs, 0 * GST_SECOND, 0.0); - gst_timed_value_control_source_set (cs, 5 * GST_SECOND, 1.0); + tvcs = (GstTimedValueControlSource *) cs1; + gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0); + gst_timed_value_control_source_set (tvcs, 5 * GST_SECOND, 1.0); - gst_object_unref (csource1); + gst_object_unref (cs1); - cs = (GstTimedValueControlSource *) csource2; - gst_timed_value_control_source_set (cs, 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 (cs, 6 * GST_SECOND, 440.0 / 20000.0); + tvcs = (GstTimedValueControlSource *) cs2; + gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 220.0 / 20000.0); + gst_timed_value_control_source_set (tvcs, 3 * GST_SECOND, 3520.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 */ clock_id = @@ -89,8 +87,8 @@ main (gint argc, gchar ** argv) /* cleanup */ gst_clock_id_unref (clock_id); - gst_object_unref (G_OBJECT (clock)); - gst_object_unref (G_OBJECT (bin)); + gst_object_unref (clock); + gst_object_unref (bin); res = 0; Error: return (res); diff --git a/tests/examples/controller/control-sources.c b/tests/examples/controller/control-sources.c index 1c3410c7b9..950cee2edf 100644 --- a/tests/examples/controller/control-sources.c +++ b/tests/examples/controller/control-sources.c @@ -179,7 +179,6 @@ static void test_interpolation (void) { GstObject *e; - GstInterpolationControlSource *ics; GstTimedValueControlSource *tvcs; GstControlSource *cs; gint t, i1, i2, i3; @@ -189,9 +188,8 @@ test_interpolation (void) e = (GstObject *) gst_element_factory_make ("testobj", NULL); - ics = gst_interpolation_control_source_new (); - tvcs = (GstTimedValueControlSource *) ics; - cs = (GstControlSource *) ics; + cs = gst_interpolation_control_source_new (); + tvcs = (GstTimedValueControlSource *) cs; gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int", cs)); @@ -207,15 +205,15 @@ test_interpolation (void) fprintf (f, "# Time None Linear Cubic\n"); 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); 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); 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); i3 = GST_TEST_OBJ (e)->val_int; @@ -230,15 +228,15 @@ test_interpolation (void) fprintf (f, "# Time None Linear Cubic\n"); 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); 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); 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); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v3); @@ -257,7 +255,7 @@ test_interpolation (void) fclose (f); - gst_object_unref (ics); + gst_object_unref (cs); gst_object_unref (e); } @@ -265,7 +263,6 @@ static void test_lfo (void) { GstObject *e; - GstLFOControlSource *lfocs; GstControlSource *cs; gint t, i1, i2, i3, i4, i5; GValue *v1, *v2, *v3, *v4, *v5; @@ -274,13 +271,12 @@ test_lfo (void) e = (GstObject *) gst_element_factory_make ("testobj", NULL); - lfocs = gst_lfo_control_source_new (); - cs = (GstControlSource *) lfocs; + cs = gst_lfo_control_source_new (); gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int", cs)); - g_object_set (lfocs, + g_object_set (cs, "frequency", (gdouble) 0.05, "timeshift", (GstClockTime) 0, "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"); 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); 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); 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); 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); 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); i5 = GST_TEST_OBJ (e)->val_int; @@ -322,23 +318,23 @@ test_lfo (void) fprintf (f, "# Time Sine Square Saw RevSaw Triangle\n"); 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); 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); 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); 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); 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); gst_object_get_value_array (e, "int", 0, GST_SECOND / 10, n_values, v5); @@ -364,7 +360,7 @@ test_lfo (void) fclose (f); - gst_object_unref (lfocs); + gst_object_unref (cs); gst_object_unref (e); } @@ -372,7 +368,6 @@ static void test_chained_lfo (void) { GstObject *e; - GstLFOControlSource *lfocs1, *lfocs2; GstControlSource *cs1, *cs2; gint t, i1; GValue *v1; @@ -381,24 +376,22 @@ test_chained_lfo (void) e = (GstObject *) gst_element_factory_make ("testobj", NULL); - lfocs1 = gst_lfo_control_source_new (); - cs1 = (GstControlSource *) lfocs1; + cs1 = gst_lfo_control_source_new (); gst_object_add_control_binding (e, gst_direct_control_binding_new (e, "int", cs1)); - g_object_set (lfocs1, + g_object_set (cs1, "waveform", GST_LFO_WAVEFORM_SINE, "frequency", (gdouble) 0.05, "timeshift", (GstClockTime) 0, "offset", (gdouble) 0.5, NULL); - lfocs2 = gst_lfo_control_source_new (); - cs2 = (GstControlSource *) lfocs2; + cs2 = gst_lfo_control_source_new (); - gst_object_add_control_binding ((GstObject *) lfocs1, - gst_direct_control_binding_new ((GstObject *) lfocs1, "amplitude", cs2)); + gst_object_add_control_binding ((GstObject *) cs1, + gst_direct_control_binding_new ((GstObject *) cs1, "amplitude", cs2)); - g_object_set (lfocs2, + g_object_set (cs2, "waveform", GST_LFO_WAVEFORM_SINE, "frequency", (gdouble) 0.05, "timeshift", (GstClockTime) 0, @@ -436,8 +429,8 @@ test_chained_lfo (void) fclose (f); - gst_object_unref (lfocs1); - gst_object_unref (lfocs2); + gst_object_unref (cs1); + gst_object_unref (cs2); gst_object_unref (e); } diff --git a/tests/examples/controller/text-color-example.c b/tests/examples/controller/text-color-example.c index df335b47ec..00b3c9f3a6 100644 --- a/tests/examples/controller/text-color-example.c +++ b/tests/examples/controller/text-color-example.c @@ -19,8 +19,8 @@ main (gint argc, gchar ** argv) gint res = 1; GstElement *src, *text, *sink; GstElement *bin; - GstLFOControlSource *cs; - GstLFOControlSource *cs_r, *cs_g, *cs_b; + GstControlSource *cs; + GstControlSource *cs_r, *cs_g, *cs_b; GstClock *clock; GstClockID clock_id; GstClockReturn wait_ret; @@ -65,8 +65,7 @@ main (gint argc, gchar ** argv) "frequency", (gdouble) 0.11, "amplitude", (gdouble) 0.2, "offset", (gdouble) 0.5, NULL); gst_object_add_control_binding (GST_OBJECT_CAST (text), - gst_direct_control_binding_new (GST_OBJECT_CAST (text), "xpos", - GST_CONTROL_SOURCE (cs))); + gst_direct_control_binding_new (GST_OBJECT_CAST (text), "xpos", cs)); gst_object_unref (cs); cs = gst_lfo_control_source_new (); @@ -74,8 +73,7 @@ main (gint argc, gchar ** argv) "frequency", (gdouble) 0.04, "amplitude", (gdouble) 0.4, "offset", (gdouble) 0.5, NULL); gst_object_add_control_binding (GST_OBJECT_CAST (text), - gst_direct_control_binding_new (GST_OBJECT_CAST (text), "ypos", - GST_CONTROL_SOURCE (cs))); + gst_direct_control_binding_new (GST_OBJECT_CAST (text), "ypos", cs)); gst_object_unref (cs); 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); gst_object_add_control_binding (GST_OBJECT_CAST (text), gst_argb_control_binding_new (GST_OBJECT_CAST (text), "color", NULL, - GST_CONTROL_SOURCE (cs_r), GST_CONTROL_SOURCE (cs_g), - GST_CONTROL_SOURCE (cs_b))); + cs_r, cs_g, cs_b)); gst_object_unref (cs_r); gst_object_unref (cs_g); gst_object_unref (cs_b);