diff --git a/ChangeLog b/ChangeLog index 015588fec8..7fcb447751 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-28 Stefan Kost + + * docs/libs/gstreamer-libs-sections.txt: + * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist), + (gst_controller_new_list): + * libs/gst/controller/gstcontroller.h: + added another constructor for language bindings + 2005-09-28 Thomas Vander Stichele * check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite): diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index 491f703126..4a4727b340 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -50,6 +50,7 @@ GstController GstInterpolateMode gst_controller_init gst_controller_new +gst_controller_new_list gst_controller_new_valist gst_controller_remove_properties gst_controller_remove_properties_valist diff --git a/libs/gst/controller/gstcontroller.c b/libs/gst/controller/gstcontroller.c index d09d34e26b..b78cb8f71f 100644 --- a/libs/gst/controller/gstcontroller.c +++ b/libs/gst/controller/gstcontroller.c @@ -434,8 +434,6 @@ gst_controller_new_valist (GObject * object, va_list var_args) // store the controller g_object_set_qdata (object, __gst_controller_key, self); } else { - // increment ref-count (this causes red-count-leaks - //self = g_object_ref (self); GST_INFO ("returning existing controller"); } self->properties = g_list_prepend (self->properties, prop); @@ -451,6 +449,57 @@ gst_controller_new_valist (GObject * object, va_list var_args) return (self); } +/** + * gst_controller_new_list: + * @object: the object of which some properties should be controlled + * @list: list of property names that should be controlled + * + * Creates a new GstController for the given object's properties + * + * Returns: the new controller. + * Since: 0.9 + */ +GstController * +gst_controller_new_list (GObject * object, GList * list) +{ + GstController *self; + GstControlledProperty *prop; + gchar *name; + GList *node; + + g_return_val_if_fail (G_IS_OBJECT (object), NULL); + + GST_INFO ("setting up a new controller"); + + self = g_object_get_qdata (object, __gst_controller_key); + // create GstControlledProperty for each property + for (node = list; node; node = g_list_next (list)) { + name = (gchar *) node->data; + // test if this property isn't yet controlled + if (!self || !(prop = gst_controller_find_controlled_property (self, name))) { + // create GstControlledProperty and add to self->propeties List + if ((prop = gst_controlled_property_new (object, name))) { + // if we don't have a controller object yet, now is the time to create one + if (!self) { + self = g_object_new (GST_TYPE_CONTROLLER, NULL); + self->object = object; + // store the controller + g_object_set_qdata (object, __gst_controller_key, self); + } else { + GST_INFO ("returning existing controller"); + } + self->properties = g_list_prepend (self->properties, prop); + } + } else { + GST_WARNING ("trying to control property again"); + } + } + + if (self) + GST_INFO ("controller->ref_count=%d", G_OBJECT (self)->ref_count); + return (self); +} + /** * gst_controller_new: * @object: the object of which some properties should be controlled diff --git a/libs/gst/controller/gstcontroller.h b/libs/gst/controller/gstcontroller.h index ddc4a2d033..c3f9388f60 100644 --- a/libs/gst/controller/gstcontroller.h +++ b/libs/gst/controller/gstcontroller.h @@ -204,6 +204,7 @@ GType gst_controller_get_type (void); /* GstController functions */ GstController *gst_controller_new_valist (GObject * object, va_list var_args); +GstController *gst_controller_new_list (GObject * object, GList *list); GstController *gst_controller_new (GObject * object, ...); gboolean gst_controller_remove_properties_valist (GstController * self,