mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 20:25:25 +00:00
controller: remove functions to add/remove controlled properties
Make that implizit with attaching/detaching controlsources. This is a lot easier and has less invalid state (controlled property without control source).
This commit is contained in:
parent
f598856765
commit
faf31366ab
7 changed files with 95 additions and 300 deletions
|
@ -1529,8 +1529,6 @@ gst_object_ref_sink
|
||||||
gst_object_replace
|
gst_object_replace
|
||||||
gst_object_get_path_string
|
gst_object_get_path_string
|
||||||
|
|
||||||
gst_object_control_properties
|
|
||||||
gst_object_uncontrol_properties
|
|
||||||
gst_object_suggest_next_sync
|
gst_object_suggest_next_sync
|
||||||
gst_object_sync_values
|
gst_object_sync_values
|
||||||
gst_object_has_active_controlled_properties
|
gst_object_has_active_controlled_properties
|
||||||
|
|
|
@ -419,10 +419,13 @@ The 0.11 porting guide
|
||||||
gst_object_sync_values() is taking a GstObject * instead of GObject *.
|
gst_object_sync_values() is taking a GstObject * instead of GObject *.
|
||||||
|
|
||||||
For applications the effect is larger. The whole gst_controller_* API is
|
For applications the effect is larger. The whole gst_controller_* API is
|
||||||
gone and now available in simplified form under gst_object_*.
|
gone and now available in simplified form under gst_object_*. There is no
|
||||||
|
more GstController object. Attach a control source to a property to control
|
||||||
|
it and attach NULL to un-control it.
|
||||||
|
|
||||||
gst_controller_new* -> gst_object_control_properties
|
gst_controller_new* -> gst_object_set_control_source
|
||||||
gst_controller_add_properties -> gst_object_control_properties
|
gst_controller_add_properties -> gst_object_set_control_source
|
||||||
gst_controller_set_control_source -> gst_object_set_control_source
|
gst_controller_set_control_source -> gst_object_set_control_source
|
||||||
gst_controller_get_control_source -> gst_object_get_control_source
|
gst_controller_get_control_source -> gst_object_get_control_source
|
||||||
|
|
||||||
gst_controller_set_property_disabled -> gst_object_set_controlled_property_disabled
|
gst_controller_set_property_disabled -> gst_object_set_controlled_property_disabled
|
||||||
|
|
173
gst/gstobject.c
173
gst/gstobject.c
|
@ -1123,124 +1123,8 @@ gst_object_find_controlled_property (GstObject * self, const gchar * name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* gst_object_add_controlled_property:
|
|
||||||
* @self: the object
|
|
||||||
* @name: name of projecty in @object
|
|
||||||
*
|
|
||||||
* Creates a new #GstControlledProperty if there is none for property @name yet.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the property has been added to the controller
|
|
||||||
*/
|
|
||||||
static gboolean
|
|
||||||
gst_object_add_controlled_property (GstObject * self, const gchar * name)
|
|
||||||
{
|
|
||||||
gboolean res = TRUE;
|
|
||||||
|
|
||||||
/* test if this property isn't yet controlled */
|
|
||||||
if (!gst_object_find_controlled_property (self, name)) {
|
|
||||||
GstControlledProperty *prop;
|
|
||||||
|
|
||||||
/* create GstControlledProperty and add to self->properties list */
|
|
||||||
if ((prop = gst_controlled_property_new (self, name))) {
|
|
||||||
self->properties = g_list_prepend (self->properties, prop);
|
|
||||||
GST_DEBUG_OBJECT (self, "property %s added", name);
|
|
||||||
} else
|
|
||||||
res = FALSE;
|
|
||||||
} else {
|
|
||||||
GST_WARNING_OBJECT (self, "trying to control property %s again", name);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gst_object_remove_controlled_property:
|
|
||||||
* @self: the object
|
|
||||||
* @name: name of projecty in @object
|
|
||||||
*
|
|
||||||
* Removes a #GstControlledProperty for property @name.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the property has been removed from the controller
|
|
||||||
*/
|
|
||||||
static gboolean
|
|
||||||
gst_object_remove_controlled_property (GstObject * self, const gchar * name)
|
|
||||||
{
|
|
||||||
gboolean res = TRUE;
|
|
||||||
GstControlledProperty *prop;
|
|
||||||
|
|
||||||
if ((prop = gst_object_find_controlled_property (self, name))) {
|
|
||||||
self->properties = g_list_remove (self->properties, prop);
|
|
||||||
//g_signal_handler_disconnect (self->object, prop->notify_handler_id);
|
|
||||||
gst_controlled_property_free (prop);
|
|
||||||
GST_DEBUG_OBJECT (self, "property %s removed", name);
|
|
||||||
} else {
|
|
||||||
res = FALSE;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* controller functions */
|
/* controller functions */
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_control_properties:
|
|
||||||
* @object: the object of which some properties should be controlled
|
|
||||||
* @...: %NULL terminated list of property names that should be controlled
|
|
||||||
*
|
|
||||||
* Creates a GstController that allows you to dynamically control one, or more,
|
|
||||||
* GObject properties. If the given GstObject already has a GstController,
|
|
||||||
* it adds the given properties to the existing
|
|
||||||
* controller and returns that controller.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the properties have been made controllable.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_control_properties (GstObject * object, ...)
|
|
||||||
{
|
|
||||||
gboolean res = TRUE;
|
|
||||||
va_list var_args;
|
|
||||||
gchar *name;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
|
|
||||||
|
|
||||||
va_start (var_args, object);
|
|
||||||
GST_OBJECT_LOCK (object);
|
|
||||||
while ((name = va_arg (var_args, gchar *))) {
|
|
||||||
res &= gst_object_add_controlled_property (object, name);
|
|
||||||
}
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
|
||||||
va_end (var_args);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_uncontrol_properties:
|
|
||||||
* @object: the object of which some properties should not be controlled anymore
|
|
||||||
* @...: %NULL terminated list of property names that should be controlled
|
|
||||||
*
|
|
||||||
* Removes the given element's properties from it's controller
|
|
||||||
*
|
|
||||||
* Returns: %FALSE if one of the given property names isn't handled by the
|
|
||||||
* controller, %TRUE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_object_uncontrol_properties (GstObject * object, ...)
|
|
||||||
{
|
|
||||||
gboolean res = TRUE;
|
|
||||||
va_list var_args;
|
|
||||||
gchar *name;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
|
|
||||||
|
|
||||||
va_start (var_args, object);
|
|
||||||
GST_OBJECT_LOCK (object);
|
|
||||||
while ((name = va_arg (var_args, gchar *))) {
|
|
||||||
res &= gst_object_remove_controlled_property (object, name);
|
|
||||||
}
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
|
||||||
va_end (var_args);
|
|
||||||
return (res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_object_suggest_next_sync:
|
* gst_object_suggest_next_sync:
|
||||||
* @object: the object that has controlled properties
|
* @object: the object that has controlled properties
|
||||||
|
@ -1307,7 +1191,7 @@ gst_object_sync_values (GstObject * object, GstClockTime timestamp)
|
||||||
for (node = object->properties; node; node = g_list_next (node)) {
|
for (node = object->properties; node; node = g_list_next (node)) {
|
||||||
prop = node->data;
|
prop = node->data;
|
||||||
|
|
||||||
if (!prop->csource || prop->disabled)
|
if (prop->disabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp);
|
GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp);
|
||||||
|
@ -1443,18 +1327,31 @@ gst_object_set_control_source (GstObject * object, const gchar * property_name,
|
||||||
g_return_val_if_fail ((!csource || GST_IS_CONTROL_SOURCE (csource)), FALSE);
|
g_return_val_if_fail ((!csource || GST_IS_CONTROL_SOURCE (csource)), FALSE);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
GST_OBJECT_LOCK (object);
|
||||||
if ((prop = gst_object_find_controlled_property (object, property_name))) {
|
prop = gst_object_find_controlled_property (object, property_name);
|
||||||
|
if (!prop) {
|
||||||
|
if ((prop = gst_controlled_property_new (object, property_name))) {
|
||||||
|
object->properties = g_list_prepend (object->properties, prop);
|
||||||
|
GST_DEBUG_OBJECT (object, "controlled property %s added", property_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (prop) {
|
||||||
GstControlSource *old = prop->csource;
|
GstControlSource *old = prop->csource;
|
||||||
|
|
||||||
if (csource && (ret = gst_control_source_bind (csource, prop->pspec))) {
|
if (csource != old) {
|
||||||
prop->csource = g_object_ref (csource);
|
if (csource && (ret = gst_control_source_bind (csource, prop->pspec))) {
|
||||||
} else if (!csource) {
|
prop->csource = g_object_ref (csource);
|
||||||
ret = TRUE;
|
} else if (!csource) {
|
||||||
prop->csource = NULL;
|
ret = TRUE;
|
||||||
|
prop->csource = NULL;
|
||||||
|
object->properties = g_list_remove (object->properties, prop);
|
||||||
|
//g_signal_handler_disconnect (self->object, prop->notify_handler_id);
|
||||||
|
gst_controlled_property_free (prop);
|
||||||
|
GST_DEBUG_OBJECT (object, "controlled property %s removed",
|
||||||
|
property_name);
|
||||||
|
}
|
||||||
|
if (ret && old)
|
||||||
|
g_object_unref (old);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && old)
|
|
||||||
g_object_unref (old);
|
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
|
|
||||||
|
@ -1484,8 +1381,7 @@ gst_object_get_control_source (GstObject * object, const gchar * property_name)
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
GST_OBJECT_LOCK (object);
|
||||||
if ((prop = gst_object_find_controlled_property (object, property_name))) {
|
if ((prop = gst_object_find_controlled_property (object, property_name))) {
|
||||||
if ((ret = prop->csource))
|
ret = g_object_ref (prop->csource);
|
||||||
g_object_ref (ret);
|
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
|
|
||||||
|
@ -1518,17 +1414,11 @@ gst_object_get_value (GstObject * object, const gchar * property_name,
|
||||||
if ((prop = gst_object_find_controlled_property (object, property_name))) {
|
if ((prop = gst_object_find_controlled_property (object, property_name))) {
|
||||||
val = g_new0 (GValue, 1);
|
val = g_new0 (GValue, 1);
|
||||||
g_value_init (val, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
|
g_value_init (val, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
|
||||||
if (prop->csource) {
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
/* get current value via control source */
|
/* get current value via control source */
|
||||||
res = gst_control_source_get_value (prop->csource, timestamp, val);
|
if (!gst_control_source_get_value (prop->csource, timestamp, val)) {
|
||||||
if (!res) {
|
g_free (val);
|
||||||
g_free (val);
|
val = NULL;
|
||||||
val = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
g_object_get_property ((GObject *) object, prop->name, val);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
|
@ -1599,18 +1489,11 @@ gst_object_get_value_array (GstObject * object, GstClockTime timestamp,
|
||||||
g_return_val_if_fail (value_array->values, FALSE);
|
g_return_val_if_fail (value_array->values, FALSE);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
GST_OBJECT_LOCK (object);
|
||||||
|
|
||||||
if ((prop = gst_object_find_controlled_property (object,
|
if ((prop = gst_object_find_controlled_property (object,
|
||||||
value_array->property_name))) {
|
value_array->property_name))) {
|
||||||
/* get current value_array via control source */
|
|
||||||
if (!prop->csource)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
res = gst_control_source_get_value_array (prop->csource, timestamp,
|
res = gst_control_source_get_value_array (prop->csource, timestamp,
|
||||||
value_array);
|
value_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,9 +234,6 @@ gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
|
||||||
/* controller functions */
|
/* controller functions */
|
||||||
#include <gst/gstcontrolsource.h>
|
#include <gst/gstcontrolsource.h>
|
||||||
|
|
||||||
gboolean gst_object_control_properties (GstObject * object, ...) G_GNUC_NULL_TERMINATED;
|
|
||||||
gboolean gst_object_uncontrol_properties (GstObject * object, ...) G_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
GstClockTime gst_object_suggest_next_sync (GstObject * object);
|
GstClockTime gst_object_suggest_next_sync (GstObject * object);
|
||||||
gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
|
gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
|
||||||
|
|
||||||
|
|
|
@ -110,12 +110,6 @@ main (gint argc, gchar * argv[])
|
||||||
|
|
||||||
tick = BLOCK_SIZE * GST_SECOND / 44100;
|
tick = BLOCK_SIZE * GST_SECOND / 44100;
|
||||||
|
|
||||||
/* select parameters to control */
|
|
||||||
if (!gst_object_control_properties (GST_OBJECT (src), "freq", NULL)) {
|
|
||||||
GST_WARNING ("can't control source element");
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create and configure control source */
|
/* create and configure control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
gst_object_set_control_source (GST_OBJECT (src), "freq",
|
gst_object_set_control_source (GST_OBJECT (src), "freq",
|
||||||
|
|
|
@ -232,13 +232,18 @@ teardown (void)
|
||||||
GST_START_TEST (controller_new_fail1)
|
GST_START_TEST (controller_new_fail1)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("fakesrc", "test_source");
|
elem = gst_element_factory_make ("fakesrc", "test_source");
|
||||||
|
cs = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* that property should not exist */
|
/* that property should not exist */
|
||||||
res = gst_object_control_properties (GST_OBJECT (elem), "_schrompf_", NULL);
|
res = gst_object_set_control_source (GST_OBJECT (elem), "_schrompf_",
|
||||||
|
GST_CONTROL_SOURCE (cs));
|
||||||
fail_unless (res == FALSE, NULL);
|
fail_unless (res == FALSE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,15 +253,18 @@ GST_END_TEST;
|
||||||
GST_START_TEST (controller_new_fail2)
|
GST_START_TEST (controller_new_fail2)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
cs = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* that property should exist and but is readonly */
|
/* that property should exist and but is readonly */
|
||||||
ASSERT_CRITICAL (res =
|
ASSERT_CRITICAL (res = gst_object_set_control_source (GST_OBJECT (elem),
|
||||||
gst_object_control_properties (GST_OBJECT (elem), "readonly", NULL));
|
"readonly", GST_CONTROL_SOURCE (cs)));
|
||||||
fail_unless (res == FALSE, NULL);
|
fail_unless (res == FALSE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,15 +274,18 @@ GST_END_TEST;
|
||||||
GST_START_TEST (controller_new_fail3)
|
GST_START_TEST (controller_new_fail3)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
cs = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* that property should exist and but is not controlable */
|
/* that property should exist and but is not controlable */
|
||||||
ASSERT_CRITICAL (res = gst_object_control_properties (GST_OBJECT (elem),
|
ASSERT_CRITICAL (res = gst_object_set_control_source (GST_OBJECT (elem),
|
||||||
"static", NULL));
|
"static", GST_CONTROL_SOURCE (cs)));
|
||||||
fail_unless (res == FALSE, NULL);
|
fail_unless (res == FALSE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,16 +295,19 @@ GST_END_TEST;
|
||||||
GST_START_TEST (controller_new_fail4)
|
GST_START_TEST (controller_new_fail4)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
cs = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* that property should exist and but is construct-only */
|
/* that property should exist and but is construct-only */
|
||||||
ASSERT_CRITICAL (res =
|
ASSERT_CRITICAL (res =
|
||||||
gst_object_control_properties (GST_OBJECT (elem), "construct-only",
|
gst_object_set_control_source (GST_OBJECT (elem), "construct-only",
|
||||||
NULL));
|
GST_CONTROL_SOURCE (cs)));
|
||||||
fail_unless (res == FALSE, NULL);
|
fail_unless (res == FALSE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,14 +318,18 @@ GST_END_TEST;
|
||||||
GST_START_TEST (controller_new_okay1)
|
GST_START_TEST (controller_new_okay1)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
cs = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
/* that property should exist and should be controllable */
|
||||||
res = gst_object_control_properties (GST_OBJECT (elem), "ulong", NULL);
|
res = gst_object_set_control_source (GST_OBJECT (elem), "ulong",
|
||||||
|
GST_CONTROL_SOURCE (cs));
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,44 +339,58 @@ GST_END_TEST;
|
||||||
GST_START_TEST (controller_new_okay2)
|
GST_START_TEST (controller_new_okay2)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs1, *cs2;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
cs1 = gst_interpolation_control_source_new ();
|
||||||
|
cs2 = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* these properties should exist and should be controllable */
|
/* these properties should exist and should be controllable */
|
||||||
res = gst_object_control_properties (GST_OBJECT (elem), "ulong", "double",
|
res = gst_object_set_control_source (GST_OBJECT (elem), "ulong",
|
||||||
"float", NULL);
|
GST_CONTROL_SOURCE (cs1));
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
|
|
||||||
res = gst_object_control_properties (GST_OBJECT (elem), "boolean", NULL);
|
res = gst_object_set_control_source (GST_OBJECT (elem), "boolean",
|
||||||
|
GST_CONTROL_SOURCE (cs2));
|
||||||
fail_unless (res == TRUE, NULL);
|
fail_unless (res == TRUE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs1);
|
||||||
|
g_object_unref (cs2);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
/* controlling a params twice should be handled */
|
/* controlling a param twice should be handled */
|
||||||
GST_START_TEST (controller_param_twice)
|
GST_START_TEST (controller_param_twice)
|
||||||
{
|
{
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
|
GstInterpolationControlSource *cs;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
cs = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
/* that property should exist and should be controllable */
|
||||||
res =
|
res = gst_object_set_control_source (GST_OBJECT (elem), "ulong",
|
||||||
gst_object_control_properties (GST_OBJECT (elem), "ulong", "ulong", NULL);
|
GST_CONTROL_SOURCE (cs));
|
||||||
fail_unless (res, NULL);
|
fail_unless (res, NULL);
|
||||||
|
|
||||||
|
/* setting it again should not work */
|
||||||
|
res = gst_object_set_control_source (GST_OBJECT (elem), "ulong",
|
||||||
|
GST_CONTROL_SOURCE (cs));
|
||||||
|
fail_unless (!res, NULL);
|
||||||
|
|
||||||
/* it should have been added at least once, let remove it */
|
/* it should have been added at least once, let remove it */
|
||||||
res = gst_object_uncontrol_properties (GST_OBJECT (elem), "ulong", NULL);
|
res = gst_object_set_control_source (GST_OBJECT (elem), "ulong", NULL);
|
||||||
fail_unless (res, NULL);
|
fail_unless (res, NULL);
|
||||||
|
|
||||||
/* removing it again should not work */
|
/* removing it again should not work */
|
||||||
res = gst_object_uncontrol_properties (GST_OBJECT (elem), "ulong", NULL);
|
res = gst_object_set_control_source (GST_OBJECT (elem), "ulong", NULL);
|
||||||
fail_unless (!res, NULL);
|
fail_unless (!res, NULL);
|
||||||
|
|
||||||
|
g_object_unref (cs);
|
||||||
gst_object_unref (elem);
|
gst_object_unref (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,10 +404,6 @@ GST_START_TEST (controller_controlsource_refcounts)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
csource = (GstControlSource *) gst_interpolation_control_source_new ();
|
csource = (GstControlSource *) gst_interpolation_control_source_new ();
|
||||||
fail_unless (csource != NULL, NULL);
|
fail_unless (csource != NULL, NULL);
|
||||||
|
|
||||||
|
@ -404,10 +432,6 @@ GST_START_TEST (controller_controlsource_empty1)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
csource = (GstControlSource *) gst_interpolation_control_source_new ();
|
csource = (GstControlSource *) gst_interpolation_control_source_new ();
|
||||||
fail_unless (csource != NULL, NULL);
|
fail_unless (csource != NULL, NULL);
|
||||||
|
|
||||||
|
@ -433,10 +457,6 @@ GST_START_TEST (controller_controlsource_empty2)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
fail_unless (csource != NULL, NULL);
|
fail_unless (csource != NULL, NULL);
|
||||||
|
|
||||||
|
@ -471,10 +491,6 @@ GST_START_TEST (controller_interpolate_none)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -528,10 +544,6 @@ GST_START_TEST (controller_interpolate_trigger)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -590,10 +602,6 @@ GST_START_TEST (controller_interpolate_linear)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -643,10 +651,6 @@ GST_START_TEST (controller_interpolate_cubic)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "double",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -713,10 +717,6 @@ GST_START_TEST (controller_interpolate_cubic_too_few_cp)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "double",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -767,10 +767,6 @@ GST_START_TEST (controller_interpolate_unimplemented)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -799,10 +795,6 @@ GST_START_TEST (controller_interpolation_unset)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -875,10 +867,6 @@ GST_START_TEST (controller_interpolation_unset_all)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -934,10 +922,6 @@ GST_START_TEST (controller_interpolation_linear_value_array)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -992,10 +976,6 @@ GST_START_TEST (controller_interpolation_linear_invalid_values)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "float",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -1057,10 +1037,6 @@ GST_START_TEST (controller_interpolation_linear_default_values)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -1150,10 +1126,6 @@ GST_START_TEST (controller_interpolate_linear_disabled)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
"double", NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
csource2 = gst_interpolation_control_source_new ();
|
csource2 = gst_interpolation_control_source_new ();
|
||||||
|
@ -1301,10 +1273,6 @@ GST_START_TEST (controller_interpolation_set_from_list)
|
||||||
/* test that an invalid timestamp throws a warning of some sort */
|
/* test that an invalid timestamp throws a warning of some sort */
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -1346,16 +1314,11 @@ GST_START_TEST (controller_lfo_sine)
|
||||||
{
|
{
|
||||||
GstLFOControlSource *csource;
|
GstLFOControlSource *csource;
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
GValue amp = { 0, }
|
GValue amp = { 0, };
|
||||||
, off = {
|
GValue off = { 0, };
|
||||||
0,};
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1412,16 +1375,11 @@ GST_START_TEST (controller_lfo_sine_timeshift)
|
||||||
{
|
{
|
||||||
GstLFOControlSource *csource;
|
GstLFOControlSource *csource;
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
GValue amp = { 0, }
|
GValue amp = { 0, };
|
||||||
, off = {
|
GValue off = { 0, };
|
||||||
0,};
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1478,16 +1436,11 @@ GST_START_TEST (controller_lfo_square)
|
||||||
{
|
{
|
||||||
GstLFOControlSource *csource;
|
GstLFOControlSource *csource;
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
GValue amp = { 0, }
|
GValue amp = { 0, };
|
||||||
, off = {
|
GValue off = { 0, };
|
||||||
0,};
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1544,16 +1497,11 @@ GST_START_TEST (controller_lfo_saw)
|
||||||
{
|
{
|
||||||
GstLFOControlSource *csource;
|
GstLFOControlSource *csource;
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
GValue amp = { 0, }
|
GValue amp = { 0, };
|
||||||
, off = {
|
GValue off = { 0, };
|
||||||
0,};
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1610,16 +1558,11 @@ GST_START_TEST (controller_lfo_rsaw)
|
||||||
{
|
{
|
||||||
GstLFOControlSource *csource;
|
GstLFOControlSource *csource;
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
GValue amp = { 0, }
|
GValue amp = { 0, };
|
||||||
, off = {
|
GValue off = { 0, };
|
||||||
0,};
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1676,16 +1619,11 @@ GST_START_TEST (controller_lfo_triangle)
|
||||||
{
|
{
|
||||||
GstLFOControlSource *csource;
|
GstLFOControlSource *csource;
|
||||||
GstElement *elem;
|
GstElement *elem;
|
||||||
GValue amp = { 0, }
|
GValue amp = { 0, };
|
||||||
, off = {
|
GValue off = { 0, };
|
||||||
0,};
|
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1745,10 +1683,6 @@ GST_START_TEST (controller_lfo_none)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_lfo_control_source_new ();
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
@ -1817,10 +1751,6 @@ GST_START_TEST (controller_interpolate_linear_before_ts0)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
@ -1876,10 +1806,6 @@ GST_START_TEST (controller_interpolation_cp_count)
|
||||||
|
|
||||||
elem = gst_element_factory_make ("testmonosource", "test_source");
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
/* that property should exist and should be controllable */
|
|
||||||
fail_unless (gst_object_control_properties (GST_OBJECT (elem), "ulong",
|
|
||||||
NULL));
|
|
||||||
|
|
||||||
/* Get interpolation control source */
|
/* Get interpolation control source */
|
||||||
csource = gst_interpolation_control_source_new ();
|
csource = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,6 @@ main (gint argc, gchar ** argv)
|
||||||
g_object_set (G_OBJECT(src), "wave", 1, NULL);
|
g_object_set (G_OBJECT(src), "wave", 1, NULL);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* add a controller to the source */
|
|
||||||
if (!gst_object_control_properties (GST_OBJECT (src), "freq", "volume", NULL)) {
|
|
||||||
GST_WARNING ("can't control source element");
|
|
||||||
goto Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
csource1 = gst_interpolation_control_source_new ();
|
csource1 = gst_interpolation_control_source_new ();
|
||||||
csource2 = gst_interpolation_control_source_new ();
|
csource2 = gst_interpolation_control_source_new ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue