This is needed to support multiple kinds of control-bindings.
gst_object_set_control_binding_disabled
gst_object_set_control_binding
gst_object_get_control_binding
-gst_object_get_control_source
-gst_object_set_control_source
gst_object_get_value
gst_object_get_value_array
gst_object_get_control_rate
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gstcontrolbinding", 0, \
"dynamic parameter control source attachment");
-G_DEFINE_TYPE_WITH_CODE (GstControlBinding, gst_control_binding, G_TYPE_OBJECT,
- _do_init);
+G_DEFINE_TYPE_WITH_CODE (GstControlBinding, gst_control_binding,
+ GST_TYPE_OBJECT, _do_init);
static void
gst_control_binding_class_init (GstControlBindingClass * klass)
return res;
}
-
-
/**
* gst_control_binding_get_control_source:
* @self: the control binding
* The instance structure of #GstControlBinding.
*/
struct _GstControlBinding {
- GObject parent;
+ GstObject parent;
/*< public >*/
const gchar *name; /* name of the property */
struct _GstControlBindingClass
{
- GObjectClass parent_class;
+ GstObjectClass parent_class;
+
+ /* need vfuncs for:
+ _sync_values
+ _get_value
+ _get_value_array
+ */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
* </para></listitem>
* <listitem><para>
* Attach the #GstControlSource on the controller to a property.
- * gst_object_set_control_source (object, "prop1", csource);
+ * gst_object_set_control_binding (object, gst_control_binding_new (objetct, "prop1", csource));
* </para></listitem>
* <listitem><para>
* Set the control values
}
/**
- * gst_object_set_control_source:
- * @object: the controller object
- * @property_name: name of the property for which the #GstControlSource should be set
- * @csource: the #GstControlSource that should be used for the property
- *
- * Sets the #GstControlSource for @property_name. If there already was a #GstControlSource
- * for this property it will be unreferenced.
- *
- * This is a convenience function for gst_object_set_control_binding().
- *
- * Returns: %FALSE if the given property isn't handled by the controller or the new #GstControlSource
- * couldn't be bound to the property, %TRUE if everything worked as expected.
- */
-gboolean
-gst_object_set_control_source (GstObject * object, const gchar * property_name,
- GstControlSource * csource)
-{
- GstControlBinding *binding;
- gboolean ret = FALSE;
-
- g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
- g_return_val_if_fail (property_name, FALSE);
- g_return_val_if_fail ((!csource || GST_IS_CONTROL_SOURCE (csource)), FALSE);
-
- GST_OBJECT_LOCK (object);
- if ((binding = gst_object_find_control_binding (object, property_name))) {
- object->control_bindings =
- g_list_remove (object->control_bindings, binding);
- g_object_unref (binding);
- GST_DEBUG_OBJECT (object, "controlled property %s removed", property_name);
- ret = TRUE;
- }
- if (csource) {
- if ((binding = gst_control_binding_new (object, property_name, csource))) {
- object->control_bindings =
- g_list_prepend (object->control_bindings, binding);
- GST_DEBUG_OBJECT (object, "controlled property %s added", property_name);
- ret = TRUE;
- } else {
- ret = FALSE;
- }
- }
- GST_OBJECT_UNLOCK (object);
-
- return ret;
-}
-
-/**
- * gst_object_get_control_source:
- * @object: the object
- * @property_name: name of the property
- *
- * Gets the corresponding #GstControlSource for the property. This should be
- * unreferenced again after use.
- *
- * This is a convenience function for gst_object_get_control_binding().
- *
- * Returns: (transfer full): the #GstControlSource for @property_name or %NULL if
- * the property is not controlled.
- */
-GstControlSource *
-gst_object_get_control_source (GstObject * object, const gchar * property_name)
-{
- GstControlBinding *binding;
- GstControlSource *ret = NULL;
-
- g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
- g_return_val_if_fail (property_name, NULL);
-
- GST_OBJECT_LOCK (object);
- if ((binding = gst_object_find_control_binding (object, property_name))) {
- ret = gst_control_binding_get_control_source (binding);
- }
- 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
GstControlBinding *
gst_object_get_control_binding (GstObject *object, const gchar * property_name);
-gboolean gst_object_set_control_source (GstObject *object, const gchar * property_name,
- GstControlSource *csource);
-GstControlSource *
- gst_object_get_control_source (GstObject *object, const gchar * property_name);
-
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,
/* create and configure control source */
csource = gst_interpolation_control_source_new ();
- gst_object_set_control_source (GST_OBJECT (src), "freq",
- GST_CONTROL_SOURCE (csource));
+ gst_object_set_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);
{
GstElement *elem;
GstTestControlSource *cs;
- gboolean res;
+ GstControlBinding *cb;
elem = gst_element_factory_make ("fakesrc", NULL);
cs = gst_test_control_source_new ();
/* that property should not exist */
- res = gst_object_set_control_source (GST_OBJECT (elem), "_schrompf_",
+ cb = gst_control_binding_new (GST_OBJECT (elem), "_schrompf_",
GST_CONTROL_SOURCE (cs));
- fail_unless (res == FALSE, NULL);
+ fail_unless (cb == NULL, NULL);
gst_object_unref (cs);
gst_object_unref (elem);
{
GstElement *elem;
GstTestControlSource *cs;
- gboolean res;
+ GstControlBinding *cb;
elem = gst_element_factory_make ("testobj", NULL);
cs = gst_test_control_source_new ();
/* that property should exist and but is readonly */
- ASSERT_CRITICAL (res = gst_object_set_control_source (GST_OBJECT (elem),
+ ASSERT_CRITICAL (cb = gst_control_binding_new (GST_OBJECT (elem),
"readonly", GST_CONTROL_SOURCE (cs)));
- fail_unless (res == FALSE, NULL);
+ fail_unless (cb == NULL, NULL);
gst_object_unref (cs);
gst_object_unref (elem);
{
GstElement *elem;
GstTestControlSource *cs;
- gboolean res;
+ GstControlBinding *cb;
elem = gst_element_factory_make ("testobj", NULL);
cs = gst_test_control_source_new ();
/* that property should exist and but is not controlable */
- ASSERT_CRITICAL (res = gst_object_set_control_source (GST_OBJECT (elem),
+ ASSERT_CRITICAL (cb = gst_control_binding_new (GST_OBJECT (elem),
"static", GST_CONTROL_SOURCE (cs)));
- fail_unless (res == FALSE, NULL);
+ fail_unless (cb == NULL, NULL);
gst_object_unref (cs);
gst_object_unref (elem);
{
GstElement *elem;
GstTestControlSource *cs;
- gboolean res;
+ GstControlBinding *cb;
elem = gst_element_factory_make ("testobj", NULL);
cs = gst_test_control_source_new ();
/* that property should exist and but is construct-only */
- ASSERT_CRITICAL (res =
- gst_object_set_control_source (GST_OBJECT (elem), "construct-only",
+ ASSERT_CRITICAL (cb =
+ gst_control_binding_new (GST_OBJECT (elem), "construct-only",
GST_CONTROL_SOURCE (cs)));
- fail_unless (res == FALSE, NULL);
+ fail_unless (cb == NULL, NULL);
gst_object_unref (cs);
gst_object_unref (elem);
{
GstElement *elem;
GstTestControlSource *cs;
- gboolean res;
+ GstControlBinding *cb;
elem = gst_element_factory_make ("testobj", NULL);
cs = gst_test_control_source_new ();
/* that property should exist and should be controllable */
- res = gst_object_set_control_source (GST_OBJECT (elem), "int",
+ cb = gst_control_binding_new (GST_OBJECT (elem), "int",
GST_CONTROL_SOURCE (cs));
- fail_unless (res == TRUE, NULL);
+ fail_unless (cb != NULL, NULL);
+ gst_object_unref (cb);
gst_object_unref (cs);
gst_object_unref (elem);
}
{
GstElement *elem;
GstTestControlSource *cs1, *cs2;
- gboolean res;
+ GstControlBinding *cb1, *cb2;
elem = gst_element_factory_make ("testobj", NULL);
cs1 = gst_test_control_source_new ();
cs2 = gst_test_control_source_new ();
/* these properties should exist and should be controllable */
- res = gst_object_set_control_source (GST_OBJECT (elem), "int",
+ cb1 = gst_control_binding_new (GST_OBJECT (elem), "int",
GST_CONTROL_SOURCE (cs1));
- fail_unless (res == TRUE, NULL);
+ fail_unless (cb1 != NULL, NULL);
- res = gst_object_set_control_source (GST_OBJECT (elem), "boolean",
+ cb2 = gst_control_binding_new (GST_OBJECT (elem), "boolean",
GST_CONTROL_SOURCE (cs2));
- fail_unless (res == TRUE, NULL);
+ fail_unless (cb2 != NULL, NULL);
+ gst_object_unref (cb1);
+ gst_object_unref (cb2);
gst_object_unref (cs1);
gst_object_unref (cs2);
gst_object_unref (elem);
{
GstElement *elem;
GstTestControlSource *cs;
+ GstControlBinding *cb;
gboolean res;
elem = gst_element_factory_make ("testobj", NULL);
cs = gst_test_control_source_new ();
/* that property should exist and should be controllable */
- res = gst_object_set_control_source (GST_OBJECT (elem), "int",
+ cb = gst_control_binding_new (GST_OBJECT (elem), "int",
GST_CONTROL_SOURCE (cs));
+ fail_unless (cb != NULL, NULL);
+
+ res = gst_object_set_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_source (GST_OBJECT (elem), "int",
- GST_CONTROL_SOURCE (cs));
+ res = gst_object_set_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_set_control_source (GST_OBJECT (elem), "int", NULL);
+ res = gst_object_remove_control_binding (GST_OBJECT (elem), "int");
fail_unless (res, NULL);
/* removing it again should not work */
- res = gst_object_set_control_source (GST_OBJECT (elem), "int", NULL);
+ res = gst_object_remove_control_binding (GST_OBJECT (elem), "int");
fail_unless (!res, NULL);
+#endif
gst_object_unref (cs);
gst_object_unref (elem);
GST_START_TEST (controller_controlsource_refcounts)
{
GstElement *elem;
- GstControlSource *csource, *test_csource;
+ GstControlBinding *cb, *test_cb;
+ GstControlSource *cs, *test_cs;
elem = gst_element_factory_make ("testobj", NULL);
- csource = (GstControlSource *) gst_test_control_source_new ();
- fail_unless (csource != NULL, NULL);
+ cs = (GstControlSource *) gst_test_control_source_new ();
+ fail_unless (cs != NULL, NULL);
- fail_unless_equals_int (G_OBJECT (csource)->ref_count, 1);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int",
- csource));
- fail_unless_equals_int (G_OBJECT (csource)->ref_count, 2);
+ fail_unless_equals_int (G_OBJECT (cs)->ref_count, 1);
- test_csource = gst_object_get_control_source (GST_OBJECT (elem), "int");
- fail_unless (test_csource != NULL, NULL);
- fail_unless (test_csource == csource);
- fail_unless_equals_int (G_OBJECT (csource)->ref_count, 3);
- gst_object_unref (test_csource);
- gst_object_unref (csource);
+ 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));
+
+ test_cb = gst_object_get_control_binding (GST_OBJECT (elem), "int");
+ fail_unless (test_cb != NULL, NULL);
+
+ test_cs = gst_control_binding_get_control_source (cb);
+ fail_unless (test_cs != NULL, NULL);
+ fail_unless (test_cs == cs);
+ fail_unless_equals_int (G_OBJECT (cs)->ref_count, 3);
+ gst_object_unref (test_cs);
+ gst_object_unref (test_cb);
+ gst_object_unref (cs);
+ gst_object_unref (cb);
gst_object_unref (elem);
}
GST_START_TEST (controller_bind_twice)
{
GstElement *elem;
- GstControlSource *csource;
+ GstControlSource *cs;
+ GstControlBinding *cb1, *cb2;
elem = gst_element_factory_make ("testobj", NULL);
- csource = (GstControlSource *) gst_test_control_source_new ();
- fail_unless (csource != NULL, NULL);
+ cs = (GstControlSource *) gst_test_control_source_new ();
+ fail_unless (cs != NULL, NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int",
- csource));
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double",
- csource));
-
- gst_object_unref (csource);
+ cb1 = gst_control_binding_new (GST_OBJECT (elem), "int", cs);
+ fail_unless (cb1 != NULL, NULL);
+ cb2 = gst_control_binding_new (GST_OBJECT (elem), "double", cs);
+ fail_unless (cb2 != NULL, NULL);
+ gst_object_unref (cb1);
+ gst_object_unref (cb2);
+ gst_object_unref (cs);
gst_object_unref (elem);
}
csource = gst_test_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int",
- (GstControlSource *) csource));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int",
+ (GstControlSource *) csource)));
csource->value = 0.5;
fail_unless (gst_object_sync_values (GST_OBJECT (elem), 0LL));
csource = gst_test_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int",
- (GstControlSource *) csource));
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double",
- (GstControlSource *) csource));
+ fail_unless (gst_object_set_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),
+ gst_control_binding_new (GST_OBJECT (elem), "double",
+ (GstControlSource *) csource)));
csource->value = 0.5;
fail_unless (gst_object_sync_values (GST_OBJECT (elem), 0LL));
csource = (GstControlSource *) gst_interpolation_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int",
- csource));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int",
+ (GstControlSource *) csource)));
/* don't fail on empty control point lists */
gst_object_sync_values (GST_OBJECT (elem), 0 * GST_SECOND);
csource = gst_interpolation_control_source_new ();
fail_unless (csource != NULL, NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int",
- (GstControlSource *) csource));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int",
+ (GstControlSource *) csource)));
/* set control values */
cs = (GstTimedValueControlSource *) csource;
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "double", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "double", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_CUBIC, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "float", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "float", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs2 = (GstControlSource *) csource2;
fail_unless (csource1 != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs1));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs1)));
fail_unless (csource2 != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "double",
- cs2));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "double", cs2)));
/* set interpolation mode */
g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "enum", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "enum", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* set interpolation mode */
g_object_set (csource, "mode", GST_INTERPOLATION_MODE_NONE, NULL);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE,
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE,
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SQUARE,
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SAW,
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW,
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* configure lfo */
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_TRIANGLE,
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
/* now pull in values for some timestamps */
gst_object_sync_values (GST_OBJECT (elem), 0 * GST_MSECOND);
cs = (GstControlSource *) csource;
fail_unless (csource != NULL);
- fail_unless (gst_object_set_control_source (GST_OBJECT (elem), "int", cs));
+ fail_unless (gst_object_set_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_source (GST_OBJECT (elem), "int",
- GST_CONTROL_SOURCE (csource)));
+ fail_unless (gst_object_set_control_binding (GST_OBJECT (elem),
+ gst_control_binding_new (GST_OBJECT (elem), "int", cs)));
g_object_set (csource, "tolerance", G_GINT64_CONSTANT (10), NULL);
/*
* audio-example.c
*
- * Builds a pipeline with audiotestsource->alsasink and sweeps frequency and
- * volume.
+ * Builds a pipeline with [ audiotestsource ! autoaudiosink ] and sweeps
+ * frequency and volume.
*
- * Needs gst-plugin-base installed.
+ * Needs gst-plugin-base + gst-plugins-good installed.
*/
#include <gst/gst.h>
/* build pipeline */
bin = gst_pipeline_new ("pipeline");
clock = gst_pipeline_get_clock (GST_PIPELINE (bin));
- src = gst_element_factory_make ("audiotestsrc", "gen_audio");
+ src = gst_element_factory_make ("audiotestsrc", NULL);
if (!src) {
GST_WARNING ("need audiotestsrc from gst-plugins-base");
goto Error;
}
- sink = gst_element_factory_make ("autoaudiosink", "play_audio");
+ sink = gst_element_factory_make ("autoaudiosink", NULL);
if (!sink) {
- GST_WARNING ("need autoaudiosink from gst-plugins-base");
+ GST_WARNING ("need autoaudiosink from gst-plugins-good");
goto Error;
}
goto Error;
}
- /* square wave
- g_object_set (G_OBJECT(src), "wave", 1, NULL);
- */
-
+ /* setup control sources */
csource1 = gst_interpolation_control_source_new ();
csource2 = gst_interpolation_control_source_new ();
- gst_object_set_control_source (GST_OBJECT (src), "volume",
- GST_CONTROL_SOURCE (csource1));
- gst_object_set_control_source (GST_OBJECT (src), "freq",
- GST_CONTROL_SOURCE (csource2));
+ gst_object_set_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_control_binding_new (GST_OBJECT_CAST (src), "freq",
+ GST_CONTROL_SOURCE (csource2)));
- /* Set interpolation mode */
+ /* set interpolation mode */
g_object_set (csource1, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
g_object_set (csource2, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
gst_object_unref (csource2);
+ /* run for 7 seconds */
clock_id =
gst_clock_new_single_shot_id (clock,
gst_clock_get_time (clock) + (7 * GST_SECOND));
- /* run for 7 seconds */
if (gst_element_set_state (bin, GST_STATE_PLAYING)) {
if ((wait_ret = gst_clock_id_wait (clock_id, NULL)) != GST_CLOCK_OK) {
GST_WARNING ("clock_id_wait returned: %d", wait_ret);
tvcs = (GstTimedValueControlSource *) ics;
cs = (GstControlSource *) ics;
- gst_object_set_control_source (e, "int", cs);
+ gst_object_set_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_source (e, "int", cs);
+ gst_object_set_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_source (e, "int", cs1);
+ gst_object_set_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_source ((GstObject *) lfocs1, "amplitude", cs2);
+ gst_object_set_control_binding ((GstObject *) lfocs1,
+ gst_control_binding_new ((GstObject *) lfocs1, "amplitude", cs2));
g_object_set (lfocs2,
"waveform", GST_LFO_WAVEFORM_SINE,
gst_object_flags_get_type
gst_object_get_control_binding
gst_object_get_control_rate
- gst_object_get_control_source
gst_object_get_name
gst_object_get_parent
gst_object_get_path_string
gst_object_set_control_binding_disabled
gst_object_set_control_bindings_disabled
gst_object_set_control_rate
- gst_object_set_control_source
gst_object_set_name
gst_object_set_parent
gst_object_suggest_next_sync