diff --git a/gst/gstutils.h b/gst/gstutils.h
index a746913dd2dcf591aa70d154c3c486ce890fb9de..fef1f9d9c88e013896a54a1cf206de9dfaebde96 100644 (file)
--- a/gst/gstutils.h
+++ b/gst/gstutils.h
/* Macros for defining classes. Ideas taken from Bonobo, which took theirs
from Nautilus and GOB. */
+#define GST_BOILERPLATE_QUARK(type, type_as_function) \
+GQuark \
+type_as_function ## _get_type (void) \
+{ \
+ static gsize quark_gonce = 0; \
+ if (g_once_init_enter (&quark_gonce)) { \
+ gsize quark; \
+ quark = (gsize) g_quark_from_static_string (#type);\
+ g_once_init_leave (&quark_gonce, quark); \
+ } \
+ return (GQuark) quark_gonce; \
+}
+
+#define GST_BOILERPLATE_MINI_OBJECT(type, type_as_function) \
+static void type_as_function ## _class_init (type ## Class *g_class); \
+GType \
+type_as_function ## _get_type (void) \
+{ \
+ static volatile gsize type_id = 0; \
+ if (g_once_init_enter (&type_id)) { \
+ GType new_type_id = g_type_register_static_simple ( \
+ GST_TYPE_MINI_OBJECT, \
+ g_intern_static_string (#type), \
+ sizeof (type ## Class), \
+ (GClassInitFunc) type_as_function ## _class_init, \
+ sizeof (type), \
+ NULL, \
+ (GTypeFlags) 0); \
+ g_once_init_leave (&type_id, new_type_id); \
+ } \
+ return type_id; \
+}
+
+
/**
* GST_BOILERPLATE_FULL:
* @type: the name of the type struct