Gstreamer video overlay on wayland backend ( python )

Hi,

Is there a way to render gstreamer video overlay on a wayland gdk window from python ?

It is possible in C though, as below:

#if GST_GL_HAVE_WINDOW_WAYLAND && defined(GDK_WINDOWING_WAYLAND)
  if (GDK_IS_WAYLAND_DISPLAY (display) && (!user_choice
          || g_strcmp0 (user_choice, "wayland") == 0)) {
    gst_video_overlay_set_window_handle (videooverlay,
        (guintptr) gdk_wayland_window_get_wl_surface (window));
  } else
#endif

But, no python bindings available for wayland backend.

I am not sure why we’re even dealing with gdk backend specific calls in the example above. Shouldn’t these be abstracted by virtual functions ?

Thanks!

GTK3 doesn’t generate bindings for wayland backend.

Only X11 backend as shown below:

./build-dir/gdk/Gdk-3.0.gir
./build-dir/gdk/GdkX11-3.0.gir
./build-dir/gtk/Gtk-3.0.gir

The proper way to integrate GStramer and GTK is to use the gtksink element and then extract the GtkWidget used to display the video through the widget property.

Even if GTK exposed the GdkWayland namespace like it does for the X11 backend, you would not be able to use native Wayland types in Python, because there’s no introspection data for libwayland-client.

Not really: you’re passing around native data structures, to avoid overhead.

In general, though, the documentation for integrating GStreamer and GTK and other toolkits is known to be out of date.

2 Likes

The video is rendered to a window with title 'Gtk+ Cairo renderer'.

Is it possible to render the video on a custom window without title bar ? Something like a video preview.

Thanks!

The titlebar (or headerbar in modern gtk apps) is drawn by the application under wayland and its something you can hide if you so desire. Make sure thought that there’s some way to manage the window.

2 Likes

There’s also gtkglsink which should be more efficient but is a bit harder to use and will cause crashes with the nouveau driver due to driver bugs.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.