summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 900aea4)
raw | patch | inline | side by side (parent: 900aea4)
author | Stefan Kost <ensonic@users.sourceforge.net> | |
Mon, 17 Oct 2005 17:05:38 +0000 (17:05 +0000) | ||
committer | Stefan Kost <ensonic@users.sourceforge.net> | |
Mon, 17 Oct 2005 17:05:38 +0000 (17:05 +0000) |
Original commit message from CVS:
* check/gst-libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
* testsuite/controller/.cvsignore:
* testsuite/controller/Makefile.am:
* testsuite/controller/interpolator.c:
merge controller testsuites
fix broken tests
remove mem-chunk from docs
* check/gst-libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_set_interpolation_mode):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
* testsuite/controller/.cvsignore:
* testsuite/controller/Makefile.am:
* testsuite/controller/interpolator.c:
merge controller testsuites
fix broken tests
remove mem-chunk from docs
13 files changed:
ChangeLog | patch | blob | history | |
check/gst-libs/controller.c | patch | blob | history | |
common | patch | blob | history | |
libs/gst/controller/gstcontroller.c | patch | blob | history | |
libs/gst/controller/gstcontroller.h | patch | blob | history | |
libs/gst/controller/gstinterpolation.c | patch | blob | history | |
tests/check/libs/controller.c | patch | blob | history | |
tests/old/testsuite/controller/.gitignore | [deleted file] | patch | blob | history |
tests/old/testsuite/controller/Makefile.am | [deleted file] | patch | blob | history |
tests/old/testsuite/controller/interpolator.c | [deleted file] | patch | blob | history |
testsuite/controller/.gitignore | [deleted file] | patch | blob | history |
testsuite/controller/Makefile.am | [deleted file] | patch | blob | history |
testsuite/controller/interpolator.c | [deleted file] | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index b27aba1e5e631c6f6481cf5854f76fa0dfce43c8..5d0bca729479cc5c5e18eece76edfc789b7fcdad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2005-10-17 Stefan Kost <ensonic@users.sf.net>
+
+ * check/gst-libs/controller.c: (GST_START_TEST),
+ (gst_controller_suite):
+ * libs/gst/controller/gstcontroller.c:
+ (gst_controlled_property_set_interpolation_mode):
+ * libs/gst/controller/gstcontroller.h:
+ * libs/gst/controller/gstinterpolation.c:
+ * testsuite/controller/.cvsignore:
+ * testsuite/controller/Makefile.am:
+ * testsuite/controller/interpolator.c:
+ merge controller testsuites
+ fix broken tests
+ remove mem-chunk from docs
+
2005-10-17 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gstmemchunk.c:
index cd83e2bc854c54d4424dfc1a377f54f4cb5abb24..030943285a243a68f4686eb7316c77e859f40b68 100644 (file)
GST_END_TEST;
+/* test timed value handling in trigger mode */
+GST_START_TEST (controller_interpolate_trigger)
+{
+ GstController *ctrl;
+ GstElement *elem;
+ gboolean res;
+ GValue val_ulong = { 0, };
+
+ elem = gst_element_factory_make ("testmonosource", "test_source");
+
+ /* that property should exist and should be controllable */
+ ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
+ fail_unless (ctrl != NULL, NULL);
+
+ /* set interpolation mode */
+ gst_controller_set_interpolation_mode (ctrl, "ulong",
+ GST_INTERPOLATE_TRIGGER);
+
+ /* set control values */
+ g_value_init (&val_ulong, G_TYPE_ULONG);
+ g_value_set_ulong (&val_ulong, 50);
+ res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+ g_value_set_ulong (&val_ulong, 100);
+ res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+
+ /* now pull in values for some timestamps */
+ gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
+ GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
+ gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
+ gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
+
+ GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
+ g_object_unref (ctrl);
+ gst_object_unref (elem);
+}
+
+GST_END_TEST;
+
+/* test timed value handling with linear interpolation */
+GST_START_TEST (controller_interpolate_linear)
+{
+ GstController *ctrl;
+ GstElement *elem;
+ gboolean res;
+ GValue val_ulong = { 0, };
+
+ elem = gst_element_factory_make ("testmonosource", "test_source");
+
+ /* that property should exist and should be controllable */
+ ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
+ fail_unless (ctrl != NULL, NULL);
+
+ /* set interpolation mode */
+ gst_controller_set_interpolation_mode (ctrl, "ulong", GST_INTERPOLATE_LINEAR);
+
+ /* set control values */
+ g_value_init (&val_ulong, G_TYPE_ULONG);
+ g_value_set_ulong (&val_ulong, 0);
+ res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+ g_value_set_ulong (&val_ulong, 100);
+ res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+
+ /* now pull in values for some timestamps */
+ gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
+ gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
+ gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
+
+ GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
+ g_object_unref (ctrl);
+ gst_object_unref (elem);
+}
+
+GST_END_TEST;
+
/* tests if we can run helper methods against any GObject */
GST_START_TEST (controller_helper_any_gobject)
{
tcase_add_test (tc, controller_param_twice);
tcase_add_test (tc, controller_finalize);
tcase_add_test (tc, controller_interpolate_none);
+ tcase_add_test (tc, controller_interpolate_trigger);
+ tcase_add_test (tc, controller_interpolate_linear);
tcase_add_test (tc, controller_helper_any_gobject);
return s;
index 3a9d355b657cf710011aa1eaadd64f6723527e14..cf363b3ae6ce3c4a84a561e04ffc4e3b37435a61 160000 (submodule)
--- a/common
+++ b/common
-Subproject commit 3a9d355b657cf710011aa1eaadd64f6723527e14
+Subproject commit cf363b3ae6ce3c4a84a561e04ffc4e3b37435a61
index a5b5fada786dd1dcd5b8b53fcd7cc5a1ea4bb0bc..457d7196df1a54dc2588a0272cd6ce083686babe 100644 (file)
if (mode != GST_INTERPOLATE_USER) {
switch (self->type) {
case G_TYPE_INT:
- case G_TYPE_UINT:
self->get = interpolation_methods[mode]->get_int;
self->get_value_array =
interpolation_methods[mode]->get_int_value_array;
break;
+ case G_TYPE_UINT:
+ self->get = interpolation_methods[mode]->get_uint;
+ self->get_value_array =
+ interpolation_methods[mode]->get_uint_value_array;
+ break;
case G_TYPE_LONG:
- case G_TYPE_ULONG:
self->get = interpolation_methods[mode]->get_long;
self->get_value_array =
interpolation_methods[mode]->get_long_value_array;
break;
+ case G_TYPE_ULONG:
+ self->get = interpolation_methods[mode]->get_ulong;
+ self->get_value_array =
+ interpolation_methods[mode]->get_ulong_value_array;
+ break;
case G_TYPE_FLOAT:
self->get = interpolation_methods[mode]->get_float;
self->get_value_array =
index 2fa4234ebb746b7d701db7afebcc7454a3a79264..ff51b7c7ea060ee2c47795d168cadc83bb8ad1a7 100644 (file)
{
InterpolateGet get_int;
InterpolateGetValueArray get_int_value_array;
+ InterpolateGet get_uint;
+ InterpolateGetValueArray get_uint_value_array;
InterpolateGet get_long;
InterpolateGetValueArray get_long_value_array;
+ InterpolateGet get_ulong;
+ InterpolateGetValueArray get_ulong_value_array;
InterpolateGet get_float;
InterpolateGetValueArray get_float_value_array;
InterpolateGet get_double;
index 192ea1f2274b921a17d718efdf12f040640abf1e..31e031f9631a04936d5489b0b028b7bf1bcb1e00 100644 (file)
}
DEFINE_NONE_GET (int)
+ DEFINE_NONE_GET (uint)
DEFINE_NONE_GET (long)
+DEFINE_NONE_GET (ulong)
DEFINE_NONE_GET (float)
DEFINE_NONE_GET (double)
DEFINE_NONE_GET (boolean)
interpolate_none_get,
interpolate_none_get_int_value_array,
interpolate_none_get,
+ interpolate_none_get_uint_value_array,
+ interpolate_none_get,
interpolate_none_get_long_value_array,
interpolate_none_get,
+ interpolate_none_get_ulong_value_array,
+ interpolate_none_get,
interpolate_none_get_float_value_array,
interpolate_none_get,
interpolate_none_get_double_value_array,
interpolate_trigger_get,
NULL,
interpolate_trigger_get,
+ NULL,
+ interpolate_trigger_get,
+ NULL,
+ interpolate_trigger_get,
NULL
};
}
DEFINE_LINEAR_GET (int)
+DEFINE_LINEAR_GET (uint)
DEFINE_LINEAR_GET (long)
+DEFINE_LINEAR_GET (ulong)
DEFINE_LINEAR_GET (float)
DEFINE_LINEAR_GET (double)
static GstInterpolateMethod interpolate_linear = {
interpolate_linear_get_int,
interpolate_linear_get_int_value_array,
+ interpolate_linear_get_uint,
+ interpolate_linear_get_uint_value_array,
interpolate_linear_get_long,
interpolate_linear_get_long_value_array,
+ interpolate_linear_get_ulong,
+ interpolate_linear_get_ulong_value_array,
interpolate_linear_get_float,
interpolate_linear_get_float_value_array,
interpolate_linear_get_double,
index cd83e2bc854c54d4424dfc1a377f54f4cb5abb24..030943285a243a68f4686eb7316c77e859f40b68 100644 (file)
GST_END_TEST;
+/* test timed value handling in trigger mode */
+GST_START_TEST (controller_interpolate_trigger)
+{
+ GstController *ctrl;
+ GstElement *elem;
+ gboolean res;
+ GValue val_ulong = { 0, };
+
+ elem = gst_element_factory_make ("testmonosource", "test_source");
+
+ /* that property should exist and should be controllable */
+ ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
+ fail_unless (ctrl != NULL, NULL);
+
+ /* set interpolation mode */
+ gst_controller_set_interpolation_mode (ctrl, "ulong",
+ GST_INTERPOLATE_TRIGGER);
+
+ /* set control values */
+ g_value_init (&val_ulong, G_TYPE_ULONG);
+ g_value_set_ulong (&val_ulong, 50);
+ res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+ g_value_set_ulong (&val_ulong, 100);
+ res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+
+ /* now pull in values for some timestamps */
+ gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
+ GST_TEST_MONO_SOURCE (elem)->val_ulong = 0;
+ gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
+ gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
+
+ GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
+ g_object_unref (ctrl);
+ gst_object_unref (elem);
+}
+
+GST_END_TEST;
+
+/* test timed value handling with linear interpolation */
+GST_START_TEST (controller_interpolate_linear)
+{
+ GstController *ctrl;
+ GstElement *elem;
+ gboolean res;
+ GValue val_ulong = { 0, };
+
+ elem = gst_element_factory_make ("testmonosource", "test_source");
+
+ /* that property should exist and should be controllable */
+ ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
+ fail_unless (ctrl != NULL, NULL);
+
+ /* set interpolation mode */
+ gst_controller_set_interpolation_mode (ctrl, "ulong", GST_INTERPOLATE_LINEAR);
+
+ /* set control values */
+ g_value_init (&val_ulong, G_TYPE_ULONG);
+ g_value_set_ulong (&val_ulong, 0);
+ res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+ g_value_set_ulong (&val_ulong, 100);
+ res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong);
+ fail_unless (res, NULL);
+
+ /* now pull in values for some timestamps */
+ gst_controller_sync_values (ctrl, 0 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
+ gst_controller_sync_values (ctrl, 1 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
+ gst_controller_sync_values (ctrl, 2 * GST_SECOND);
+ fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
+
+ GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
+ g_object_unref (ctrl);
+ gst_object_unref (elem);
+}
+
+GST_END_TEST;
+
/* tests if we can run helper methods against any GObject */
GST_START_TEST (controller_helper_any_gobject)
{
tcase_add_test (tc, controller_param_twice);
tcase_add_test (tc, controller_finalize);
tcase_add_test (tc, controller_interpolate_none);
+ tcase_add_test (tc, controller_interpolate_trigger);
+ tcase_add_test (tc, controller_interpolate_linear);
tcase_add_test (tc, controller_helper_any_gobject);
return s;
diff --git a/tests/old/testsuite/controller/.gitignore b/tests/old/testsuite/controller/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-Makefile
-Makefile.in
-*.o
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-.deps
-.libs
-interpolator
diff --git a/tests/old/testsuite/controller/Makefile.am b/tests/old/testsuite/controller/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-include ../Rules
-
-tests_pass = interpolator
-tests_fail =
-tests_ignore =
-
-interpolator_SOURCES = interpolator.c
-interpolator_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs
-interpolator_LDFLAGS = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
diff --git a/tests/old/testsuite/controller/interpolator.c b/tests/old/testsuite/controller/interpolator.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * interpolator.c
- *
- * test interpolator methods
- *
- */
-
-#include <gst/gst.h>
-#include <gst/controller/gst-controller.h>
-
-extern GstInterpolateMethod *interpolation_methods[];
-
-gint
-main (gint argc, gchar ** argv)
-{
- gint res = 1;
- GstControlledProperty *prop = NULL;
- GType type = G_TYPE_INT;
- GstTimedValue tv1 = { 0, }, tv2 = {
- 0,}, tv3 = {
- 0,};
- GValue *val;
- gint i;
-
- gst_init (&argc, &argv);
- gst_controller_init (&argc, &argv);
-
- // build fake controlled property
-
- if ((prop = g_new0 (GstControlledProperty, 1))) {
- prop->name = "test";
- //prop->parent_type = G_OBJECT_TYPE (object);
- prop->type = type;
-
- g_value_init (&prop->default_value, type);
- g_value_set_int (&prop->default_value, 0);
- g_value_init (&prop->result_value, type);
-
- // set timed values
- tv1.timestamp = 0;
- g_value_init (&tv1.value, type);
- g_value_set_int (&tv1.value, 0);
- prop->values = g_list_append (prop->values, &tv1);
-
- tv2.timestamp = 10 * GST_SECOND;
- g_value_init (&tv2.value, type);
- g_value_set_int (&tv2.value, 100);
- prop->values = g_list_append (prop->values, &tv2);
-
- tv3.timestamp = 20 * GST_SECOND;
- g_value_init (&tv3.value, type);
- g_value_set_int (&tv3.value, 50);
- prop->values = g_list_append (prop->values, &tv3);
-
- g_print ("# time trig none line\n");
-
- // test interpolator
- for (i = 0; i < 25; i++) {
- g_print (" %4d", i);
-
- prop->interpolation = GST_INTERPOLATE_TRIGGER;
- prop->get = interpolation_methods[prop->interpolation]->get_int;
- prop->get_value_array =
- interpolation_methods[prop->interpolation]->get_int_value_array;
- val = prop->get (prop, i * GST_SECOND);
- g_print (" %4d", (val ? g_value_get_int (val) : 0));
-
- prop->interpolation = GST_INTERPOLATE_NONE;
- prop->get = interpolation_methods[prop->interpolation]->get_int;
- prop->get_value_array =
- interpolation_methods[prop->interpolation]->get_int_value_array;
- val = prop->get (prop, i * GST_SECOND);
- g_print (" %4d", (val ? g_value_get_int (val) : 0));
-
- prop->interpolation = GST_INTERPOLATE_LINEAR;
- prop->get = interpolation_methods[prop->interpolation]->get_int;
- prop->get_value_array =
- interpolation_methods[prop->interpolation]->get_int_value_array;
- val = prop->get (prop, i * GST_SECOND);
- g_print (" %4d", (val ? g_value_get_int (val) : 0));
-
- g_print ("\n");
- }
-
- g_list_free (prop->values);
- g_free (prop);
- res = 0;
- }
- return (res);
-}
diff --git a/testsuite/controller/.gitignore b/testsuite/controller/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-Makefile
-Makefile.in
-*.o
-*.lo
-*.la
-*.bb
-*.bbg
-*.da
-.deps
-.libs
-interpolator
diff --git a/testsuite/controller/Makefile.am b/testsuite/controller/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-include ../Rules
-
-tests_pass = interpolator
-tests_fail =
-tests_ignore =
-
-interpolator_SOURCES = interpolator.c
-interpolator_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs
-interpolator_LDFLAGS = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
diff --git a/testsuite/controller/interpolator.c b/testsuite/controller/interpolator.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * interpolator.c
- *
- * test interpolator methods
- *
- */
-
-#include <gst/gst.h>
-#include <gst/controller/gst-controller.h>
-
-extern GstInterpolateMethod *interpolation_methods[];
-
-gint
-main (gint argc, gchar ** argv)
-{
- gint res = 1;
- GstControlledProperty *prop = NULL;
- GType type = G_TYPE_INT;
- GstTimedValue tv1 = { 0, }, tv2 = {
- 0,}, tv3 = {
- 0,};
- GValue *val;
- gint i;
-
- gst_init (&argc, &argv);
- gst_controller_init (&argc, &argv);
-
- // build fake controlled property
-
- if ((prop = g_new0 (GstControlledProperty, 1))) {
- prop->name = "test";
- //prop->parent_type = G_OBJECT_TYPE (object);
- prop->type = type;
-
- g_value_init (&prop->default_value, type);
- g_value_set_int (&prop->default_value, 0);
- g_value_init (&prop->result_value, type);
-
- // set timed values
- tv1.timestamp = 0;
- g_value_init (&tv1.value, type);
- g_value_set_int (&tv1.value, 0);
- prop->values = g_list_append (prop->values, &tv1);
-
- tv2.timestamp = 10 * GST_SECOND;
- g_value_init (&tv2.value, type);
- g_value_set_int (&tv2.value, 100);
- prop->values = g_list_append (prop->values, &tv2);
-
- tv3.timestamp = 20 * GST_SECOND;
- g_value_init (&tv3.value, type);
- g_value_set_int (&tv3.value, 50);
- prop->values = g_list_append (prop->values, &tv3);
-
- g_print ("# time trig none line\n");
-
- // test interpolator
- for (i = 0; i < 25; i++) {
- g_print (" %4d", i);
-
- prop->interpolation = GST_INTERPOLATE_TRIGGER;
- prop->get = interpolation_methods[prop->interpolation]->get_int;
- prop->get_value_array =
- interpolation_methods[prop->interpolation]->get_int_value_array;
- val = prop->get (prop, i * GST_SECOND);
- g_print (" %4d", (val ? g_value_get_int (val) : 0));
-
- prop->interpolation = GST_INTERPOLATE_NONE;
- prop->get = interpolation_methods[prop->interpolation]->get_int;
- prop->get_value_array =
- interpolation_methods[prop->interpolation]->get_int_value_array;
- val = prop->get (prop, i * GST_SECOND);
- g_print (" %4d", (val ? g_value_get_int (val) : 0));
-
- prop->interpolation = GST_INTERPOLATE_LINEAR;
- prop->get = interpolation_methods[prop->interpolation]->get_int;
- prop->get_value_array =
- interpolation_methods[prop->interpolation]->get_int_value_array;
- val = prop->get (prop, i * GST_SECOND);
- g_print (" %4d", (val ? g_value_get_int (val) : 0));
-
- g_print ("\n");
- }
-
- g_list_free (prop->values);
- g_free (prop);
- res = 0;
- }
- return (res);
-}