mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
controller: remove convenience api for control sources
This is needed to support multiple kinds of control-bindings.
This commit is contained in:
parent
c6ac51e729
commit
c227d51fa9
11 changed files with 163 additions and 202 deletions
|
@ -1487,8 +1487,6 @@ gst_object_set_control_bindings_disabled
|
|||
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
|
||||
|
|
|
@ -45,8 +45,8 @@ static void gst_control_binding_finalize (GObject * object);
|
|||
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)
|
||||
|
@ -364,8 +364,6 @@ gst_control_binding_get_value_array (GstControlBinding * self,
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gst_control_binding_get_control_source:
|
||||
* @self: the control binding
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef void (* GstControlBindingConvert) (GstControlBinding *self, gdouble src_
|
|||
* The instance structure of #GstControlBinding.
|
||||
*/
|
||||
struct _GstControlBinding {
|
||||
GObject parent;
|
||||
GstObject parent;
|
||||
|
||||
/*< public >*/
|
||||
const gchar *name; /* name of the property */
|
||||
|
@ -91,7 +91,13 @@ struct _GstControlBinding {
|
|||
|
||||
struct _GstControlBindingClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/* need vfuncs for:
|
||||
_sync_values
|
||||
_get_value
|
||||
_get_value_array
|
||||
*/
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
* </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
|
||||
|
@ -1269,86 +1269,6 @@ gst_object_get_control_binding (GstObject * object, const gchar * property_name)
|
|||
return binding;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -248,11 +248,6 @@ gboolean gst_object_set_control_binding (GstObject * object, GstControlB
|
|||
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,
|
||||
|
|
|
@ -111,8 +111,9 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
/* 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);
|
||||
|
||||
|
||||
|
|
|
@ -322,15 +322,15 @@ GST_START_TEST (controller_new_fail1)
|
|||
{
|
||||
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);
|
||||
|
@ -343,15 +343,15 @@ GST_START_TEST (controller_new_fail2)
|
|||
{
|
||||
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);
|
||||
|
@ -364,15 +364,15 @@ GST_START_TEST (controller_new_fail3)
|
|||
{
|
||||
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);
|
||||
|
@ -385,16 +385,16 @@ GST_START_TEST (controller_new_fail4)
|
|||
{
|
||||
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);
|
||||
|
@ -408,16 +408,17 @@ GST_START_TEST (controller_new_okay1)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -429,21 +430,23 @@ GST_START_TEST (controller_new_okay2)
|
|||
{
|
||||
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);
|
||||
|
@ -456,30 +459,35 @@ GST_START_TEST (controller_param_twice)
|
|||
{
|
||||
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);
|
||||
|
@ -509,24 +517,32 @@ GST_END_TEST;
|
|||
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);
|
||||
}
|
||||
|
@ -537,20 +553,22 @@ GST_END_TEST;
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -567,8 +585,9 @@ GST_START_TEST (controller_sync1)
|
|||
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));
|
||||
|
@ -592,10 +611,12 @@ GST_START_TEST (controller_sync2)
|
|||
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));
|
||||
|
|
|
@ -285,8 +285,9 @@ GST_START_TEST (controller_controlsource_empty1)
|
|||
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);
|
||||
|
@ -310,8 +311,9 @@ GST_START_TEST (controller_controlsource_empty2)
|
|||
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;
|
||||
|
@ -347,7 +349,8 @@ GST_START_TEST (controller_interpolation_none)
|
|||
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);
|
||||
|
@ -398,7 +401,8 @@ GST_START_TEST (controller_interpolation_linear)
|
|||
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);
|
||||
|
@ -437,7 +441,8 @@ GST_START_TEST (controller_interpolation_cubic)
|
|||
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);
|
||||
|
@ -485,7 +490,8 @@ GST_START_TEST (controller_interpolation_cubic_too_few_cp)
|
|||
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);
|
||||
|
@ -526,7 +532,8 @@ GST_START_TEST (controller_interpolation_unset)
|
|||
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);
|
||||
|
@ -581,7 +588,8 @@ GST_START_TEST (controller_interpolation_unset_all)
|
|||
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);
|
||||
|
@ -628,7 +636,8 @@ GST_START_TEST (controller_interpolation_linear_value_array)
|
|||
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);
|
||||
|
@ -681,7 +690,8 @@ GST_START_TEST (controller_interpolation_linear_invalid_values)
|
|||
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);
|
||||
|
@ -732,7 +742,8 @@ GST_START_TEST (controller_interpolation_linear_default_values)
|
|||
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);
|
||||
|
@ -802,10 +813,11 @@ GST_START_TEST (controller_interpolation_linear_disabled)
|
|||
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);
|
||||
|
@ -926,7 +938,8 @@ GST_START_TEST (controller_interpolation_set_from_list)
|
|||
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);
|
||||
|
@ -970,7 +983,8 @@ GST_START_TEST (controller_interpolation_linear_before_ts0)
|
|||
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);
|
||||
|
@ -1016,7 +1030,8 @@ GST_START_TEST (controller_interpolation_linear_enums)
|
|||
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);
|
||||
|
@ -1059,7 +1074,8 @@ GST_START_TEST (controller_timed_value_count)
|
|||
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);
|
||||
|
@ -1099,7 +1115,8 @@ GST_START_TEST (controller_lfo_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,
|
||||
|
@ -1152,7 +1169,8 @@ GST_START_TEST (controller_lfo_sine_timeshift)
|
|||
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,
|
||||
|
@ -1205,7 +1223,8 @@ GST_START_TEST (controller_lfo_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_SQUARE,
|
||||
|
@ -1258,7 +1277,8 @@ GST_START_TEST (controller_lfo_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_SAW,
|
||||
|
@ -1311,7 +1331,8 @@ GST_START_TEST (controller_lfo_rsaw)
|
|||
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,
|
||||
|
@ -1364,7 +1385,8 @@ GST_START_TEST (controller_lfo_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)));
|
||||
|
||||
/* configure lfo */
|
||||
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_TRIANGLE,
|
||||
|
@ -1417,7 +1439,8 @@ GST_START_TEST (controller_lfo_none)
|
|||
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);
|
||||
|
@ -1468,7 +1491,8 @@ GST_START_TEST (controller_trigger_exact)
|
|||
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));
|
||||
|
||||
|
@ -1513,8 +1537,8 @@ GST_START_TEST (controller_trigger_tolerance)
|
|||
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);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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>
|
||||
|
@ -27,14 +27,14 @@ main (gint argc, gchar ** argv)
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -44,19 +44,18 @@ main (gint argc, gchar ** argv)
|
|||
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);
|
||||
|
@ -75,11 +74,11 @@ main (gint argc, gchar ** argv)
|
|||
|
||||
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);
|
||||
|
|
|
@ -192,7 +192,7 @@ test_interpolation (void)
|
|||
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);
|
||||
|
@ -275,7 +275,7 @@ test_lfo (void)
|
|||
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,
|
||||
|
@ -381,7 +381,7 @@ test_chained_lfo (void)
|
|||
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,
|
||||
|
@ -391,7 +391,8 @@ test_chained_lfo (void)
|
|||
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,
|
||||
|
|
|
@ -604,7 +604,6 @@ EXPORTS
|
|||
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
|
||||
|
@ -620,7 +619,6 @@ EXPORTS
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue