gstreamer/gst/gstobject.h

198 lines
6.8 KiB
C
Raw Normal View History

/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2004 Wim Taymans <wim@fluendo.com>
*
* gstobject.h: Header for base GstObject
*
* 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__
#include <gst/gstconfig.h>
#include <glib-object.h> /* note that this gets wrapped in __GST_OBJECT_H__ */
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
#include <gst/gstatomic.h>
#include <gst/gsttypes.h>
G_BEGIN_DECLS
GST_EXPORT GType _gst_object_type;
#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))
#define GST_OBJECT_CAST(obj) ((GstObject*)(obj))
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
#define GST_OBJECT_CLASS_CAST(klass) ((GstObjectClass*)(klass))
/* 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
typedef enum
{
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
GST_OBJECT_DISPOSING = 0,
GST_OBJECT_DESTROYED = 1,
GST_OBJECT_FLOATING,
GST_OBJECT_FLAG_LAST = 4
} GstObjectFlags;
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
#define GST_OBJECT_REFCOUNT(caps) ((GST_OBJECT_CAST(caps))->refcount)
#define GST_OBJECT_REFCOUNT_VALUE(caps) (gst_atomic_int_read (&(GST_OBJECT_CAST(caps))->refcount))
/* we do a GST_OBJECT_CAST to avoid type checking, better call these
* function with a valid object! */
#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))
#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)
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +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)
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
#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
#define GST_OBJECT_IS_DESTROYED(obj) (GST_FLAG_IS_SET (obj, GST_OBJECT_DESTROYED))
#define GST_OBJECT_IS_FLOATING(obj) (GST_FLAG_IS_SET (obj, GST_OBJECT_FLOATING))
struct _GstObject {
GObject object;
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
/*< public >*/
GstAtomicInt refcount;
/*< public >*/ /* with LOCK */
GMutex *lock; /* object LOCK */
gchar *name; /* object name */
GstObject *parent; /* this object's parent, weak ref */
guint32 flags;
/* FIXME: in padding, move on up */
gchar *name_prefix; /* used for debugging */
/*< private >*/
gpointer _gst_reserved[GST_PADDING - 1];
};
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
#define GST_CLASS_LOCK(obj) (g_mutex_lock(GST_OBJECT_CLASS_CAST(obj)->lock))
#define GST_CLASS_TRYLOCK(obj) (g_mutex_trylock(GST_OBJECT_CLASS_CAST(obj)->lock))
#define GST_CLASS_UNLOCK(obj) (g_mutex_unlock(GST_OBJECT_CLASS_CAST(obj)->lock))
#define GST_CLASS_GET_LOCK(obj) (GST_OBJECT_CLASS_CAST(obj)->lock)
/* signal_object is used to signal to the whole class */
struct _GstObjectClass {
GObjectClass parent_class;
gchar *path_string_separator;
GObject *signal_object;
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
GMutex *lock;
/* signals */
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);
/* vtable */
void (*destroy) (GstObject *object);
xmlNodePtr (*save_thyself) (GstObject *object, xmlNodePtr parent);
void (*restore_thyself) (GstObject *object, xmlNodePtr self);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* normal GObject stuff */
GType gst_object_get_type (void);
/* name routines */
gboolean gst_object_set_name (GstObject *object, const gchar *name_prefix);
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);
/* parentage routines */
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
gboolean gst_object_set_parent (GstObject *object, GstObject *parent);
GstObject* gst_object_get_parent (GstObject *object);
void gst_object_unparent (GstObject *object);
void gst_object_default_deep_notify (GObject *object, GstObject *orig,
GParamSpec *pspec, gchar **excluded_props);
/* refcounting + life cycle */
GstObject * gst_object_ref (GstObject *object);
More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Original commit message from CVS: * docs/design/part-MT-refcounting.txt: * docs/design/part-conventions.txt: * gst/gstbin.c: (gst_bin_set_index), (gst_bin_set_clock), (gst_bin_add_func), (gst_bin_remove_func), (gst_bin_iterate_elements), (gst_bin_change_state), (gst_bin_dispose), (gst_bin_get_by_name_recurse_up): * gst/gstcaps.c: * gst/gstelement.c: (gst_element_add_pad), (gst_element_remove_pad), (pad_compare_name), (gst_element_get_static_pad), (gst_element_get_request_pad), (gst_element_get_pad), (gst_element_iterate_pads), (gst_element_class_get_pad_template_list), (gst_element_class_get_pad_template), (gst_element_get_random_pad), (gst_element_get_event_masks), (gst_element_send_event), (gst_element_seek), (gst_element_get_query_types), (gst_element_query), (gst_element_get_formats), (gst_element_convert), (gst_element_post_message), (gst_element_set_locked_state), (gst_element_get_state), (gst_element_set_state), (gst_element_pads_activate), (gst_element_dispose), (gst_element_set_manager_func), (gst_element_get_manager): * gst/gstelement.h: * gst/gstiterator.c: (gst_iterator_new), (gst_list_iterator_next), (gst_list_iterator_resync), (gst_list_iterator_free), (gst_iterator_new_list): * gst/gstiterator.h: * gst/gstmessage.c: (_gst_message_copy): * gst/gstobject.c: (gst_object_class_init), (gst_object_init), (gst_object_ref), (gst_object_unref), (gst_object_sink), (gst_object_replace), (gst_object_dispose), (gst_object_dispatch_properties_changed), (gst_object_set_name), (gst_object_set_parent), (gst_object_get_parent), (gst_object_unparent), (gst_object_check_uniqueness), (gst_object_get_path_string): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_dispose), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_unlink), (gst_pad_is_linked), (gst_pad_link_prepare_filtered), (gst_pad_link_filtered), (gst_pad_get_real_parent), (gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_get_allowed_caps), (gst_pad_alloc_buffer), (gst_pad_push), (gst_pad_pull), (gst_pad_pull_range), (gst_pad_push_event): * gst/gstpad.h: * gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose), (is_eos), (pipeline_bus_handler): * gst/gstutils.c: (gst_element_get_compatible_pad_filtered), (gst_element_link_pads_filtered), (gst_element_unlink): * gst/parse/grammar.y: * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_pad_info): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (print_element_info): More MT fixes, added design document describing refcounting policies used in GStreamer and locking involved. Fixed unsafe ghostpad dereffing. Removed old unsafe methods.
2004-12-13 11:33:55 +00:00
GstObject * gst_object_unref (GstObject *object);
void gst_object_sink (GstObject *object);
/* 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 */
gboolean gst_object_check_uniqueness (GList *list, const gchar *name);
/* load/save */
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
xmlNodePtr gst_object_save_thyself (GstObject *object, xmlNodePtr parent);
void gst_object_restore_thyself (GstObject *object, xmlNodePtr self);
#else
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_object_save_thyself
#pragma GCC poison gst_object_restore_thyself
#endif
#endif
/* class signal stuff */
guint gst_class_signal_connect (GstObjectClass *klass,
const gchar *name,
gpointer func,
gpointer func_data);
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
void gst_class_signal_emit_by_name (GstObject *object,
const gchar *name,
xmlNodePtr self);
#else
#if defined _GNUC_ && _GNUC_ >= 3
#pragma GCC poison gst_class_signal_emit_by_name
#endif
#endif
G_END_DECLS
#endif /* __GST_OBJECT_H__ */