libs/gst/controller/gstcontroller.c: Fix controlling of float properties (#344849).

Original commit message from CVS:
Patch by: Wouter Paesen  <wouter at kangaroot net>
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_new):
Fix controlling of float properties (#344849).
* tests/check/libs/controller.c:
(gst_test_mono_source_get_property),
(gst_test_mono_source_set_property),
(gst_test_mono_source_class_init), (GST_START_TEST):
While we're at it, add some float stuff to unit test.
This commit is contained in:
Wouter Paesen 2006-06-14 08:26:53 +00:00 committed by Tim-Philipp Müller
parent 0734eb921c
commit fb4ad149d6
3 changed files with 36 additions and 2 deletions

View file

@ -1,3 +1,17 @@
2006-06-14 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Wouter Paesen <wouter at kangaroot net>
* libs/gst/controller/gstcontroller.c:
(gst_controlled_property_new):
Fix controlling of float properties (#344849).
* tests/check/libs/controller.c:
(gst_test_mono_source_get_property),
(gst_test_mono_source_set_property),
(gst_test_mono_source_class_init), (GST_START_TEST):
While we're at it, add some float stuff to unit test.
2006-06-13 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/README:

View file

@ -328,6 +328,7 @@ gst_controlled_property_new (GObject * object, const gchar * name)
g_value_set_float (&prop->default_value, tpspec->default_value);
}
break;
case G_TYPE_DOUBLE:{
GParamSpecDouble *tpspec = G_PARAM_SPEC_DOUBLE (pspec);

View file

@ -32,6 +32,7 @@
enum
{
ARG_ULONG = 1,
ARG_FLOAT,
ARG_DOUBLE,
ARG_BOOLEAN,
ARG_READONLY,
@ -54,6 +55,7 @@ struct _GstTestMonoSource
{
GstElement parent;
gulong val_ulong;
gfloat val_float;
gdouble val_double;
gboolean val_boolean;
};
@ -74,6 +76,9 @@ gst_test_mono_source_get_property (GObject * object,
case ARG_ULONG:
g_value_set_ulong (value, self->val_ulong);
break;
case ARG_FLOAT:
g_value_set_float (value, self->val_float);
break;
case ARG_DOUBLE:
g_value_set_double (value, self->val_double);
break;
@ -96,6 +101,9 @@ gst_test_mono_source_set_property (GObject * object,
case ARG_ULONG:
self->val_ulong = g_value_get_ulong (value);
break;
case ARG_FLOAT:
self->val_float = g_value_get_float (value);
break;
case ARG_DOUBLE:
self->val_double = g_value_get_double (value);
break;
@ -124,6 +132,12 @@ gst_test_mono_source_class_init (GstTestMonoSourceClass * klass)
"ulong number parameter for the test_mono_source",
0, G_MAXULONG, 0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_FLOAT,
g_param_spec_float ("float",
"float prop",
"float number parameter for the test_mono_source",
0.0, 100.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_DOUBLE,
g_param_spec_double ("double",
"double prop",
@ -355,7 +369,7 @@ GST_START_TEST (controller_new_okay2)
elem = gst_element_factory_make ("testmonosource", "test_source");
/* that property should exist and should be controllable */
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", NULL);
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", "float", NULL);
fail_unless (ctrl != NULL, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
@ -368,7 +382,7 @@ GST_END_TEST;
/* controlling several params should return the same controller */
GST_START_TEST (controller_new_okay3)
{
GstController *ctrl1, *ctrl2;
GstController *ctrl1, *ctrl2, *ctrl3;
GstElement *elem;
elem = gst_element_factory_make ("testmonosource", "test_source");
@ -382,6 +396,11 @@ GST_START_TEST (controller_new_okay3)
fail_unless (ctrl2 != NULL, NULL);
fail_unless (ctrl1 == ctrl2, NULL);
/* that property should exist and should be controllable */
ctrl3 = gst_controller_new (G_OBJECT (elem), "float", NULL);
fail_unless (ctrl3 != NULL, NULL);
fail_unless (ctrl1 == ctrl3, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl1)->ref_count);
g_object_unref (ctrl1);
gst_object_unref (elem);