controlbinding: error handling for binding controlsources to wrong properties

Add warning if property is not suitable for controlling. When adding a control-
binding check that pspec!=NULL.
This commit is contained in:
Stefan Sauer 2013-02-08 21:21:48 +01:00
parent 474610b191
commit 56f6f022e2
3 changed files with 12 additions and 6 deletions

View file

@ -135,6 +135,11 @@ gst_control_binding_constructor (GType type, guint n_construct_params,
G_PARAM_CONSTRUCT_ONLY)) ==
(G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE)) {
binding->pspec = pspec;
} else {
GST_WARNING_OBJECT (binding->object,
"property '%s' on class '%s' needs to "
"be writeable, controlable and not construct_only", binding->name,
G_OBJECT_TYPE_NAME (binding->object));
}
} else {
GST_WARNING_OBJECT (binding->object, "class '%s' has no property '%s'",

View file

@ -1162,12 +1162,13 @@ gst_object_set_control_binding_disabled (GstObject * object,
* @object: the controller object
* @binding: (transfer full): the #GstControlBinding that should be used
*
* Sets the #GstControlBinding. If there already was a #GstControlBinding
* for this property it will be replaced.
* Attach the #GstControlBinding to the object. If there already was a
* #GstControlBinding for this property it will be replaced.
*
* The @object will take ownership of the @binding.
*
* Returns: %FALSE if the given @binding has not been setup for this object or
* %TRUE otherwise.
* Returns: %FALSE if the given @binding has not been setup for this object or
* has been setup for a non suitable property, %TRUE otherwise.
*/
gboolean
gst_object_add_control_binding (GstObject * object, GstControlBinding * binding)
@ -1176,6 +1177,7 @@ gst_object_add_control_binding (GstObject * object, GstControlBinding * binding)
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
g_return_val_if_fail (binding->pspec, FALSE);
GST_OBJECT_LOCK (object);
if ((old = gst_object_find_control_binding (object, binding->name))) {

View file

@ -24,10 +24,9 @@
* @short_description: direct attachment for control sources
*
* A value mapping object that attaches control sources to gobject properties. It
* will map the control values [0.0 ... 1.0] to the target property range.
* will map the control values [0.0 ... 1.0] to the target property range.
*/
#include <glib-object.h>
#include <gst/gst.h>