Posts

Showing posts from February, 2015

Forwarding GObject properties

First blog post! Let's get straight into it. While developing some cool new features for the GStreamer GL stack, I found the need to have GstBin contain the properties of a containing GstElement. Extra points if we can change the containing element and the GstBin properties react accordingly. Option 1 - manual forwarding The simplest and most boring solution, create subclasses with the necessary properties and forward to the relevant containing element. We should be able to do better than this. Option 2 - GParamSpecOverride The next option is to use g_param_spec_override which points the property to a property within another object. This comes with the advantage and pitfall that it's kinda supported by GLib directly but not thoroughly tested. /* should only called from an object's class_init function */ void install_properties_into_class_from_gtype (GObjectClass * self, GType type) { GObjectClass *class; GParamSpec ** props; GParamSpec ** ...