Problem setting textoverlay properties in Rust

Guru Govindan gurunathan.govindan at gmail.com
Wed Dec 28 08:14:07 UTC 2022


Hi,
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
```

I am able to reproduce it with the following example.
I am not sure which import I could use or how to wrap the enum to make the
int work with GstBaseTextOverlayVAlign

```
use gst::prelude::*;

fn main() {
    println!("Hello, world!");
    gst::init().unwrap();

    let str_pipe = format!("videotestsrc ! clockoverlay name=clockoverlay
valignment=bottom ! fakesink");

    let pipeline = gst::parse_launch(str_pipe.as_str()).unwrap();

    let pipe_bin = pipeline.downcast::<gst::Bin>().unwrap();

    let clockoverlay = pipe_bin.by_name("clockoverlay").unwrap();

   clockoverlay.set_property("valignment", "bottom".to_string());
   clockoverlay.set_property("halignment", "left".to_string());
}
```
I appreciate any help with this.
Thanks a lot!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20221228/72d9554a/attachment.htm>


More information about the gstreamer-devel mailing list