how does a (custom) elements specific data get initialised ?

Michael Gruner michael.gruner at ridgerun.com
Tue Mar 1 15:03:47 UTC 2022


Hey Tom

GStreamer elements are GObjects under the hood. Here’s a summary of the GObject lifycicle:

https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gobject/howto-gobject.html <https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gobject/howto-gobject.html>

The constructor you’re looking for is gst_my_filter_init(). You want to initialize your struct there (or call your constructor).

Michael

> On 1 Mar 2022, at 04:32, tom via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
> 
> In https://gstreamer.freedesktop.org/documentation/plugin-development/basics/boiler.html?gi-language=c <https://gstreamer.freedesktop.org/documentation/plugin-development/basics/boiler.html?gi-language=c>
> 
> there is a structure that contains information of a particular instance of an element:
> (GstMyFilter)
> 
> which later on in the tutorial gets used in for example:
> 
> static gboolean
> gst_my_filter_sink_event (GstPad    *pad,
>                   GstObject *parent,
>                   GstEvent  *event)
> {
>   GstMyFilter *filter = GST_MY_FILTER (parent);
> 
> but where does the structure 'GstMyFilter' get initialised ?
> 
> I'm asking because i've added a default constructor in my structure, but it never gets called, but somehow the structure is initialised with 0's 
> 
> how can I ensure that the data structure's constructor is used ?
> 
> kind regards,
> tom

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220301/005c2c33/attachment.htm>


More information about the gstreamer-devel mailing list