};
static GType _gst_buffer_list_type = 0;
-static GstMiniObjectClass *parent_class = NULL;
+
+G_DEFINE_TYPE (GstBufferList, gst_buffer_list, GST_TYPE_MINI_OBJECT);
void
_gst_buffer_list_initialize (void)
}
static void
-gst_buffer_list_init (GTypeInstance * instance, gpointer g_class)
+gst_buffer_list_init (GstBufferList * list)
{
- GstBufferList *list;
-
- list = (GstBufferList *) instance;
list->buffers = NULL;
GST_LOG ("init %p", list);
}
g_list_free (list->buffers);
- parent_class->finalize (GST_MINI_OBJECT_CAST (list));
+ GST_MINI_OBJECT_CLASS (gst_buffer_list_parent_class)->finalize
+ (GST_MINI_OBJECT_CAST (list));
}
static GstBufferList *
}
static void
-gst_buffer_list_class_init (gpointer g_class, gpointer class_data)
+gst_buffer_list_class_init (GstBufferListClass * list_class)
{
- GstBufferListClass *list_class = GST_BUFFER_LIST_CLASS (g_class);
-
- parent_class = g_type_class_peek_parent (g_class);
-
list_class->mini_object_class.copy =
(GstMiniObjectCopyFunction) _gst_buffer_list_copy;
list_class->mini_object_class.finalize =
return NULL;
}
-GType
-gst_buffer_list_get_type (void)
-{
- if (G_UNLIKELY (_gst_buffer_list_type == 0)) {
- static const GTypeInfo buffer_list_info = {
- sizeof (GstBufferListClass),
- NULL,
- NULL,
- gst_buffer_list_class_init,
- NULL,
- NULL,
- sizeof (GstBufferList),
- 0,
- gst_buffer_list_init,
- NULL
- };
-
- _gst_buffer_list_type = g_type_register_static (GST_TYPE_MINI_OBJECT,
- "GstBufferList", &buffer_list_info, 0);
- }
-
- return _gst_buffer_list_type;
-}
-
/**
* gst_buffer_list_iterate:
* @list: a #GstBufferList
GType
gst_mini_object_get_type (void)
{
- static GType _gst_mini_object_type = 0;
+ static volatile GType _gst_mini_object_type = 0;
- if (G_UNLIKELY (_gst_mini_object_type == 0)) {
+ if (g_once_init_enter (&_gst_mini_object_type)) {
+ GType _type;
static const GTypeValueTable value_table = {
gst_value_mini_object_init,
gst_value_mini_object_free,
G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE)
};
- _gst_mini_object_type = g_type_fundamental_next ();
- g_type_register_fundamental (_gst_mini_object_type, "GstMiniObject",
+ _type = g_type_fundamental_next ();
+ g_type_register_fundamental (_type, "GstMiniObject",
&mini_object_info, &mini_object_fundamental_info, G_TYPE_FLAG_ABSTRACT);
#ifndef GST_DISABLE_TRACE
- _gst_mini_object_trace =
- gst_alloc_trace_register (g_type_name (_gst_mini_object_type));
+ _gst_mini_object_trace = gst_alloc_trace_register (g_type_name (_type));
#endif
+ g_once_init_leave (&_gst_mini_object_type, _type);
}
return _gst_mini_object_type;
#define FUNC_VALUE_GET_TYPE(type, name) \
GType gst_ ## type ## _get_type (void) \
{ \
- static GType gst_ ## type ## _type = 0; \
+ static volatile GType gst_ ## type ## _type = 0; \
\
- if (G_UNLIKELY (gst_ ## type ## _type == 0)) { \
+ if (g_once_init_enter (&gst_ ## type ## _type)) { \
+ GType _type; \
_info.value_table = & _gst_ ## type ## _value_table; \
- gst_ ## type ## _type = g_type_register_fundamental ( \
+ _type = g_type_register_fundamental ( \
g_type_fundamental_next (), \
name, &_info, &_finfo, 0); \
+ g_once_init_leave(&gst_ ## type ## _type, _type); \
} \
\
return gst_ ## type ## _type; \