[prev in list] [next in list] [prev in thread] [next in thread]
List: gstreamer-devel
Subject: Re: [rust] waylandsink with video overlay
From: Joel Winarske <joel.winarske () gmail ! com>
Date: 2021-01-28 17:54:00
Message-ID: CABKMkPJ3tn0NOD241EYvX+epr59qPgHhPN9XHq7Z2GU-pRpwOA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Works great, thank you!
On Thu, Jan 28, 2021 at 9:26 AM Sebastian Dröge <sebastian@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
[Attachment #5 (text/html)]
<div dir="ltr">Works great, thank you!<br></div><br><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">On Thu, Jan 28, 2021 at 9:26 AM Sebastian Dröge <<a \
href="mailto:sebastian@centricular.com">sebastian@centricular.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 2021-01-28 at \
08:57 -0800, Joel Winarske wrote:<br> > <br>
> I'm down to <a \
href="https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L59-L72" \
rel="noreferrer" target="_blank">https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L59-L72</a><br>
> <br>
> error[E0277]: the trait bound `Value: SetValue` is not satisfied<br>
> --> src/main.rs:70:25<br>
> |<br>
> 70 | s.set("handle", &value);<br>
> | ^^^^^^ the trait `SetValue` is not \
implemented for `Value`<br> > |<br>
> = note: required because of the requirements on the impl of `ToSendValue` \
for `Value`<br> <br>
It indeed needs a bit more massaging. The following code should do it.<br>
<br>
{<br>
let context = context.get_mut().unwrap();<br>
let s = context.get_mut_structure();<br>
let value = unsafe {<br>
use gst::glib::translate::*;<br>
use std::mem;<br>
<br>
let handle = display.c_ptr();<br>
let mut value = mem::MaybeUninit::zeroed();<br>
gst::gobject_sys::g_value_init(value.as_mut_ptr(), \
gst::gobject_sys::G_TYPE_POINTER);<br>
gst::gobject_sys::g_value_set_pointer(value.as_mut_ptr(), handle as \
*mut c_void);<br>
gst::glib::SendValue::from_glib_none(&value.assume_init() as \
*const _)<br> };<br>
s.set_value("handle", value);<br>
}<br>
<br>
Apart from everything else there's also the problem that you need to<br>
tell the type system that your value is actually thread-safe. So the<br>
easiest/shortest here is actually to just create the whole GValue like<br>
we would be doing in C.<br>
<br>
-- <br>
Sebastian Dröge, Centricular Ltd · <a href="https://www.centricular.com" \
rel="noreferrer" target="_blank">https://www.centricular.com</a><br> <br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" \
target="_blank">gstreamer-devel@lists.freedesktop.org</a><br> <a \
href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" \
rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div>
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic