gst_object_has_active_control_bindings
gst_object_set_control_bindings_disabled
gst_object_set_control_binding_disabled
-gst_object_set_control_binding
+gst_object_add_control_binding
gst_object_get_control_binding
+gst_object_remove_control_binding
gst_object_get_value
gst_object_get_value_array
gst_object_get_control_rate
* </para></listitem>
* <listitem><para>
* Attach the #GstControlSource on the controller to a property.
- * gst_object_set_control_binding (object, gst_control_binding_new (objetct, "prop1", csource));
+ * gst_object_add_control_binding (object, gst_control_binding_new (objetct, "prop1", csource));
* </para></listitem>
* <listitem><para>
* Set the control values
/**
- * gst_object_set_control_binding:
+ * gst_object_add_control_binding:
* @object: the controller object
- * @binding: the #GstControlBinding that should be used for the property
+ * @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. Use %NULL for @binding to unset it.
+ * for this property it will be replaced.
+ * The @object will take ownership of the @binding.
*
- * Returns: %FALSE if the given property isn't handled by the controller or
- * %TRUE if everything worked as expected.
+ * Returns: %FALSE if the given @binding has not been setup for this object or
+ * %TRUE otherwise.
*/
gboolean
-gst_object_set_control_binding (GstObject * object, GstControlBinding * binding)
+gst_object_add_control_binding (GstObject * object, GstControlBinding * binding)
{
GstControlBinding *old;
- gboolean ret = FALSE;
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
- g_return_val_if_fail ((!binding || GST_IS_CONTROL_BINDING (binding)), FALSE);
+ g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
+ g_return_val_if_fail (g_type_is_a (binding->pspec->owner_type,
+ G_OBJECT_TYPE (object)), FALSE);
GST_OBJECT_LOCK (object);
if ((old = gst_object_find_control_binding (object, binding->name))) {
+ GST_DEBUG_OBJECT (object, "controlled property %s removed", old->name);
object->control_bindings = g_list_remove (object->control_bindings, old);
- g_object_unref (old);
- GST_DEBUG_OBJECT (object, "controlled property %s removed", binding->name);
- ret = TRUE;
- }
- if (binding) {
- object->control_bindings =
- g_list_prepend (object->control_bindings, g_object_ref (binding));
- GST_DEBUG_OBJECT (object, "controlled property %s added", binding->name);
- ret = TRUE;
+ gst_object_unparent (GST_OBJECT_CAST (old));
}
+ object->control_bindings = g_list_prepend (object->control_bindings, binding);
+ gst_object_set_parent (GST_OBJECT_CAST (binding), object);
+ GST_DEBUG_OBJECT (object, "controlled property %s added", binding->name);
GST_OBJECT_UNLOCK (object);
- return ret;
+ return TRUE;
}
/**
}
/**
+ * gst_object_remove_control_binding:
+ * @object: the object
+ * @binding: the binding
+ *
+ * Removes the corresponding #GstControlBinding. If it was the
+ * last ref of the binding, it will be disposed.
+ *
+ * Returns: %TRUE if the binding could be removed.
+ */
+gboolean
+gst_object_remove_control_binding (GstObject * object,
+ GstControlBinding * binding)
+{
+ GList *node;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
+ g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
+
+ GST_OBJECT_LOCK (object);
+ if ((node = g_list_find (object->control_bindings, binding))) {
+ GST_DEBUG_OBJECT (object, "controlled property %s removed", binding->name);
+ object->control_bindings =
+ g_list_delete_link (object->control_bindings, node);
+ gst_object_unparent (GST_OBJECT_CAST (binding));
+ ret = TRUE;
+ }
+ GST_OBJECT_UNLOCK (object);
+
+ return ret;
+}
+
+/**
* gst_object_get_value:
* @object: the object that has controlled properties
* @property_name: the name of the property to get
#include <gst/gstcontrolbinding.h>
#include <gst/gstcontrolsource.h>
-GstClockTime gst_object_suggest_next_sync (GstObject * object);
-gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
+GstClockTime gst_object_suggest_next_sync (GstObject * object);
+gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
gboolean gst_object_has_active_control_bindings (GstObject *object);
void gst_object_set_control_bindings_disabled (GstObject *object, gboolean disabled);
-void gst_object_set_control_binding_disabled (GstObject *object,
- const gchar * property_name,
- gboolean disabled);
+void gst_object_set_control_binding_disabled (GstObject *object,
+ const gchar * property_name,
+ gboolean disabled);
-gboolean gst_object_set_control_binding (GstObject * object, GstControlBinding * binding);
+gboolean gst_object_add_control_binding (GstObject * object, GstControlBinding * binding);
GstControlBinding *
- gst_object_get_control_binding (GstObject *object, const gchar * property_name);
+ gst_object_get_control_binding (GstObject *object, const gchar * property_name);
+gboolean gst_object_remove_control_binding (GstObject * object, GstControlBinding * binding);
-GValue * gst_object_get_value (GstObject * object, const gchar * property_name,
- GstClockTime timestamp);
-gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name,
- GstClockTime timestamp, GstClockTime interval,
- guint n_values, GValue *values);
+GValue * gst_object_get_value (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp);
+gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp, GstClockTime interval,
+ guint n_values, GValue *values);
-GstClockTime gst_object_get_control_rate (GstObject * object);
-void gst_object_set_control_rate (GstObject * object, GstClockTime control_rate);
+GstClockTime gst_object_get_control_rate (GstObject * object);
+void gst_object_set_control_rate (GstObject * object, GstClockTime control_rate);
G_END_DECLS
/* create and configure control source */
csource = gst_interpolation_control_source_new ();
- gst_object_set_control_binding (GST_OBJECT (src),
+ gst_object_add_control_binding (GST_OBJECT (src),
gst_control_binding_new (GST_OBJECT (src), "freq",
GST_CONTROL_SOURCE (csource)));
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cb = gst_control_binding_new (GST_OBJECT (elem), "int",
GST_CONTROL_SOURCE (cs));
fail_unless (cb != NULL, NULL);
+ cb = gst_object_ref (cb);
- res = gst_object_set_control_binding (GST_OBJECT (elem), cb);
+ res = gst_object_add_control_binding (GST_OBJECT (elem), cb);
fail_unless (res, NULL);
/* setting it again will just unset the old and set it again
* this might cause some trouble with binding the control source again
*/
- res = gst_object_set_control_binding (GST_OBJECT (elem), cb);
+ res = gst_object_add_control_binding (GST_OBJECT (elem), cb);
fail_unless (res, NULL);
-#if 0 /* FIXME(ensonic): need new API */
- /* it should have been added at least once, let remove it */
- res = gst_object_remove_control_binding (GST_OBJECT (elem), "int");
+ /* it should have been added now, let remove it */
+ res = gst_object_remove_control_binding (GST_OBJECT (elem), cb);
fail_unless (res, NULL);
/* removing it again should not work */
- res = gst_object_remove_control_binding (GST_OBJECT (elem), "int");
+ res = gst_object_remove_control_binding (GST_OBJECT (elem), cb);
fail_unless (!res, NULL);
-#endif
+ gst_object_unref (cb);
gst_object_unref (cs);
gst_object_unref (elem);
}
cb = gst_control_binding_new (GST_OBJECT (elem), "int", cs);
fail_unless (cb != NULL, NULL);
fail_unless_equals_int (G_OBJECT (cs)->ref_count, 2);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem), cb));
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem), cb));
test_cb = gst_object_get_control_binding (GST_OBJECT (elem), "int");
fail_unless (test_cb != NULL, NULL);
gst_object_unref (test_cs);
gst_object_unref (test_cb);
gst_object_unref (cs);
- gst_object_unref (cb);
gst_object_unref (elem);
}
csource = gst_test_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int",
(GstControlSource *) csource)));
csource = gst_test_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int",
(GstControlSource *) csource)));
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "double",
(GstControlSource *) csource)));
csource = (GstControlSource *) gst_interpolation_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int",
(GstControlSource *) csource)));
csource = gst_interpolation_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int",
(GstControlSource *) csource)));
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "double", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "double", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "float", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs2 = (GstControlSource *) csource2;
fail_unless (csource1 != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs1)));
fail_unless (csource2 != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "double", cs2)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "enum", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* now pull in values for some timestamps */
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
fail_if (gst_control_source_get_value (cs, 0 * GST_SECOND, &raw_val));
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
g_object_set (csource, "tolerance", G_GINT64_CONSTANT (10), NULL);
csource1 = gst_interpolation_control_source_new ();
csource2 = gst_interpolation_control_source_new ();
- gst_object_set_control_binding (GST_OBJECT_CAST (src),
+ gst_object_add_control_binding (GST_OBJECT_CAST (src),
gst_control_binding_new (GST_OBJECT_CAST (src), "volume",
GST_CONTROL_SOURCE (csource1)));
- gst_object_set_control_binding (GST_OBJECT_CAST (src),
+ gst_object_add_control_binding (GST_OBJECT_CAST (src),
gst_control_binding_new (GST_OBJECT_CAST (src), "freq",
GST_CONTROL_SOURCE (csource2)));
tvcs = (GstTimedValueControlSource *) ics;
cs = (GstControlSource *) ics;
- gst_object_set_control_binding (e, gst_control_binding_new (e, "int", cs));
+ gst_object_add_control_binding (e, gst_control_binding_new (e, "int", cs));
gst_timed_value_control_source_set (tvcs, 0 * GST_SECOND, 0.0);
gst_timed_value_control_source_set (tvcs, 10 * GST_SECOND, 1.0);
lfocs = gst_lfo_control_source_new ();
cs = (GstControlSource *) lfocs;
- gst_object_set_control_binding (e, gst_control_binding_new (e, "int", cs));
+ gst_object_add_control_binding (e, gst_control_binding_new (e, "int", cs));
g_object_set (lfocs,
"frequency", (gdouble) 0.05,
lfocs1 = gst_lfo_control_source_new ();
cs1 = (GstControlSource *) lfocs1;
- gst_object_set_control_binding (e, gst_control_binding_new (e, "int", cs1));
+ gst_object_add_control_binding (e, gst_control_binding_new (e, "int", cs1));
g_object_set (lfocs1,
"waveform", GST_LFO_WAVEFORM_SINE,
lfocs2 = gst_lfo_control_source_new ();
cs2 = (GstControlSource *) lfocs2;
- gst_object_set_control_binding ((GstObject *) lfocs1,
+ gst_object_add_control_binding ((GstObject *) lfocs1,
gst_control_binding_new ((GstObject *) lfocs1, "amplitude", cs2));
g_object_set (lfocs2,
gst_mini_object_unref
gst_mini_object_weak_ref
gst_mini_object_weak_unref
+ gst_object_add_control_binding
gst_object_check_uniqueness
gst_object_default_deep_notify
gst_object_default_error
gst_object_has_ancestor
gst_object_ref
gst_object_ref_sink
+ gst_object_remove_control_binding
gst_object_replace
- gst_object_set_control_binding
gst_object_set_control_binding_disabled
gst_object_set_control_bindings_disabled
gst_object_set_control_rate