2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
2005-03-07 18:27:42 +00:00
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
2000-12-28 22:12:02 +00:00
|
|
|
*
|
|
|
|
* gstobject.h: Header for base GstObject
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_OBJECT_H__
|
|
|
|
#define __GST_OBJECT_H__
|
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#include <gst/gstconfig.h>
|
2001-06-25 01:20:11 +00:00
|
|
|
|
2005-07-18 12:49:53 +00:00
|
|
|
#include <glib-object.h>
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2004-06-13 10:04:12 +00:00
|
|
|
GST_EXPORT GType _gst_object_type;
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2003-12-13 16:58:29 +00:00
|
|
|
#define GST_TYPE_OBJECT (_gst_object_type)
|
|
|
|
#define GST_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OBJECT))
|
|
|
|
#define GST_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_OBJECT))
|
|
|
|
#define GST_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OBJECT, GstObjectClass))
|
|
|
|
#define GST_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OBJECT, GstObject))
|
|
|
|
#define GST_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_OBJECT, GstObjectClass))
|
2005-03-07 18:27:42 +00:00
|
|
|
#define GST_OBJECT_CAST(obj) ((GstObject*)(obj))
|
|
|
|
#define GST_OBJECT_CLASS_CAST(klass) ((GstObjectClass*)(klass))
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2003-02-10 20:32:32 +00:00
|
|
|
/* make sure we don't change the object size but stil make it compile
|
|
|
|
* without libxml */
|
|
|
|
#ifdef GST_DISABLE_LOADSAVE_REGISTRY
|
|
|
|
#define xmlNodePtr gpointer
|
|
|
|
#endif
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_OBJECT_DISPOSING = 0,
|
|
|
|
GST_OBJECT_FLOATING,
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
GST_OBJECT_FLAG_LAST = 4
|
|
|
|
} GstObjectFlags;
|
2000-12-15 01:57:34 +00:00
|
|
|
|
2005-09-20 11:09:50 +00:00
|
|
|
#ifdef GST_HAVE_GLIB_2_8
|
|
|
|
#define GST_OBJECT_REFCOUNT(obj) (((GObject*)(obj))->ref_count)
|
|
|
|
#define GST_OBJECT_REFCOUNT_VALUE(obj) (g_atomic_int_get (&((GObject*)(obj))->ref_count))
|
|
|
|
#else
|
2005-06-08 13:41:31 +00:00
|
|
|
#define GST_OBJECT_REFCOUNT(obj) ((GST_OBJECT_CAST(obj))->refcount)
|
|
|
|
#define GST_OBJECT_REFCOUNT_VALUE(obj) (g_atomic_int_get (&(GST_OBJECT_CAST(obj))->refcount))
|
2005-09-20 11:09:50 +00:00
|
|
|
#endif /* GST_HAVE_GLIB_2_8 */
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
/* we do a GST_OBJECT_CAST to avoid type checking, better call these
|
|
|
|
* function with a valid object! */
|
2005-06-29 11:10:44 +00:00
|
|
|
#define GST_LOCK(obj) g_mutex_lock(GST_OBJECT_CAST(obj)->lock)
|
|
|
|
#define GST_TRYLOCK(obj) g_mutex_trylock(GST_OBJECT_CAST(obj)->lock)
|
|
|
|
#define GST_UNLOCK(obj) g_mutex_unlock(GST_OBJECT_CAST(obj)->lock)
|
2005-03-07 18:27:42 +00:00
|
|
|
#define GST_GET_LOCK(obj) (GST_OBJECT_CAST(obj)->lock)
|
|
|
|
|
|
|
|
#define GST_OBJECT_NAME(obj) (GST_OBJECT_CAST(obj)->name)
|
|
|
|
#define GST_OBJECT_PARENT(obj) (GST_OBJECT_CAST(obj)->parent)
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* for the flags we double-not to make them comparable to TRUE and FALSE */
|
|
|
|
#define GST_FLAGS(obj) (GST_OBJECT_CAST (obj)->flags)
|
|
|
|
#define GST_FLAG_IS_SET(obj,flag) (!!(GST_FLAGS (obj) & (1<<(flag))))
|
|
|
|
#define GST_FLAG_SET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) |= (1<<(flag))); }G_STMT_END
|
|
|
|
#define GST_FLAG_UNSET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) &= ~(1<<(flag))); }G_STMT_END
|
2000-01-30 09:03:00 +00:00
|
|
|
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
#define GST_OBJECT_IS_DISPOSING(obj) (GST_FLAG_IS_SET (obj, GST_OBJECT_DISPOSING))
|
2005-03-07 18:27:42 +00:00
|
|
|
#define GST_OBJECT_IS_FLOATING(obj) (GST_FLAG_IS_SET (obj, GST_OBJECT_FLOATING))
|
|
|
|
|
2005-07-18 12:49:53 +00:00
|
|
|
typedef struct _GstObject GstObject;
|
|
|
|
typedef struct _GstObjectClass GstObjectClass;
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
struct _GstObject {
|
|
|
|
GObject object;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/*< public >*/
|
2005-09-20 11:09:50 +00:00
|
|
|
gint refcount; /* only used ifndef GST_HAVE_GLIB_0_8 */
|
2003-10-07 21:58:42 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/*< public >*/ /* with LOCK */
|
|
|
|
GMutex *lock; /* object LOCK */
|
|
|
|
gchar *name; /* object name */
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
gchar *name_prefix; /* used for debugging */
|
2005-03-07 18:27:42 +00:00
|
|
|
GstObject *parent; /* this object's parent, weak ref */
|
|
|
|
guint32 flags;
|
|
|
|
|
|
|
|
/*< private >*/
|
2003-12-09 02:39:31 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2005-06-23 15:04:48 +00:00
|
|
|
#define GST_CLASS_LOCK(obj) (g_static_rec_mutex_lock(GST_OBJECT_CLASS_CAST(obj)->lock))
|
|
|
|
#define GST_CLASS_TRYLOCK(obj) (g_static_rec_mutex_trylock(GST_OBJECT_CLASS_CAST(obj)->lock))
|
|
|
|
#define GST_CLASS_UNLOCK(obj) (g_static_rec_mutex_unlock(GST_OBJECT_CLASS_CAST(obj)->lock))
|
2005-03-07 18:27:42 +00:00
|
|
|
#define GST_CLASS_GET_LOCK(obj) (GST_OBJECT_CLASS_CAST(obj)->lock)
|
|
|
|
|
2002-04-12 09:38:47 +00:00
|
|
|
/* signal_object is used to signal to the whole class */
|
2004-03-15 14:43:35 +00:00
|
|
|
struct _GstObjectClass {
|
|
|
|
GObjectClass parent_class;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
gchar *path_string_separator;
|
|
|
|
GObject *signal_object;
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2005-06-23 15:04:48 +00:00
|
|
|
GStaticRecMutex *lock;
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/* signals */
|
2004-03-15 14:43:35 +00:00
|
|
|
void (*parent_set) (GstObject *object, GstObject *parent);
|
|
|
|
void (*parent_unset) (GstObject *object, GstObject *parent);
|
|
|
|
void (*object_saved) (GstObject *object, xmlNodePtr parent);
|
|
|
|
void (*deep_notify) (GstObject *object, GstObject *orig, GParamSpec *pspec);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* vtable */
|
2004-03-15 14:43:35 +00:00
|
|
|
xmlNodePtr (*save_thyself) (GstObject *object, xmlNodePtr parent);
|
|
|
|
void (*restore_thyself) (GstObject *object, xmlNodePtr self);
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/*< private >*/
|
2003-12-09 02:39:31 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
/* normal GObject stuff */
|
2004-03-15 14:43:35 +00:00
|
|
|
GType gst_object_get_type (void);
|
2001-01-29 00:06:02 +00:00
|
|
|
|
|
|
|
/* name routines */
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean gst_object_set_name (GstObject *object, const gchar *name);
|
Bump version number, we're now 0.9.0
Original commit message from CVS:
* configure.ac:
* gst/gst_private.h:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove),
(gst_bin_get_by_name_recurse_up):
* gst/gstclock.c: (gst_clock_id_ref), (gst_clock_id_unref),
(gst_clock_id_compare_func), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_init),
(gst_clock_adjust_unlocked), (gst_clock_get_time):
* gst/gstelement.h:
* gst/gstinfo.c: (_gst_debug_init):
* gst/gstobject.h:
* gst/gstpad.c: (_gst_pad_default_fixate_foreach),
(gst_pad_collectv), (gst_pad_collect_valist), (gst_pad_query):
* gst/gstpad.h:
Bump version number, we're now 0.9.0
Add future debugging category.
Fix NULL _unref() in _get_by_name_recurse_up
Rearrange gstpad.h.
Update some docs.
2005-03-09 11:08:18 +00:00
|
|
|
gchar* gst_object_get_name (GstObject *object);
|
|
|
|
void gst_object_set_name_prefix (GstObject *object, const gchar *name_prefix);
|
|
|
|
gchar* gst_object_get_name_prefix (GstObject *object);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* parentage routines */
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean gst_object_set_parent (GstObject *object, GstObject *parent);
|
2004-03-15 14:43:35 +00:00
|
|
|
GstObject* gst_object_get_parent (GstObject *object);
|
|
|
|
void gst_object_unparent (GstObject *object);
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_object_default_deep_notify (GObject *object, GstObject *orig,
|
Bump version number, we're now 0.9.0
Original commit message from CVS:
* configure.ac:
* gst/gst_private.h:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove),
(gst_bin_get_by_name_recurse_up):
* gst/gstclock.c: (gst_clock_id_ref), (gst_clock_id_unref),
(gst_clock_id_compare_func), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_init),
(gst_clock_adjust_unlocked), (gst_clock_get_time):
* gst/gstelement.h:
* gst/gstinfo.c: (_gst_debug_init):
* gst/gstobject.h:
* gst/gstpad.c: (_gst_pad_default_fixate_foreach),
(gst_pad_collectv), (gst_pad_collect_valist), (gst_pad_query):
* gst/gstpad.h:
Bump version number, we're now 0.9.0
Add future debugging category.
Fix NULL _unref() in _get_by_name_recurse_up
Rearrange gstpad.h.
Update some docs.
2005-03-09 11:08:18 +00:00
|
|
|
GParamSpec *pspec, gchar **excluded_props);
|
2002-11-02 13:19:30 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* refcounting + life cycle */
|
2005-06-28 09:17:14 +00:00
|
|
|
gpointer gst_object_ref (gpointer object);
|
|
|
|
void gst_object_unref (gpointer object);
|
|
|
|
void gst_object_sink (gpointer object);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
/* replace object pointer */
|
|
|
|
void gst_object_replace (GstObject **oldobj, GstObject *newobj);
|
|
|
|
|
|
|
|
/* printing out the 'path' of the object */
|
|
|
|
gchar * gst_object_get_path_string (GstObject *object);
|
|
|
|
|
|
|
|
/* misc utils */
|
2004-03-15 14:43:35 +00:00
|
|
|
gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* load/save */
|
2001-10-17 10:21:27 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
|
2004-03-15 14:43:35 +00:00
|
|
|
xmlNodePtr gst_object_save_thyself (GstObject *object, xmlNodePtr parent);
|
|
|
|
void gst_object_restore_thyself (GstObject *object, xmlNodePtr self);
|
2001-06-25 06:45:56 +00:00
|
|
|
#else
|
2004-07-03 04:59:12 +00:00
|
|
|
#if defined _GNUC_ && _GNUC_ >= 3
|
2001-06-25 06:45:56 +00:00
|
|
|
#pragma GCC poison gst_object_save_thyself
|
2001-10-17 10:21:27 +00:00
|
|
|
#pragma GCC poison gst_object_restore_thyself
|
2001-06-24 21:18:28 +00:00
|
|
|
#endif
|
2004-07-03 04:59:12 +00:00
|
|
|
#endif
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* class signal stuff */
|
2004-03-15 14:43:35 +00:00
|
|
|
guint gst_class_signal_connect (GstObjectClass *klass,
|
|
|
|
const gchar *name,
|
|
|
|
gpointer func,
|
|
|
|
gpointer func_data);
|
2001-01-30 23:53:04 +00:00
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_class_signal_emit_by_name (GstObject *object,
|
|
|
|
const gchar *name,
|
|
|
|
xmlNodePtr self);
|
2001-06-25 17:17:30 +00:00
|
|
|
#else
|
2004-07-03 04:59:12 +00:00
|
|
|
#if defined _GNUC_ && _GNUC_ >= 3
|
2001-06-25 06:45:56 +00:00
|
|
|
#pragma GCC poison gst_class_signal_emit_by_name
|
2001-06-24 21:18:28 +00:00
|
|
|
#endif
|
2004-07-03 04:59:12 +00:00
|
|
|
#endif
|
2001-01-30 23:53:04 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_END_DECLS
|
2004-03-15 14:43:35 +00:00
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
#endif /* __GST_OBJECT_H__ */
|
2004-03-15 14:43:35 +00:00
|
|
|
|