equal
deleted
inserted
replaced
49 |
49 |
50 |
50 |
51 GType |
51 GType |
52 gst_implements_interface_get_type (void) |
52 gst_implements_interface_get_type (void) |
53 { |
53 { |
54 static GType gst_interface_type = 0; |
54 static volatile gsize gst_interface_type = 0; |
55 |
55 |
56 if (!gst_interface_type) { |
56 if (g_once_init_enter (&gst_interface_type)) { |
|
57 GType _type; |
57 static const GTypeInfo gst_interface_info = { |
58 static const GTypeInfo gst_interface_info = { |
58 sizeof (GstImplementsInterfaceClass), |
59 sizeof (GstImplementsInterfaceClass), |
59 (GBaseInitFunc) gst_implements_interface_class_init, |
60 (GBaseInitFunc) gst_implements_interface_class_init, |
60 NULL, |
61 NULL, |
61 NULL, |
62 NULL, |
65 0, |
66 0, |
66 NULL, |
67 NULL, |
67 NULL |
68 NULL |
68 }; |
69 }; |
69 |
70 |
70 gst_interface_type = g_type_register_static (G_TYPE_INTERFACE, |
71 _type = g_type_register_static (G_TYPE_INTERFACE, |
71 "GstImplementsInterface", &gst_interface_info, 0); |
72 "GstImplementsInterface", &gst_interface_info, 0); |
72 |
73 |
73 g_type_interface_add_prerequisite (gst_interface_type, GST_TYPE_ELEMENT); |
74 g_type_interface_add_prerequisite (_type, GST_TYPE_ELEMENT); |
|
75 g_once_init_leave (&gst_interface_type, _type); |
74 } |
76 } |
75 |
77 |
76 return gst_interface_type; |
78 return gst_interface_type; |
77 } |
79 } |
78 |
80 |
186 |
188 |
187 |
189 |
188 gboolean |
190 gboolean |
189 gst_implements_interface_check (gpointer from, GType type) |
191 gst_implements_interface_check (gpointer from, GType type) |
190 { |
192 { |
191 GstImplementsInterface *iface; |
|
192 |
|
193 /* check cast, return FALSE if it fails, don't give a warning... */ |
193 /* check cast, return FALSE if it fails, don't give a warning... */ |
194 if (!G_TYPE_CHECK_INSTANCE_TYPE (from, type)) { |
194 if (!G_TYPE_CHECK_INSTANCE_TYPE (from, type)) { |
195 return FALSE; |
195 return FALSE; |
196 } |
196 } |
197 |
|
198 iface = G_TYPE_CHECK_INSTANCE_CAST (from, type, GstImplementsInterface); |
|
199 |
197 |
200 /* now, if we're an element (or derivative), is this thing |
198 /* now, if we're an element (or derivative), is this thing |
201 * actually implemented for real? */ |
199 * actually implemented for real? */ |
202 if (GST_IS_ELEMENT (from)) { |
200 if (GST_IS_ELEMENT (from)) { |
203 if (!gst_element_implements_interface (GST_ELEMENT (from), type)) { |
201 if (!gst_element_implements_interface (GST_ELEMENT (from), type)) { |