Access to public properties inside a custom plugin

Michael Gruner michael.gruner at ridgerun.com
Wed Apr 4 14:45:56 UTC 2018


Hi Jimmy

For gchar* properties, make sure you are saving the value set in your gst_my_plugin_set_property by calling g_value_dup_string instead of g_value_get_string. The convention is that when receiving a pointer the plug-in will save a reference or a copy of that memory. Otherwise your pointer may corrupt. Just be careful to handle these memories you now own to avoid leaks.

On the other hand, I’d just access the member in your struct directly. However be aware that properties are set in a different thread than the streaming thread (transform_ip) so you may want to serialize access to this variable. I’d call GST_OBJECT_LOCK/UNLOCK in the set property.

Michael
RidgeRun

> On Apr 4, 2018, at 08:34, De Pauw Jimmy <jimmy at dcode.eu> wrote:
> 
> Hello all,
> 
> This is probably more like a GLib issue but i have a problem with using gchar public properties inside the code of my own plugin.
> I have installed many properties following what i could find in the code of other plugins.
> 
> My problem occurs when i want to retrieve the value of a property inside one of the transformation function (transform_ip) or change_state.
> Whatever i want to retrieve is not initialized even though the set_property is properly called with the good value.
> 
> Am i supposed to call gst_my_plugin_get_property by myself or is there another function i need to call?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list