mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
controller: the object needs a ref to the controller for the convenience api
Add a hack to ensure the object will have a ref to the controller once we create it. Fixes the audio example (that uses the controller api directly).
This commit is contained in:
parent
593d2b297b
commit
618be218e8
2 changed files with 11 additions and 1 deletions
|
@ -279,8 +279,12 @@ gst_controller_new_valist (GstObject * object, va_list var_args)
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
|
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
|
||||||
|
|
||||||
|
/* FIXME: storing the controller into the object is ugly
|
||||||
|
* we'd like to make the controller object completely internal
|
||||||
|
*/
|
||||||
self = g_object_newv (GST_TYPE_CONTROLLER, 0, NULL);
|
self = g_object_newv (GST_TYPE_CONTROLLER, 0, NULL);
|
||||||
self->object = g_object_ref (object);
|
self->object = g_object_ref (object);
|
||||||
|
object->ctrl = g_object_ref (self);
|
||||||
|
|
||||||
/* create GstControlledProperty for each property */
|
/* create GstControlledProperty for each property */
|
||||||
while ((name = va_arg (var_args, gchar *))) {
|
while ((name = va_arg (var_args, gchar *))) {
|
||||||
|
@ -314,6 +318,7 @@ gst_controller_new_list (GstObject * object, GList * list)
|
||||||
|
|
||||||
self = g_object_newv (GST_TYPE_CONTROLLER, 0, NULL);
|
self = g_object_newv (GST_TYPE_CONTROLLER, 0, NULL);
|
||||||
self->object = g_object_ref (object);
|
self->object = g_object_ref (object);
|
||||||
|
object->ctrl = g_object_ref (self);
|
||||||
|
|
||||||
/* create GstControlledProperty for each property */
|
/* create GstControlledProperty for each property */
|
||||||
for (node = list; node; node = g_list_next (node)) {
|
for (node = list; node; node = g_list_next (node)) {
|
||||||
|
|
|
@ -982,7 +982,12 @@ gst_object_control_properties (GstObject * object, ...)
|
||||||
|
|
||||||
va_start (var_args, object);
|
va_start (var_args, object);
|
||||||
if (object->ctrl) {
|
if (object->ctrl) {
|
||||||
object->ctrl = gst_controller_new_valist (object, var_args);
|
GstController *ctrl = gst_controller_new_valist (object, var_args);
|
||||||
|
|
||||||
|
/* FIXME: see gst_controller_new_*() */
|
||||||
|
g_object_unref (object->ctrl);
|
||||||
|
object->ctrl = ctrl;
|
||||||
|
|
||||||
res = (object->ctrl != NULL);
|
res = (object->ctrl != NULL);
|
||||||
} else {
|
} else {
|
||||||
res = gst_controller_add_properties_valist ((GstController *) object->ctrl,
|
res = gst_controller_add_properties_valist ((GstController *) object->ctrl,
|
||||||
|
|
Loading…
Reference in a new issue