Impossible to find a GParamSpecOverride
Submitted by Youness Alaoui
I'm currently having an issue in finding the right GParamSpec for an overridden proprety. The GParamSpec needs to have a valid param_id, but it's only possible to get the redirect target which has param_id = 0.
The situation is the following. I'm implementing a GStreamer source element that implements the GstPhotography interface (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/GstPhotography.html). So, I need to override the interface's property by calling g_object_class_override_property. This will cause a new GParamSpecOverride to be created internally and added to the object type's GParamSpecPool. Now, at the same time, I also want to implement the GstPropertyProbe interface (http://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gst-plugins-base-libs-0.10/gst-plugins-base-libs-gstpropertyprobe.html) which allows us to probe for valid values of a property (useful for listing which devices are available, or in my case which zoom levels are supported by the camera).
The GstPropertyProbe interface will expect me to return a list of GParamSpec for the properties that support 'probing'. When a user probes the property, it will call my function with the property_id of the GParamSpec I gave it (pspec->param_id).
If I use g_object_class_find_property, I will get the overriden property which has param_id set to 0. If I call g_param_spec_get_redirect_target, it returns NULL since its purpose is to find the target of a GParamSpecOverride and not the other way around. If I call g_object_class_list_properties, then the list will also have the GParamSpecs with param_id=0, since the list gets pruned and the overriden and redirected specs are removed from the list. I've looked at the gparam.c and gobject.c code and couldn't find any way to get the property override or the param_id of an overriden property.
This forces me to either g_strcmp0 on the property name, or to store the result of the g_object_class_find_property and if/else over them. I cannot use a simple switch/case on the property id anymore.
Could we get the inverse function of g_param_spec_get_redirect_target? or a way to retreive the param_id of an overriden property for a specific owner_type? or to just be able to list all of the GParamSpec without the redirects being removed from the list?