GstVideoOverlay

horai ivo.hora at seznam.cz
Sun Sep 8 12:27:53 UTC 2019


Dear all,

I finally managed to get rid of the error message popping while using
method:
gst_video_overlay_set_render_rectangle()
It works only when using playbin and sink waylandsink, If I use pipeline
with videotestsrc, it stops at this method yielding before mentioned errors.
Unfortunately the problem with black sub window (which causes fullscreen
video to be rendered only partially) still remains even though I thought I
cleared all the rendering sub windows clearing the screen for single video
to be rendered full screen (actually "full window" as videos are running in
single GTK window)
I assumed that calling  gst_video_overlay_set_render_rectangle() on three
remaining window handles will clear the area unfortunately black rectangle
randomly remains on some of the areas where the other videos where rendered.
I am enclosing the entire button click method with all my attempts to hide
(clear, disable or how should I name it) in comments.

static void
button_press_event(GtkWidget *widget, GdkEventButton *event, DemoApp * d) {
    if (destroy == FALSE) {

       gtk_widget_get_allocation(d->video_widget1, &allocation);
        GstStateChangeReturn state;
        //state = gst_element_set_state(d->pipeline0, GST_STATE_NULL);
        //g_print("pipeline state:%d\r\n", state);
        state = gst_element_set_state(d->pipeline1, GST_STATE_NULL);
        g_print("pipeline state:%d\r\n", state);
        state = gst_element_set_state(d->pipeline2, GST_STATE_NULL);
        g_print("pipeline state:%d\r\n", state);
        state = gst_element_set_state(d->pipeline3, GST_STATE_NULL);
        g_print("pipeline state:%d\r\n", state);
       /*
        gboolean result =
gst_video_overlay_set_render_rectangle(d->overlay1, -1,
                -1, -1, -1);
         */
        gboolean result = FALSE;

        gtk_widget_get_allocation(d->video_widget0, &allocation);

        result = gst_video_overlay_set_render_rectangle(d->overlay0,
allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x,
allocation.y, allocation.width, allocation.height, result);
         
        gtk_widget_get_allocation(d->video_widget1, &allocation);
        result = FALSE;
        result = gst_video_overlay_set_render_rectangle(d->overlay1,
allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x,
allocation.y, allocation.width, allocation.height, result);
       // gst_object_unref(d->overlay1);

        gtk_widget_get_allocation(d->video_widget2, &allocation);
        result = FALSE;
        result = gst_video_overlay_set_render_rectangle(d->overlay2,
allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x,
allocation.y, allocation.width, allocation.height, result);
        //gst_object_unref(d->overlay2);


        gtk_widget_get_allocation(d->video_widget3, &allocation);
        result = FALSE;
        result = gst_video_overlay_set_render_rectangle(d->overlay3,
allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x,
allocation.y, allocation.width, allocation.height, result);
        //gst_object_unref(d->overlay3);
        /*
                gst_video_overlay_expose(d->overlay0);
                gst_video_overlay_expose(d->overlay1);
                gst_video_overlay_expose(d->overlay2);
                gst_video_overlay_expose(d->overlay3);
         */
        /*
        gst_video_overlay_set_window_handle(d->overlay1, (guintptr) 0);
        gst_video_overlay_set_window_handle(d->overlay2, (guintptr) 0);
        gst_video_overlay_set_window_handle(d->overlay2, (guintptr) 0);
         */
        gtk_widget_set_visible(d->video_widget1, FALSE);
        gtk_widget_set_visible(d->video_widget2, FALSE);
        gtk_widget_set_visible(d->video_widget3, FALSE);
        
        //gst_video_overlay_expose(d->overlay1);

        //g_print("result=%d\r\n", result);
        int width = gtk_widget_get_allocated_width(d->videoElementsGrid);
        int height = gtk_widget_get_allocated_height(d->videoElementsGrid);
        gtk_widget_set_size_request(d->video_widget0, width, height);
        gtk_widget_get_allocation(d->video_widget0, &allocation);
        struct wl_surface *window_handle =
gdk_wayland_window_get_wl_surface(gtk_widget_get_window(d->video_widget0));
       
wl_surface_damage_buffer(window_handle,allocation.x,allocation.y,width,height);
        //gst_element_set_state(d->pipeline0, GST_STATE_PLAYING);
        destroy = TRUE;
    } else {

Thank you
Best regards,
Ivo




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list