*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef __GST_OBJECT_H__
#define GST_OBJECT_CAST(obj) ((GstObject*)(obj))
#define GST_OBJECT_CLASS_CAST(klass) ((GstObjectClass*)(klass))
-/* make sure we don't change the object size but still make it compile
- * without libxml */
-#if defined(GST_DISABLE_LOADSAVE) || defined(GST_DISABLE_DEPRECATED)
-#define GstXmlNodePtr gpointer
-#else
-#define GstXmlNodePtr xmlNodePtr
-#endif
-
/**
* 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_MAY_BE_LEAKED: the object is expected to stay alive even
+ * after gst_deinit() has been called and so should be ignored by leak
+ * detection tools. (Since: 1.10)
* @GST_OBJECT_FLAG_LAST: subclasses can add additional flags starting from this flag
*
* The standard flags that an gstobject may have.
*/
typedef enum
{
- GST_OBJECT_DISPOSING = (1<<0),
- GST_OBJECT_FLOATING = (1<<1),
+ GST_OBJECT_FLAG_MAY_BE_LEAKED = (1 << 0),
/* padding */
GST_OBJECT_FLAG_LAST = (1<<4)
} GstObjectFlags;
*
* Acquire a reference to the mutex of this object.
*/
-#define GST_OBJECT_GET_LOCK(obj) (GST_OBJECT_CAST(obj)->lock)
+#define GST_OBJECT_GET_LOCK(obj) (&GST_OBJECT_CAST(obj)->lock)
/**
* GST_OBJECT_LOCK:
* @obj: a #GstObject to lock
* @obj: a #GstObject.
*
* This macro will try to obtain a lock on the object, but will return with
- * FALSE if it can't get it immediately.
+ * %FALSE if it can't get it immediately.
*/
#define GST_OBJECT_TRYLOCK(obj) g_mutex_trylock(GST_OBJECT_GET_LOCK(obj))
/**
* GST_OBJECT_NAME:
* @obj: a #GstObject
*
- * Get the name of this object
+ * Get the name of this object. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_object_get_name() instead.
*/
#define GST_OBJECT_NAME(obj) (GST_OBJECT_CAST(obj)->name)
/**
* GST_OBJECT_PARENT:
* @obj: a #GstObject
*
- * Get the parent of this object
+ * Get the parent of this object. This is not thread-safe by default
+ * (i.e. you will have to make sure the object lock is taken yourself).
+ * If in doubt use gst_object_get_parent() instead.
*/
#define GST_OBJECT_PARENT(obj) (GST_OBJECT_CAST(obj)->parent)
* @obj: a #GstObject
* @flag: Flag to set
*
- * This macro usets the given bits.
+ * This macro unsets the given bits.
*/
#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 _GstObjectClass GstObjectClass;
/**
* GstObject:
- * @refcount: unused
* @lock: object LOCK
* @name: The name of the object
- * @name_prefix: unused
* @parent: this object's parent, weak ref
- * @flags: use GST_OBJECT_IS_XXX macros to access the flags
+ * @flags: flags for this object
*
* GStreamer base object class.
*/
struct _GstObject {
- GObject object;
-
- /*< public >*/
- gint refcount; /* unused (FIXME 0.11: remove) */
+ GInitiallyUnowned object;
/*< public >*/ /* with LOCK */
- GMutex *lock; /* object LOCK */
+ GMutex lock; /* object LOCK */
gchar *name; /* object name */
- gchar *name_prefix; /* (un)used for debugging (FIXME 0.11: remove) */
GstObject *parent; /* this object's parent, weak ref */
guint32 flags;
/*< private >*/
+ GList *control_bindings; /* List of GstControlBinding */
+ guint64 control_rate;
+ guint64 last_sync;
+
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).
- *
- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
- */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_CLASS_GET_LOCK(obj) (GST_OBJECT_CLASS_CAST(obj)->lock)
-#endif
-
-/**
- * GST_CLASS_LOCK:
- * @obj: a #GstObjectClass
- *
- * Lock the class.
- *
- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
- */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_CLASS_LOCK(obj) (g_static_rec_mutex_lock(GST_CLASS_GET_LOCK(obj)))
-#endif
-
-/**
- * GST_CLASS_TRYLOCK:
- * @obj: a #GstObjectClass
- *
- * Try to lock the class, returns TRUE if class could be locked.
- *
- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
- */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_CLASS_TRYLOCK(obj) (g_static_rec_mutex_trylock(GST_CLASS_GET_LOCK(obj)))
-#endif
-
-/**
- * GST_CLASS_UNLOCK:
- * @obj: a #GstObjectClass
- *
- * Unlock the class.
- *
- * Deprecated: 0.10.36: Don't use this, it's not needed any longer.
- */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_CLASS_UNLOCK(obj) (g_static_rec_mutex_unlock(GST_CLASS_GET_LOCK(obj)))
-#endif
-
-/**
* GstObjectClass:
* @parent_class: parent
* @path_string_separator: separator used by gst_object_get_path_string()
- * @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
- * @object_saved: default signal handler
* @deep_notify: default signal handler
- * @save_thyself: xml serialisation
- * @restore_thyself: xml de-serialisation
*
* GStreamer base object class.
*/
struct _GstObjectClass {
- GObjectClass parent_class;
+ GInitiallyUnownedClass parent_class;
const gchar *path_string_separator;
- GObject *signal_object;
-
- /* FIXME-0.11: remove this, plus the above GST_CLASS_*_LOCK macros */
- GStaticRecMutex *lock;
/* 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);
- /* FIXME 0.11: Remove this, it's deprecated */
- void (*object_saved) (GstObject * object, GstXmlNodePtr parent);
void (*deep_notify) (GstObject * object, GstObject * orig, GParamSpec * pspec);
/*< public >*/
/* virtual methods for subclasses */
- /* FIXME 0.11: Remove this, it's deprecated */
- GstXmlNodePtr (*save_thyself) (GstObject * object, GstXmlNodePtr parent);
- void (*restore_thyself) (GstObject * object, GstXmlNodePtr self);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* normal GObject stuff */
+
+GST_API
GType gst_object_get_type (void);
/* name routines */
+
+GST_API
gboolean gst_object_set_name (GstObject *object, const gchar *name);
-gchar* gst_object_get_name (GstObject *object);
-#ifndef GST_DISABLE_DEPRECATED
-void gst_object_set_name_prefix (GstObject *object, const gchar *name_prefix);
-gchar* gst_object_get_name_prefix (GstObject *object);
-#endif
+GST_API
+gchar* gst_object_get_name (GstObject *object);
/* parentage routines */
+
+GST_API
gboolean gst_object_set_parent (GstObject *object, GstObject *parent);
+
+GST_API
GstObject* gst_object_get_parent (GstObject *object);
+
+GST_API
void gst_object_unparent (GstObject *object);
+
+GST_API
+gboolean gst_object_has_as_parent (GstObject *object, GstObject *parent);
+
+GST_API
+gboolean gst_object_has_as_ancestor (GstObject *object, GstObject *ancestor);
+
+GST_DEPRECATED_FOR(gst_object_has_as_ancestor)
gboolean gst_object_has_ancestor (GstObject *object, GstObject *ancestor);
-void gst_object_default_deep_notify (GObject *object, GstObject *orig,
+GST_API
+void gst_object_default_deep_notify (GObject *object, GstObject *orig,
GParamSpec *pspec, gchar **excluded_props);
/* refcounting + life cycle */
+
+GST_API
gpointer gst_object_ref (gpointer object);
+
+GST_API
void gst_object_unref (gpointer object);
-void gst_object_ref_sink (gpointer object);
-void gst_object_sink (gpointer object);
+
+GST_API
+void gst_clear_object (GstObject **object_ptr);
+#define gst_clear_object(object_ptr) g_clear_pointer ((object_ptr), gst_object_unref)
+
+GST_API
+gpointer gst_object_ref_sink (gpointer object);
/* replace object pointer */
-void gst_object_replace (GstObject **oldobj, GstObject *newobj);
+
+GST_API
+gboolean gst_object_replace (GstObject **oldobj, GstObject *newobj);
/* printing out the 'path' of the object */
+
+GST_API
gchar * gst_object_get_path_string (GstObject *object);
/* misc utils */
+
+GST_API
gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
-/* load/save */
-#ifndef GST_DISABLE_DEPRECATED
-#ifndef GST_DISABLE_LOADSAVE
-GstXmlNodePtr gst_object_save_thyself (GstObject *object, GstXmlNodePtr parent);
-void gst_object_restore_thyself (GstObject *object, GstXmlNodePtr self);
-#else
-#if defined __GNUC__ && __GNUC__ >= 3
-#pragma GCC poison gst_object_save_thyself
-#pragma GCC poison gst_object_restore_thyself
-#endif
-#endif
-#endif
+/* controller functions */
+#include <gst/gstcontrolbinding.h>
+#include <gst/gstcontrolsource.h>
-/* class signal stuff */
-guint gst_class_signal_connect (GstObjectClass *klass,
- const gchar *name,
- gpointer func,
- gpointer func_data);
-
-#ifndef GST_DISABLE_DEPRECATED
-#ifndef GST_DISABLE_LOADSAVE
-void gst_class_signal_emit_by_name (GstObject * object,
- const gchar * name,
- GstXmlNodePtr self);
-#else
-#if defined __GNUC__ && __GNUC__ >= 3
-#pragma GCC poison gst_class_signal_emit_by_name
-#endif
-#endif
+GST_API
+GstClockTime gst_object_suggest_next_sync (GstObject * object);
+
+GST_API
+gboolean gst_object_sync_values (GstObject * object, GstClockTime timestamp);
+
+GST_API
+gboolean gst_object_has_active_control_bindings (GstObject *object);
+
+GST_API
+void gst_object_set_control_bindings_disabled (GstObject *object, gboolean disabled);
+
+GST_API
+void gst_object_set_control_binding_disabled (GstObject *object,
+ const gchar * property_name,
+ gboolean disabled);
+
+GST_API
+gboolean gst_object_add_control_binding (GstObject * object, GstControlBinding * binding);
+
+GST_API
+GstControlBinding *
+ gst_object_get_control_binding (GstObject *object, const gchar * property_name);
+
+GST_API
+gboolean gst_object_remove_control_binding (GstObject * object, GstControlBinding * binding);
+
+GST_API
+GValue * gst_object_get_value (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp);
+GST_API
+gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp, GstClockTime interval,
+ guint n_values, gpointer values);
+GST_API
+gboolean gst_object_get_g_value_array (GstObject * object, const gchar * property_name,
+ GstClockTime timestamp, GstClockTime interval,
+ guint n_values, GValue *values);
+GST_API
+GstClockTime gst_object_get_control_rate (GstObject * object);
+
+GST_API
+void gst_object_set_control_rate (GstObject * object, GstClockTime control_rate);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstObject, gst_object_unref)
#endif
G_END_DECLS