I’m encountering an issue with a GStreamer plugin that drives my camera, as discussed in this issue.
The maintainer suggested that I need to access the property of the child element through the child proxy. However, I’m having trouble finding an example or the correct syntax for using the child proxy. I’d to to something like:
let pylonsrc = gst::ElementFactory::make("pylonsrc")
.property("device-index", 0)
.build()
.unwrap();
pylonsrc.set_child_property("cam::ExposureAuto", 0);
Could someone provide guidance or an example of how to correctly use the child proxy to set properties on the child element?
This compiles but the value doesn’t have the right type and can’t be set
let child_proxy = pylonsrc.clone().dynamic_cast::<ChildProxy>().unwrap();
child_proxy.set_child_property("cam::ExposureAuto", 0);
So I had to do this:
let child_proxy = pylonsrc.clone().dynamic_cast::<ChildProxy>().unwrap();
let cam = child_proxy.child_by_name("cam").unwrap();
cam.set_property_from_str("ExposureAuto", "Once");
That property seems to be not an integer but some kind of enum. You either need to use a correctly-typed value with set_child_property() (just like with set_property()), or use the str-based property setters.
Unfortunately there’s none on the childproxy yet, so you’d need to use lookup() to find the "cam" child and then use cam.set_property_from_str("ExposureAuto", "string representation of that enum").
I’ll add convenience API to childproxy for that now.