<div dir="ltr"><div>Hi Sebastian,</div><div><br></div><div>Thanks for your response, and all your great work on GST Rust.<br></div><div></div><div><br></div><div>I'm down to <a href="https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L59-L72">https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L59-L72</a></div><div><br></div><div>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`</div><div><br></div><div>Thanks,</div><div>Joel<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 28, 2021 at 12:09 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 Wed, 2021-01-27 at 15:54 -0800, Joel Winarske wrote:<br>
> I am trying to add a video overlay to a wayland surface.<br>
> <br>
> I'm seeing this runtime error:<br>
> Error! Received error from /GstPipeline:pipeline0/GstWaylandSink:waylandsink0: Application did not provide a wayland display handle (debug: Some("../ext/wayland/gstwaylandsink.c(946): gst_wayland_sink_set_window_handle (): /GstPipeline:pipeline0/GstWaylandSink:waylandsink0:\nwaylandsink cannot use an externally-supplied surface without an externally-supplied display handle. Consider providing a display handle from your application with GstContext"))<br>
> <br>
> What is the pattern for adding display handle with GstContext in Rust?<br>
><br>
> There doesn't appear to be a reference to this in any of the samples.<br>
> <br>
> I believe I have set the video_overlay window handle (pointer to wl_surface) correctly:<br>
> <a href="https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L170" rel="noreferrer" target="_blank">https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L170</a><br>
<br>
Wayland is a bit special compared to all other platforms in this regard<br>
unfortunately.<br>
<br>
You can find the relevant code in C here:<br>
<a href="https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/66eed8a61d14d08daff2d37b5ae22e8e7c8c05a7/tests/examples/waylandsink/main.c#L84-132" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/66eed8a61d14d08daff2d37b5ae22e8e7c8c05a7/tests/examples/waylandsink/main.c#L84-132</a><br>
<br>
Basically in addition to setting the wl_surface as window handle, you<br>
also need to set a GstContext on the pipeline (or at least the sink)<br>
with the wl_display.<br>
<br>
This requires using the libgstwayland library, which unfortunately is<br>
not included in the bindings yet.<br>
<br>
You could call those functions via Rust FFI directly after making sure<br>
that your application links to the library, or you could replicate that<br>
function in Rust too:<br>
<br>
<a href="https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/66eed8a61d14d08daff2d37b5ae22e8e7c8c05a7/gst-libs/gst/wayland/wayland.c#L43-51" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/66eed8a61d14d08daff2d37b5ae22e8e7c8c05a7/gst-libs/gst/wayland/wayland.c#L43-51</a><br>
<br>
Due to the raw pointer type used there you'll still have to make use of<br>
some unsafe code though.<br>
<br>
I see that you're trying exactly that here already:<br>
<a href="https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L57-L64" rel="noreferrer" target="_blank">https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L57-L64</a><br>
<br>
The missing bit would be to create a GValue from the pointer<br>
<br>
let mut value = glib::Value::from_type(glib::Type::Pointer);<br>
unsafe {<br>
use glib::translate::ToGlibPtrMut;<br>
glib_sys::g_value_set_pointer(value.to_glib_none_mut().0, handle);<br>
}<br>
<br>
And then setting that in the structure of the context.<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>