mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
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:
parent
474610b191
commit
56f6f022e2
3 changed files with 12 additions and 6 deletions
|
@ -135,6 +135,11 @@ gst_control_binding_constructor (GType type, guint n_construct_params,
|
||||||
G_PARAM_CONSTRUCT_ONLY)) ==
|
G_PARAM_CONSTRUCT_ONLY)) ==
|
||||||
(G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE)) {
|
(G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE)) {
|
||||||
binding->pspec = pspec;
|
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 {
|
} else {
|
||||||
GST_WARNING_OBJECT (binding->object, "class '%s' has no property '%s'",
|
GST_WARNING_OBJECT (binding->object, "class '%s' has no property '%s'",
|
||||||
|
|
|
@ -1162,12 +1162,13 @@ gst_object_set_control_binding_disabled (GstObject * object,
|
||||||
* @object: the controller object
|
* @object: the controller object
|
||||||
* @binding: (transfer full): the #GstControlBinding that should be used
|
* @binding: (transfer full): the #GstControlBinding that should be used
|
||||||
*
|
*
|
||||||
* Sets the #GstControlBinding. If there already was a #GstControlBinding
|
* Attach the #GstControlBinding to the object. If there already was a
|
||||||
* for this property it will be replaced.
|
* #GstControlBinding for this property it will be replaced.
|
||||||
|
*
|
||||||
* The @object will take ownership of the @binding.
|
* The @object will take ownership of the @binding.
|
||||||
*
|
*
|
||||||
* Returns: %FALSE if the given @binding has not been setup for this object or
|
* Returns: %FALSE if the given @binding has not been setup for this object or
|
||||||
* %TRUE otherwise.
|
* has been setup for a non suitable property, %TRUE otherwise.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_object_add_control_binding (GstObject * object, GstControlBinding * binding)
|
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_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
|
g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
|
||||||
|
g_return_val_if_fail (binding->pspec, FALSE);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
GST_OBJECT_LOCK (object);
|
||||||
if ((old = gst_object_find_control_binding (object, binding->name))) {
|
if ((old = gst_object_find_control_binding (object, binding->name))) {
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
* 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 <glib-object.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue