Problem setting textoverlay properties in Rust

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


Hi!

On Wed, 2022-12-28 at 00:14 -0800, Guru Govindan via gstreamer-devel
wrote:
> 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/object.rs", function:
> "glib::object", line: 3475 }',
> /home/ggovindan/.cargo/git/checkouts/gtk-rs-core-
> 7be42ca38bd6361c/0afcb34/glib/src/object.rs:2372:53
> 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 · https://www.centricular.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20221228/34c7850b/attachment.htm>


More information about the gstreamer-devel mailing list