[gst-devel] why is gst_element_class_set_details only for use in base_init function?
Stefan Kost
ensonic at hora-obscura.de
Fri Oct 26 16:47:43 CEST 2007
hi,
Shixin Zeng schrieb:
> 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.
None of the baseclasses call gst_element_class_set_details and we don't subclass
finaly elements currently. Did you found a case where it actually happens twice.
I don't remember it there was technical reason for doing it in base_init
(registry or so). I will investigate.
Stefan
More information about the gstreamer-devel
mailing list