[gst-devel] why is gst_element_class_set_details only for use in base_init function?

Shixin Zeng zeng.shixin at gmail.com
Fri Oct 26 06:59:21 CEST 2007


Hi, all

When I'm trying to write a source element, I read this on the
documentation of the gst_element_class_set_details. I'm a bit
confused. As far as I understand, in Gobject system, base_init is used
for dynamic data member initialization. However, the field "details"
in GstElementClass is not a dynamic allocated space, so it should be
initialized in class_init function instead of base_init function.

For example, a class A derived from GstElement, then when class A is
registered, it will involve:
1. Allocate space
2. call GstElement's base_init
3. call A's base_init, /* it calls gst_element_class_set_details to
set the field "details" */
4. call A's class_init

Now, another B is derived from A, then the sequence will be like:
1. Allocate space,
2. call A's base_init; /* set field "details" as mentioned above */
3. call B's base_init; /* set filed "details" again */
4. call B's class_init

So, apparently, "details" was set twice in case of B. However, if we
call gst_element_class_set_details, this kind of redundancy can be
avoid. So, any particular reason why this function should be call in
base_init instead of class_init?

Thanks.
-- 
Best Regards

Shixin Zeng




More information about the gstreamer-devel mailing list