Problem setting textoverlay properties in Rust

Sebastian Dröge sebastian at
Wed Dec 28 08:21:31 UTC 2022


On Wed, 2022-12-28 at 00:14 -0800, Guru Govindan via gstreamer-devel
> I am trying to set some clockoverlay/textoverlay on my video in rust
> in a dynamic pipeline.
> I am having issues setting the property of the element specifically
> valignment and halignment.
> It seems to not like either string (which is what we set in a command
> line pipeline) or as an integer.
> I get the following error
> ```
> thread 'main' panicked at 'called `Result::unwrap()` on an `Err`
> value: BoolError { message: "property 'valignment' of type
> 'GstClockOverlay' can't be set from the given type (expected:
> 'GstBaseTextOverlayVAlign', got: 'gchararray')", filename:
> "/home/ggovindan/.cargo/git/checkouts/gtk-rs-core-
> 7be42ca38bd6361c/0afcb34/glib/src/", function:
> "glib::object", line: 3475 }',
> /home/ggovindan/.cargo/git/checkouts/gtk-rs-core-
> 7be42ca38bd6361c/0afcb34/glib/src/
> note: run with `RUST_BACKTRACE=1` environment variable to display a
> backtrace
> ```

As the error suggests, the property is not of a string type
("gchararray") but a specific enum.
You can use e.g.
  clockoverlay.set_property_from_str("valignment", "bottom")
or make use of the glib EnumClass API.

Also in your code the `to_string()` calls are not needed.

Sebastian Dröge, Centricular Ltd ·
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list