added another constructor for language bindings

Original commit message from CVS:
* 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
This commit is contained in:
Stefan Kost 2005-09-28 16:39:29 +00:00
parent 5ae3bc47ec
commit d6b67a4dd8
4 changed files with 61 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2005-09-28 Stefan Kost <ensonic@users.sf.net>
* 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 <thomas at apestaart dot org> 2005-09-28 Thomas Vander Stichele <thomas at apestaart dot org>
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite): * check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):

View file

@ -50,6 +50,7 @@ GstController
GstInterpolateMode GstInterpolateMode
gst_controller_init gst_controller_init
gst_controller_new gst_controller_new
gst_controller_new_list
gst_controller_new_valist gst_controller_new_valist
gst_controller_remove_properties gst_controller_remove_properties
gst_controller_remove_properties_valist gst_controller_remove_properties_valist

View file

@ -434,8 +434,6 @@ gst_controller_new_valist (GObject * object, va_list var_args)
// store the controller // store the controller
g_object_set_qdata (object, __gst_controller_key, self); g_object_set_qdata (object, __gst_controller_key, self);
} else { } else {
// increment ref-count (this causes red-count-leaks
//self = g_object_ref (self);
GST_INFO ("returning existing controller"); GST_INFO ("returning existing controller");
} }
self->properties = g_list_prepend (self->properties, prop); self->properties = g_list_prepend (self->properties, prop);
@ -451,6 +449,57 @@ gst_controller_new_valist (GObject * object, va_list var_args)
return (self); 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: * gst_controller_new:
* @object: the object of which some properties should be controlled * @object: the object of which some properties should be controlled

View file

@ -204,6 +204,7 @@ GType gst_controller_get_type (void);
/* GstController functions */ /* GstController functions */
GstController *gst_controller_new_valist (GObject * object, va_list var_args); 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, ...); GstController *gst_controller_new (GObject * object, ...);
gboolean gst_controller_remove_properties_valist (GstController * self, gboolean gst_controller_remove_properties_valist (GstController * self,