How to embed nveglglessink into an gtk window widget on wayland/weston env

Is there any example which demo this use case (embed nveglglessink into an gtk window widget on wayland/weston env)?
I failed to do this, below is my code and can’t see bouncing ball generated by videotestsrc

#include <gtk/gtk.h>
#include <gdk/gdkwayland.h>
#include <gst/gst.h>
#include <gst/video/videooverlay.h>
#include <wayland-egl.h>

static void
activate(GtkApplication *app, gpointer user_data)
    GtkWidget *window;
    GtkWidget *draw_area;
    GtkAllocation alloc;
    struct wl_surface *wl_surf;
    struct wl_egl_window *wl_win;
    GstElement *pipeline;
    GstElement *sink;
    GError *err = NULL;

    window = gtk_application_window_new(app);
    gtk_window_set_title(GTK_WINDOW(window), "Window");
    gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);

    draw_area = gtk_drawing_area_new();
    gtk_container_add(GTK_CONTAINER(window), draw_area);

    gtk_widget_get_allocation(draw_area, &alloc);

    wl_surf = gdk_wayland_window_get_wl_surface(gtk_widget_get_window(draw_area));
    g_print("wl_surf %p\n", wl_surf);
    wl_win = wl_egl_window_create(wl_surf, alloc.width, alloc.height);
    g_print("wl_win %p\n", wl_win);

    pipeline = gst_parse_launch("videotestsrc pattern=ball ! nveglglessink winsys=wayland name=sink", &err);
    gst_element_set_state(pipeline, GST_STATE_READY);
    sink = gst_bin_get_by_name(GST_BIN(pipeline), "sink");
    g_print("sink %p\n", sink);
    gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink), (guintptr)wl_win);
    gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sink), alloc.x, alloc.y, alloc.width, alloc.height);
    gst_element_set_state(pipeline, GST_STATE_PLAYING);

main(int argc, char *argv[])
    GtkApplication *app;
    int status;

    gst_init(&argc, &argv);

    app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE);
    g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
    status = g_application_run(G_APPLICATION(app), argc, argv);

    return status;


DEP_PKGS = gtk+-3.0 wayland-egl gstreamer-1.0 gstreamer-video-1.0
CC = gcc
CFLAGS := -Wall -g $(shell pkg-config --cflags $(DEP_PKGS))
LIBS   := $(shell pkg-config --libs $(DEP_PKGS))

t: t.c
        $(CC) $(CFLAGS) $^ $(LIBS) -o $@

        rm -f t

.PHONY: clean

We have steps of running nveglglessink with wayland in gstreamer user guide. Please take a look.

Hi DaneLLL,

gstreamer user guide does have some gst-launch command line examples for nveglglessink with wayland.
With gst-launch commands, nveglglessink creates it own renderring window.

Now I want nveglglessink to render video images into an GTK widget created by C code, but failed to do this.
So I’m finding C code examples and/or guides for gtk+nveglglessink+weston use case

We don’t have experience in this case. Is it possible to implement it in using jetson_multimedia_api? We have NvEglRenderer in


If you can customize it to run the case, it may be a solution to hook to appsink and use NvEglRenderer. There is a sample:

Did you find a solution for “nveglglessink to render video images into an GTK widget” with weston?