比较重要的一个宏定义
#define GST_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \
\
static void type_as_function ## _base_init (gpointer g_class); \
static void type_as_function ## _class_init (type ## Class *g_class);\
static void type_as_function ## _init (type *object, \
type ## Class *g_class);\
static parent_type ## Class *parent_class = NULL; \
static void \
type_as_function ## _class_init_trampoline (gpointer g_class, \
gpointer data) \
{ \
parent_class = (parent_type ## Class *) \
g_type_class_peek_parent (g_class); \
type_as_function ## _class_init ((type ## Class *)g_class); \
} \
\
GType type_as_function ## _get_type (void); \
\
GType \
type_as_function ## _get_type (void) \
{ \
static GType object_type = 0; \
if (G_UNLIKELY (object_type == 0)) { \
static const GTypeInfo object_info = { \
sizeof (type ## Class), \
type_as_function ## _base_init, \
NULL, /* base_finalize */ \
type_as_function ## _class_init_trampoline, \
NULL, /* class_finalize */ \
NULL, /* class_data */ \
sizeof (type), \
0, /* n_preallocs */ \
(GInstanceInitFunc) type_as_function ## _init \
}; \
object_type = g_type_register_static (parent_type_macro, #type, \
&object_info, (GTypeFlags) 0); \
additional_initializations (object_type); \
} \
return object_type; \
}
./gstreamer-0.10.x/plugins/elements/gstelements.c
static struct _elements_entry _elements[] = {
{"capsfilter", GST_RANK_NONE, gst_capsfilter_get_type},
...
{"filesrc", GST_RANK_PRIMARY, gst_file_src_get_type},
...
{"filesink", GST_RANK_PRIMARY, gst_file_sink_get_type},
{NULL, 0},
};
最基本的有些元件
阅读(1242) | 评论(0) | 转发(0) |