mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
object: Removed deprecated fields and methods
Make GstObject extend from GInitiallyUnowned, remove the FLOATING flag and use GObject methods for managing the floating ref. Remove class lock, it was a workaround for a glib < 2.8 bug. Remove the parent-set and parent-unset signals, attempt to implement with notify but disabled because deadlocks in deep-notify.
This commit is contained in:
parent
ab99dec18a
commit
99efec3636
5 changed files with 71 additions and 253 deletions
|
@ -1326,14 +1326,8 @@ GST_OBJECT_FLAG_SET
|
||||||
GST_OBJECT_FLAG_UNSET
|
GST_OBJECT_FLAG_UNSET
|
||||||
GST_OBJECT_NAME
|
GST_OBJECT_NAME
|
||||||
GST_OBJECT_PARENT
|
GST_OBJECT_PARENT
|
||||||
GST_OBJECT_IS_DISPOSING
|
|
||||||
GST_OBJECT_IS_FLOATING
|
|
||||||
GST_OBJECT_REFCOUNT
|
GST_OBJECT_REFCOUNT
|
||||||
GST_OBJECT_REFCOUNT_VALUE
|
GST_OBJECT_REFCOUNT_VALUE
|
||||||
GST_CLASS_GET_LOCK
|
|
||||||
GST_CLASS_LOCK
|
|
||||||
GST_CLASS_TRYLOCK
|
|
||||||
GST_CLASS_UNLOCK
|
|
||||||
GST_OBJECT_LOCK
|
GST_OBJECT_LOCK
|
||||||
GST_OBJECT_TRYLOCK
|
GST_OBJECT_TRYLOCK
|
||||||
GST_OBJECT_UNLOCK
|
GST_OBJECT_UNLOCK
|
||||||
|
@ -1351,10 +1345,8 @@ gst_object_has_ancestor
|
||||||
gst_object_ref
|
gst_object_ref
|
||||||
gst_object_unref
|
gst_object_unref
|
||||||
gst_object_ref_sink
|
gst_object_ref_sink
|
||||||
gst_object_sink
|
|
||||||
gst_object_replace
|
gst_object_replace
|
||||||
gst_object_get_path_string
|
gst_object_get_path_string
|
||||||
gst_class_signal_connect
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GST_OBJECT
|
GST_OBJECT
|
||||||
GST_IS_OBJECT
|
GST_IS_OBJECT
|
||||||
|
|
|
@ -6,3 +6,22 @@ The 0.11 porting guide
|
||||||
|
|
||||||
* multifdsink, tcpclientsink, tcpclientsrc, tcpserversrc the protocol property
|
* multifdsink, tcpclientsink, tcpclientsrc, tcpserversrc the protocol property
|
||||||
is removed, use gdppay and gdpdepay.
|
is removed, use gdppay and gdpdepay.
|
||||||
|
|
||||||
|
* GstObject:
|
||||||
|
GST_OBJECT_DISPOSING flag removed
|
||||||
|
GST_OBJECT_IS_DISPOSING removed
|
||||||
|
GST_OBJECT_FLOATING flag remove, GstObject is now GInitiallyUnowned
|
||||||
|
GST_OBJECT_IS_FLOATING removed, use g_object_is_floating()
|
||||||
|
|
||||||
|
GST_CLASS_GET_LOCK, GST_CLASS_LOCK, GST_CLASS_TRYLOCK, GST_CLASS_UNLOCK,
|
||||||
|
used to be a workaround for thread-unsafe glib < 2.8
|
||||||
|
|
||||||
|
gst_object_ref_sink() has gpointer as result to make it more like the
|
||||||
|
GObject version.
|
||||||
|
|
||||||
|
gst_object_sink() removed, use gst_object_ref_sink() instead.
|
||||||
|
|
||||||
|
gst_class_signal_connect() removed, was only used for XML
|
||||||
|
|
||||||
|
parent-set and parent-unset signals removed. Use notify:parent. Currently
|
||||||
|
still disabled because of deep notify locking issues.
|
||||||
|
|
211
gst/gstobject.c
211
gst/gstobject.c
|
@ -102,17 +102,16 @@ static GstAllocTrace *_gst_object_trace;
|
||||||
* then we get notify::parent for free */
|
* then we get notify::parent for free */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PARENT_SET,
|
|
||||||
PARENT_UNSET,
|
|
||||||
DEEP_NOTIFY,
|
DEEP_NOTIFY,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0,
|
PROP_0,
|
||||||
ARG_NAME
|
PROP_NAME,
|
||||||
/* FILL ME */
|
PROP_PARENT,
|
||||||
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -126,15 +125,11 @@ static GData *object_name_counts = NULL;
|
||||||
|
|
||||||
G_LOCK_DEFINE_STATIC (object_name_mutex);
|
G_LOCK_DEFINE_STATIC (object_name_mutex);
|
||||||
|
|
||||||
typedef struct _GstSignalObject GstSignalObject;
|
|
||||||
typedef struct _GstSignalObjectClass GstSignalObjectClass;
|
|
||||||
|
|
||||||
static GType gst_signal_object_get_type (void);
|
|
||||||
|
|
||||||
static void gst_object_set_property (GObject * object, guint prop_id,
|
static void gst_object_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_object_get_property (GObject * object, guint prop_id,
|
static void gst_object_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec);
|
GValue * value, GParamSpec * pspec);
|
||||||
|
|
||||||
static void gst_object_dispatch_properties_changed (GObject * object,
|
static void gst_object_dispatch_properties_changed (GObject * object,
|
||||||
guint n_pspecs, GParamSpec ** pspecs);
|
guint n_pspecs, GParamSpec ** pspecs);
|
||||||
|
|
||||||
|
@ -143,18 +138,17 @@ static void gst_object_finalize (GObject * object);
|
||||||
|
|
||||||
static gboolean gst_object_set_name_default (GstObject * object);
|
static gboolean gst_object_set_name_default (GstObject * object);
|
||||||
|
|
||||||
static GObjectClass *parent_class = NULL;
|
|
||||||
static guint gst_object_signals[LAST_SIGNAL] = { 0 };
|
static guint gst_object_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (GstObject, gst_object, G_TYPE_OBJECT);
|
static GParamSpec *properties[PROP_LAST];
|
||||||
|
|
||||||
|
G_DEFINE_ABSTRACT_TYPE (GstObject, gst_object, G_TYPE_INITIALLY_UNOWNED);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_object_class_init (GstObjectClass * klass)
|
gst_object_class_init (GstObjectClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
#ifndef GST_DISABLE_TRACE
|
#ifndef GST_DISABLE_TRACE
|
||||||
_gst_object_trace = gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT));
|
_gst_object_trace = gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT));
|
||||||
#endif
|
#endif
|
||||||
|
@ -162,34 +156,17 @@ gst_object_class_init (GstObjectClass * klass)
|
||||||
gobject_class->set_property = gst_object_set_property;
|
gobject_class->set_property = gst_object_set_property;
|
||||||
gobject_class->get_property = gst_object_get_property;
|
gobject_class->get_property = gst_object_get_property;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, ARG_NAME,
|
properties[PROP_NAME] =
|
||||||
g_param_spec_string ("name", "Name", "The name of the object",
|
g_param_spec_string ("name", "Name", "The name of the object", NULL,
|
||||||
NULL,
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
g_object_class_install_property (gobject_class, PROP_NAME,
|
||||||
|
properties[PROP_NAME]);
|
||||||
|
|
||||||
/**
|
properties[PROP_PARENT] =
|
||||||
* GstObject::parent-set:
|
g_param_spec_object ("parent", "Parent", "The parent of the object",
|
||||||
* @gstobject: a #GstObject
|
GST_TYPE_OBJECT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
* @parent: the new parent
|
g_object_class_install_property (gobject_class, PROP_PARENT,
|
||||||
*
|
properties[PROP_PARENT]);
|
||||||
* Emitted when the parent of an object is set.
|
|
||||||
*/
|
|
||||||
gst_object_signals[PARENT_SET] =
|
|
||||||
g_signal_new ("parent-set", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (GstObjectClass, parent_set), NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_OBJECT);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstObject::parent-unset:
|
|
||||||
* @gstobject: a #GstObject
|
|
||||||
* @parent: the old parent
|
|
||||||
*
|
|
||||||
* Emitted when the parent of an object is unset.
|
|
||||||
*/
|
|
||||||
gst_object_signals[PARENT_UNSET] =
|
|
||||||
g_signal_new ("parent-unset", G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstObjectClass, parent_unset), NULL,
|
|
||||||
NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_OBJECT);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstObject::deep-notify:
|
* GstObject::deep-notify:
|
||||||
|
@ -209,11 +186,6 @@ gst_object_class_init (GstObjectClass * klass)
|
||||||
G_TYPE_PARAM);
|
G_TYPE_PARAM);
|
||||||
|
|
||||||
klass->path_string_separator = "/";
|
klass->path_string_separator = "/";
|
||||||
/* FIXME 0.11: Store this directly in the class struct */
|
|
||||||
klass->lock = g_slice_new (GStaticRecMutex);
|
|
||||||
g_static_rec_mutex_init (klass->lock);
|
|
||||||
|
|
||||||
klass->signal_object = g_object_newv (gst_signal_object_get_type (), 0, NULL);
|
|
||||||
|
|
||||||
/* see the comments at gst_object_dispatch_properties_changed */
|
/* see the comments at gst_object_dispatch_properties_changed */
|
||||||
gobject_class->dispatch_properties_changed
|
gobject_class->dispatch_properties_changed
|
||||||
|
@ -236,7 +208,6 @@ gst_object_init (GstObject * object)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
object->flags = 0;
|
object->flags = 0;
|
||||||
GST_OBJECT_FLAG_SET (object, GST_OBJECT_FLOATING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -303,61 +274,18 @@ gst_object_unref (gpointer object)
|
||||||
* the floating flag while leaving the reference count unchanged. If the object
|
* the floating flag while leaving the reference count unchanged. If the object
|
||||||
* is not floating, then this call adds a new normal reference increasing the
|
* is not floating, then this call adds a new normal reference increasing the
|
||||||
* reference count by one.
|
* reference count by one.
|
||||||
*
|
|
||||||
* MT safe. This function grabs and releases @object lock.
|
|
||||||
*
|
|
||||||
* Since: 0.10.24
|
|
||||||
*/
|
*/
|
||||||
void
|
gpointer
|
||||||
gst_object_ref_sink (gpointer object)
|
gst_object_ref_sink (gpointer object)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GST_IS_OBJECT (object));
|
g_return_val_if_fail (object != NULL, NULL);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
#ifdef DEBUG_REFCOUNT
|
||||||
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
|
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref_sink %d->%d",
|
||||||
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object,
|
object, ((GObject *) object)->ref_count,
|
||||||
"unsetting floating flag");
|
((GObject *) object)->ref_count + 1);
|
||||||
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
|
#endif
|
||||||
GST_OBJECT_UNLOCK (object);
|
return g_object_ref_sink (object);
|
||||||
} else {
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
|
||||||
gst_object_ref (object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_object_sink:
|
|
||||||
* @object: a #GstObject to sink
|
|
||||||
*
|
|
||||||
* If @object was floating, the #GST_OBJECT_FLOATING flag is removed
|
|
||||||
* and @object is unreffed. When @object was not floating,
|
|
||||||
* this function does nothing.
|
|
||||||
*
|
|
||||||
* Any newly created object has a refcount of 1 and is floating.
|
|
||||||
* This function should be used when creating a new object to
|
|
||||||
* symbolically 'take ownership' of @object. This done by first doing a
|
|
||||||
* gst_object_ref() to keep a reference to @object and then gst_object_sink()
|
|
||||||
* to remove and unref any floating references to @object.
|
|
||||||
* Use gst_object_set_parent() to have this done for you.
|
|
||||||
*
|
|
||||||
* MT safe. This function grabs and releases @object lock.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_object_sink (gpointer object)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GST_IS_OBJECT (object));
|
|
||||||
|
|
||||||
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "sink");
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (object);
|
|
||||||
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
|
|
||||||
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "clear floating flag");
|
|
||||||
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
|
||||||
gst_object_unref (object);
|
|
||||||
} else {
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -414,7 +342,7 @@ gst_object_dispose (GObject * object)
|
||||||
GST_OBJECT_PARENT (object) = NULL;
|
GST_OBJECT_PARENT (object) = NULL;
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
|
|
||||||
parent_class->dispose (object);
|
((GObjectClass *) gst_object_parent_class)->dispose (object);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -449,7 +377,7 @@ gst_object_finalize (GObject * object)
|
||||||
gst_alloc_trace_free (_gst_object_trace, object);
|
gst_alloc_trace_free (_gst_object_trace, object);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
parent_class->finalize (object);
|
((GObjectClass *) gst_object_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Changing a GObject property of a GstObject will result in "deep-notify"
|
/* Changing a GObject property of a GstObject will result in "deep-notify"
|
||||||
|
@ -458,9 +386,6 @@ gst_object_finalize (GObject * object)
|
||||||
* top-level bin to catch property-change notifications for all contained
|
* top-level bin to catch property-change notifications for all contained
|
||||||
* elements.
|
* elements.
|
||||||
*
|
*
|
||||||
* This function is not MT safe in glib < 2.8 so we need to lock it with a
|
|
||||||
* classwide mutex in that case.
|
|
||||||
*
|
|
||||||
* MT safe.
|
* MT safe.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -475,7 +400,9 @@ gst_object_dispatch_properties_changed (GObject * object,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* do the standard dispatching */
|
/* do the standard dispatching */
|
||||||
parent_class->dispatch_properties_changed (object, n_pspecs, pspecs);
|
((GObjectClass *)
|
||||||
|
gst_object_parent_class)->dispatch_properties_changed (object, n_pspecs,
|
||||||
|
pspecs);
|
||||||
|
|
||||||
gst_object = GST_OBJECT_CAST (object);
|
gst_object = GST_OBJECT_CAST (object);
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
@ -728,21 +655,14 @@ gst_object_set_parent (GstObject * object, GstObject * parent)
|
||||||
if (G_UNLIKELY (object->parent != NULL))
|
if (G_UNLIKELY (object->parent != NULL))
|
||||||
goto had_parent;
|
goto had_parent;
|
||||||
|
|
||||||
/* sink object, we don't call our own function because we don't
|
|
||||||
* need to release/acquire the lock needlessly or touch the refcount
|
|
||||||
* in the floating case. */
|
|
||||||
object->parent = parent;
|
object->parent = parent;
|
||||||
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
|
g_object_ref_sink (object);
|
||||||
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object,
|
|
||||||
"unsetting floating flag");
|
|
||||||
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
} else {
|
|
||||||
GST_OBJECT_UNLOCK (object);
|
|
||||||
gst_object_ref (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_signal_emit (object, gst_object_signals[PARENT_SET], 0, parent);
|
/* FIXME, this does not work, the deep notify takes the lock from the parent
|
||||||
|
* object and deadlocks when the parent holds its lock when calling this
|
||||||
|
* function (like _element_add_pad()) */
|
||||||
|
/* g_object_notify_by_pspec ((GObject *)object, properties[PROP_PARENT]); */
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -808,7 +728,7 @@ gst_object_unparent (GstObject * object)
|
||||||
object->parent = NULL;
|
object->parent = NULL;
|
||||||
GST_OBJECT_UNLOCK (object);
|
GST_OBJECT_UNLOCK (object);
|
||||||
|
|
||||||
g_signal_emit (object, gst_object_signals[PARENT_UNSET], 0, parent);
|
/* g_object_notify_by_pspec ((GObject *)object, properties[PROP_PARENT]); */
|
||||||
|
|
||||||
gst_object_unref (object);
|
gst_object_unref (object);
|
||||||
} else {
|
} else {
|
||||||
|
@ -902,9 +822,12 @@ gst_object_set_property (GObject * object, guint prop_id,
|
||||||
gstobject = GST_OBJECT_CAST (object);
|
gstobject = GST_OBJECT_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_NAME:
|
case PROP_NAME:
|
||||||
gst_object_set_name (gstobject, g_value_get_string (value));
|
gst_object_set_name (gstobject, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_PARENT:
|
||||||
|
gst_object_set_parent (gstobject, g_value_get_object (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -920,9 +843,12 @@ gst_object_get_property (GObject * object, guint prop_id,
|
||||||
gstobject = GST_OBJECT_CAST (object);
|
gstobject = GST_OBJECT_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_NAME:
|
case PROP_NAME:
|
||||||
g_value_take_string (value, gst_object_get_name (gstobject));
|
g_value_take_string (value, gst_object_get_name (gstobject));
|
||||||
break;
|
break;
|
||||||
|
case PROP_PARENT:
|
||||||
|
g_value_take_object (value, gst_object_get_parent (gstobject));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -1012,50 +938,3 @@ gst_object_get_path_string (GstObject * object)
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct _GstSignalObject
|
|
||||||
{
|
|
||||||
GObject object;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstSignalObjectClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstSignalObject, gst_signal_object, G_TYPE_OBJECT);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_signal_object_class_init (GstSignalObjectClass * klass)
|
|
||||||
{
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_signal_object_init (GstSignalObject * object)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_class_signal_connect
|
|
||||||
* @klass: a #GstObjectClass to attach the signal to
|
|
||||||
* @name: the name of the signal to attach to
|
|
||||||
* @func: the signal function
|
|
||||||
* @func_data: a pointer to user data
|
|
||||||
*
|
|
||||||
* Connect to a class signal.
|
|
||||||
*
|
|
||||||
* Returns: the signal id.
|
|
||||||
*/
|
|
||||||
guint
|
|
||||||
gst_class_signal_connect (GstObjectClass * klass,
|
|
||||||
const gchar * name, gpointer func, gpointer func_data)
|
|
||||||
{
|
|
||||||
/* [0.11] func parameter needs to be changed to a GCallback *
|
|
||||||
* doing so now would be an API break. */
|
|
||||||
return g_signal_connect (klass->signal_object, name, G_CALLBACK (func),
|
|
||||||
func_data);
|
|
||||||
}
|
|
||||||
|
|
|
@ -41,17 +41,12 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstObjectFlags:
|
* GstObjectFlags:
|
||||||
* @GST_OBJECT_DISPOSING: the object is been destroyed, don't use it anymore
|
|
||||||
* @GST_OBJECT_FLOATING: the object has a floating reference count (e.g. its
|
|
||||||
* not assigned to a bin)
|
|
||||||
* @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
|
* @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
|
||||||
*
|
*
|
||||||
* The standard flags that an gstobject may have.
|
* The standard flags that an gstobject may have.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GST_OBJECT_DISPOSING = (1<<0),
|
|
||||||
GST_OBJECT_FLOATING = (1<<1),
|
|
||||||
/* padding */
|
/* padding */
|
||||||
GST_OBJECT_FLAG_LAST = (1<<4)
|
GST_OBJECT_FLAG_LAST = (1<<4)
|
||||||
} GstObjectFlags;
|
} GstObjectFlags;
|
||||||
|
@ -155,27 +150,11 @@ typedef enum
|
||||||
#define GST_OBJECT_FLAG_UNSET(obj,flag) (GST_OBJECT_FLAGS (obj) &= ~(flag))
|
#define GST_OBJECT_FLAG_UNSET(obj,flag) (GST_OBJECT_FLAGS (obj) &= ~(flag))
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GST_OBJECT_IS_DISPOSING:
|
|
||||||
* @obj: a #GstObject
|
|
||||||
*
|
|
||||||
* Check if the given object is beeing destroyed.
|
|
||||||
*/
|
|
||||||
#define GST_OBJECT_IS_DISPOSING(obj) (GST_OBJECT_FLAG_IS_SET (obj, GST_OBJECT_DISPOSING))
|
|
||||||
/**
|
|
||||||
* GST_OBJECT_IS_FLOATING:
|
|
||||||
* @obj: a #GstObject
|
|
||||||
*
|
|
||||||
* Check if the given object is floating (has no owner).
|
|
||||||
*/
|
|
||||||
#define GST_OBJECT_IS_FLOATING(obj) (GST_OBJECT_FLAG_IS_SET (obj, GST_OBJECT_FLOATING))
|
|
||||||
|
|
||||||
typedef struct _GstObject GstObject;
|
typedef struct _GstObject GstObject;
|
||||||
typedef struct _GstObjectClass GstObjectClass;
|
typedef struct _GstObjectClass GstObjectClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstObject:
|
* GstObject:
|
||||||
* @refcount: unused
|
|
||||||
* @lock: object LOCK
|
* @lock: object LOCK
|
||||||
* @name: The name of the object
|
* @name: The name of the object
|
||||||
* @name_prefix: unused
|
* @name_prefix: unused
|
||||||
|
@ -185,15 +164,11 @@ typedef struct _GstObjectClass GstObjectClass;
|
||||||
* GStreamer base object class.
|
* GStreamer base object class.
|
||||||
*/
|
*/
|
||||||
struct _GstObject {
|
struct _GstObject {
|
||||||
GObject object;
|
GInitiallyUnowned object;
|
||||||
|
|
||||||
/*< public >*/
|
|
||||||
gint refcount; /* unused (FIXME 0.11: remove) */
|
|
||||||
|
|
||||||
/*< public >*/ /* with LOCK */
|
/*< public >*/ /* with LOCK */
|
||||||
GMutex *lock; /* object LOCK */
|
GMutex *lock; /* object LOCK */
|
||||||
gchar *name; /* object name */
|
gchar *name; /* object name */
|
||||||
gchar *name_prefix; /* (un)used for debugging (FIXME 0.11: remove) */
|
|
||||||
GstObject *parent; /* this object's parent, weak ref */
|
GstObject *parent; /* this object's parent, weak ref */
|
||||||
guint32 flags;
|
guint32 flags;
|
||||||
|
|
||||||
|
@ -201,61 +176,21 @@ struct _GstObject {
|
||||||
gpointer _gst_reserved;
|
gpointer _gst_reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* GST_CLASS_GET_LOCK:
|
|
||||||
* @obj: a #GstObjectClass
|
|
||||||
*
|
|
||||||
* This macro will return the class lock used to protect deep_notify signal
|
|
||||||
* emission on thread-unsafe glib versions (glib < 2.8).
|
|
||||||
*/
|
|
||||||
#define GST_CLASS_GET_LOCK(obj) (GST_OBJECT_CLASS_CAST(obj)->lock)
|
|
||||||
/**
|
|
||||||
* GST_CLASS_LOCK:
|
|
||||||
* @obj: a #GstObjectClass
|
|
||||||
*
|
|
||||||
* Lock the class.
|
|
||||||
*/
|
|
||||||
#define GST_CLASS_LOCK(obj) (g_static_rec_mutex_lock(GST_CLASS_GET_LOCK(obj)))
|
|
||||||
/**
|
|
||||||
* GST_CLASS_TRYLOCK:
|
|
||||||
* @obj: a #GstObjectClass
|
|
||||||
*
|
|
||||||
* Try to lock the class, returns TRUE if class could be locked.
|
|
||||||
*/
|
|
||||||
#define GST_CLASS_TRYLOCK(obj) (g_static_rec_mutex_trylock(GST_CLASS_GET_LOCK(obj)))
|
|
||||||
/**
|
|
||||||
* GST_CLASS_UNLOCK:
|
|
||||||
* @obj: a #GstObjectClass
|
|
||||||
*
|
|
||||||
* Unlock the class.
|
|
||||||
*/
|
|
||||||
#define GST_CLASS_UNLOCK(obj) (g_static_rec_mutex_unlock(GST_CLASS_GET_LOCK(obj)))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstObjectClass:
|
* GstObjectClass:
|
||||||
* @parent_class: parent
|
* @parent_class: parent
|
||||||
* @path_string_separator: separator used by gst_object_get_path_string()
|
* @path_string_separator: separator used by gst_object_get_path_string()
|
||||||
* @signal_object: is used to signal to the whole class
|
* @signal_object: is used to signal to the whole class
|
||||||
* @lock: class lock to be used with GST_CLASS_GET_LOCK(), GST_CLASS_LOCK(), GST_CLASS_UNLOCK() and others.
|
|
||||||
* @parent_set: default signal handler
|
|
||||||
* @parent_unset: default signal handler
|
|
||||||
* @deep_notify: default signal handler
|
* @deep_notify: default signal handler
|
||||||
*
|
*
|
||||||
* GStreamer base object class.
|
* GStreamer base object class.
|
||||||
*/
|
*/
|
||||||
struct _GstObjectClass {
|
struct _GstObjectClass {
|
||||||
GObjectClass parent_class;
|
GInitiallyUnownedClass parent_class;
|
||||||
|
|
||||||
const gchar *path_string_separator;
|
const gchar *path_string_separator;
|
||||||
GObject *signal_object;
|
|
||||||
|
|
||||||
/* FIXME-0.11: remove this, plus the above GST_CLASS_*_LOCK macros */
|
|
||||||
GStaticRecMutex *lock;
|
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
/* FIXME-0.11: remove, and pass NULL in g_signal_new(), we never used them */
|
|
||||||
void (*parent_set) (GstObject * object, GstObject * parent);
|
|
||||||
void (*parent_unset) (GstObject * object, GstObject * parent);
|
|
||||||
void (*deep_notify) (GstObject * object, GstObject * orig, GParamSpec * pspec);
|
void (*deep_notify) (GstObject * object, GstObject * orig, GParamSpec * pspec);
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
|
@ -284,8 +219,7 @@ void gst_object_default_deep_notify (GObject *object, GstObject *ori
|
||||||
/* refcounting + life cycle */
|
/* refcounting + life cycle */
|
||||||
gpointer gst_object_ref (gpointer object);
|
gpointer gst_object_ref (gpointer object);
|
||||||
void gst_object_unref (gpointer object);
|
void gst_object_unref (gpointer object);
|
||||||
void gst_object_ref_sink (gpointer object);
|
gpointer gst_object_ref_sink (gpointer object);
|
||||||
void gst_object_sink (gpointer object);
|
|
||||||
|
|
||||||
/* replace object pointer */
|
/* replace object pointer */
|
||||||
void gst_object_replace (GstObject **oldobj, GstObject *newobj);
|
void gst_object_replace (GstObject **oldobj, GstObject *newobj);
|
||||||
|
@ -296,12 +230,6 @@ gchar * gst_object_get_path_string (GstObject *object);
|
||||||
/* misc utils */
|
/* misc utils */
|
||||||
gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
|
gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
|
||||||
|
|
||||||
/* class signal stuff */
|
|
||||||
guint gst_class_signal_connect (GstObjectClass *klass,
|
|
||||||
const gchar *name,
|
|
||||||
gpointer func,
|
|
||||||
gpointer func_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_OBJECT_H__ */
|
#endif /* __GST_OBJECT_H__ */
|
||||||
|
|
|
@ -230,7 +230,7 @@ gst_pad_template_init (GstPadTemplate * templ)
|
||||||
* For consistency, then, we only produce them with sunken references
|
* For consistency, then, we only produce them with sunken references
|
||||||
* owned by the creator of the object
|
* owned by the creator of the object
|
||||||
*/
|
*/
|
||||||
if (GST_OBJECT_IS_FLOATING (templ)) {
|
if (g_object_is_floating (templ)) {
|
||||||
gst_object_ref_sink (templ);
|
gst_object_ref_sink (templ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue