projects
/
platform
/
upstream
/
gstreamer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: fix tests when compiling with glib_checks=disabled
[platform/upstream/gstreamer.git]
/
gst
/
gstcontrolbinding.c
diff --git
a/gst/gstcontrolbinding.c
b/gst/gstcontrolbinding.c
index
11bd65d
..
bed5e01
100644
(file)
--- a/
gst/gstcontrolbinding.c
+++ b/
gst/gstcontrolbinding.c
@@
-21,6
+21,7
@@
*/
/**
* SECTION:gstcontrolbinding
*/
/**
* SECTION:gstcontrolbinding
+ * @title: GstControlBinding
* @short_description: attachment for control source sources
*
* A base class for value mapping objects that attaches control sources to gobject
* @short_description: attachment for control source sources
*
* A base class for value mapping objects that attaches control sources to gobject
@@
-52,6
+53,11
@@
#include <math.h>
#include <math.h>
+struct _GstControlBindingPrivate
+{
+ GWeakRef object;
+};
+
#define GST_CAT_DEFAULT control_binding_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
#define GST_CAT_DEFAULT control_binding_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@@
-69,7
+75,7
@@
static void gst_control_binding_dispose (GObject * object);
static void gst_control_binding_finalize (GObject * object);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstControlBinding, gst_control_binding,
static void gst_control_binding_finalize (GObject * object);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstControlBinding, gst_control_binding,
- GST_TYPE_OBJECT, _do_init);
+ GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstControlBinding)
_do_init);
enum
{
enum
{
@@
-108,6
+114,8
@@
gst_control_binding_class_init (GstControlBindingClass * klass)
static void
gst_control_binding_init (GstControlBinding * binding)
{
static void
gst_control_binding_init (GstControlBinding * binding)
{
+ binding->ABI.abi.priv = gst_control_binding_get_instance_private (binding);
+ g_weak_ref_init (&binding->ABI.abi.priv->object, NULL);
}
static GObject *
}
static GObject *
@@
-116,19
+124,26
@@
gst_control_binding_constructor (GType type, guint n_construct_params,
{
GstControlBinding *binding;
GParamSpec *pspec;
{
GstControlBinding *binding;
GParamSpec *pspec;
+ GstObject *object;
binding =
GST_CONTROL_BINDING (G_OBJECT_CLASS (gst_control_binding_parent_class)
->constructor (type, n_construct_params, construct_params));
binding =
GST_CONTROL_BINDING (G_OBJECT_CLASS (gst_control_binding_parent_class)
->constructor (type, n_construct_params, construct_params));
- GST_INFO_OBJECT (binding->object, "trying to put property '%s' under control",
+ object = g_weak_ref_get (&binding->ABI.abi.priv->object);
+ if (!object) {
+ GST_WARNING_OBJECT (object, "no object set");
+ return (GObject *) binding;
+ }
+
+ GST_INFO_OBJECT (object, "trying to put property '%s' under control",
binding->name);
/* check if the object has a property of that name */
if ((pspec =
binding->name);
/* check if the object has a property of that name */
if ((pspec =
- g_object_class_find_property (G_OBJECT_GET_CLASS (
binding->
object),
+ g_object_class_find_property (G_OBJECT_GET_CLASS (object),
binding->name))) {
binding->name))) {
- GST_DEBUG_OBJECT (
binding->
object, " psec->flags : 0x%08x", pspec->flags);
+ GST_DEBUG_OBJECT (object, " psec->flags : 0x%08x", pspec->flags);
/* check if this param is witable && controlable && !construct-only */
if ((pspec->flags & (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE |
/* check if this param is witable && controlable && !construct-only */
if ((pspec->flags & (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE |
@@
-136,15
+151,18
@@
gst_control_binding_constructor (GType type, guint n_construct_params,
(G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE)) {
binding->pspec = pspec;
} else {
(G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE)) {
binding->pspec = pspec;
} else {
- GST_WARNING_OBJECT (
binding->
object,
+ GST_WARNING_OBJECT (object,
"property '%s' on class '%s' needs to "
"be writeable, controlable and not construct_only", binding->name,
"property '%s' on class '%s' needs to "
"be writeable, controlable and not construct_only", binding->name,
- G_OBJECT_TYPE_NAME (
binding->
object));
+ G_OBJECT_TYPE_NAME (object));
}
} else {
}
} else {
- GST_WARNING_OBJECT (
binding->
object, "class '%s' has no property '%s'",
- G_OBJECT_TYPE_NAME (
binding->
object), binding->name);
+ GST_WARNING_OBJECT (object, "class '%s' has no property '%s'",
+ G_OBJECT_TYPE_NAME (object), binding->name);
}
}
+
+ gst_object_unref (object);
+
return (GObject *) binding;
}
return (GObject *) binding;
}
@@
-154,9
+172,10
@@
gst_control_binding_dispose (GObject * object)
GstControlBinding *self = GST_CONTROL_BINDING (object);
/* we did not took a reference */
GstControlBinding *self = GST_CONTROL_BINDING (object);
/* we did not took a reference */
- g_object_remove_weak_pointer ((GObject *) self->object,
- (gpointer *) & self->object);
- self->object = NULL;
+ g_object_remove_weak_pointer ((GObject *) self->__object,
+ (gpointer *) & self->__object);
+ self->__object = NULL;
+ g_weak_ref_clear (&self->ABI.abi.priv->object);
((GObjectClass *) gst_control_binding_parent_class)->dispose (object);
}
((GObjectClass *) gst_control_binding_parent_class)->dispose (object);
}
@@
-180,9
+199,11
@@
gst_control_binding_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_OBJECT:
/* do not ref to avoid a ref cycle */
switch (prop_id) {
case PROP_OBJECT:
/* do not ref to avoid a ref cycle */
- self->object = g_value_get_object (value);
- g_object_add_weak_pointer ((GObject *) self->object,
- (gpointer *) & self->object);
+ self->__object = g_value_get_object (value);
+ g_object_add_weak_pointer ((GObject *) self->__object,
+ (gpointer *) & self->__object);
+
+ g_weak_ref_set (&self->ABI.abi.priv->object, self->__object);
break;
case PROP_NAME:
self->name = g_value_dup_string (value);
break;
case PROP_NAME:
self->name = g_value_dup_string (value);
@@
-201,7
+222,7
@@
gst_control_binding_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_OBJECT:
switch (prop_id) {
case PROP_OBJECT:
- g_value_
set_object (value, self->object
);
+ g_value_
take_object (value, g_weak_ref_get (&self->ABI.abi.priv->object)
);
break;
case PROP_NAME:
g_value_set_string (value, self->name);
break;
case PROP_NAME:
g_value_set_string (value, self->name);
@@
-297,7
+318,7
@@
gst_control_binding_get_value (GstControlBinding * binding,
* This function is useful if one wants to e.g. draw a graph of the control
* curve or apply a control curve sample by sample.
*
* This function is useful if one wants to e.g. draw a graph of the control
* curve or apply a control curve sample by sample.
*
- * The values are unboxed and ready to be used. The similar function
+ * The values are unboxed and ready to be used. The similar function
* gst_control_binding_get_g_value_array() returns the array as #GValues and is
* more suitable for bindings.
*
* gst_control_binding_get_g_value_array() returns the array as #GValues and is
* more suitable for bindings.
*