[rust] waylandsink with video overlay

Joel Winarske joel.winarske at gmail.com
Thu Jan 28 16:57:11 UTC 2021


Hi Sebastian,

Thanks for your response, and all your great work on GST Rust.

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`

Thanks,
Joel

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

> On Wed, 2021-01-27 at 15:54 -0800, Joel Winarske wrote:
> > I am trying to add a video overlay to a wayland surface.
> >
> > I'm seeing this runtime error:
> > 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"))
> >
> > What is the pattern for adding display handle with GstContext in Rust?
> >
> > There doesn't appear to be a reference to this in any of the samples.
> >
> > I believe I have set the video_overlay window handle (pointer to
> wl_surface) correctly:
> >
> https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L170
>
> Wayland is a bit special compared to all other platforms in this regard
> unfortunately.
>
> You can find the relevant code in C here:
>
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/66eed8a61d14d08daff2d37b5ae22e8e7c8c05a7/tests/examples/waylandsink/main.c#L84-132
>
> Basically in addition to setting the wl_surface as window handle, you
> also need to set a GstContext on the pipeline (or at least the sink)
> with the wl_display.
>
> This requires using the libgstwayland library, which unfortunately is
> not included in the bindings yet.
>
> You could call those functions via Rust FFI directly after making sure
> that your application links to the library, or you could replicate that
> function in Rust too:
>
>
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/66eed8a61d14d08daff2d37b5ae22e8e7c8c05a7/gst-libs/gst/wayland/wayland.c#L43-51
>
> Due to the raw pointer type used there you'll still have to make use of
> some unsafe code though.
>
> I see that you're trying exactly that here already:
>
> https://github.com/jwinarske/waylandsink-with-video-overlay-rs/blob/main/src/main.rs#L57-L64
>
> The missing bit would be to create a GValue from the pointer
>
>   let mut value = glib::Value::from_type(glib::Type::Pointer);
>   unsafe {
>     use glib::translate::ToGlibPtrMut;
>     glib_sys::g_value_set_pointer(value.to_glib_none_mut().0, handle);
>   }
>
> And then setting that in the structure of the context.
>
> --
> 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/89fb115e/attachment.htm>


More information about the gstreamer-devel mailing list