[rust] waylandsink with video overlay

Joel Winarske joel.winarske at gmail.com
Thu Jan 28 17:54:00 UTC 2021


Works great, thank you!

On Thu, Jan 28, 2021 at 9:26 AM Sebastian Dröge <sebastian at centricular.com>
wrote:

> On Thu, 2021-01-28 at 08:57 -0800, Joel Winarske wrote:
> >
> > I'm down to
> https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L59-L72
> >
> > error[E0277]: the trait bound `Value: SetValue` is not satisfied
> >   --> src/main.rs:70:25
> >    |
> > 70 |         s.set("handle", &value);
> >    |                         ^^^^^^ the trait `SetValue` is not
> implemented for `Value`
> >    |
> >    = note: required because of the requirements on the impl of
> `ToSendValue` for `Value`
>
> It indeed needs a bit more massaging. The following code should do it.
>
>     {
>         let context = context.get_mut().unwrap();
>         let s = context.get_mut_structure();
>         let value = unsafe {
>             use gst::glib::translate::*;
>             use std::mem;
>
>             let handle = display.c_ptr();
>             let mut value = mem::MaybeUninit::zeroed();
>             gst::gobject_sys::g_value_init(value.as_mut_ptr(),
> gst::gobject_sys::G_TYPE_POINTER);
>             gst::gobject_sys::g_value_set_pointer(value.as_mut_ptr(),
> handle as *mut c_void);
>             gst::glib::SendValue::from_glib_none(&value.assume_init() as
> *const _)
>         };
>         s.set_value("handle", value);
>     }
>
> Apart from everything else there's also the problem that you need to
> tell the type system that your value is actually thread-safe. So the
> easiest/shortest here is actually to just create the whole GValue like
> we would be doing in C.
>
> --
> Sebastian Dröge, Centricular Ltd · https://www.centricular.com
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210128/050c70f0/attachment-0001.htm>


More information about the gstreamer-devel mailing list