GstVideoOverlay

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GstVideoOverlay

horai
Dear all,

I have 4 videos each inseparate videooverlay area withing single GTK window.
I am trying to maximize one videoarea upon click and hide all the remaining
GstVideoOverlay videoareas with gst_video_overlay_set_render_rectangle
method with setting width and height to -1 as described in documentation
here:
https://gstreamer.freedesktop.org/documentation/video/gstvideooverlay.html?gi-language=c#gst_video_overlay_set_window_handle

Was anyone able to use this method successfully under Weston or Gnome shell
or any other compositor on top of Wayland?I had no luck with Weston nor
Gnome shell on x86 nor ARM platform.
I am curious whether this method ever worked for anyone.If not, is there any
workaround how to hide render area where the videos are being renderer? I
partially achieved success with stopping the pipelines, setting GtkWidgets
to invisible and maximizing the clicked GtkEventBox to the size of grid
which possesses all 4 GtkWidgets with videos, it randomly works as I wish,
but sometimes some of the 4 video render areas remain black preventing the
fullscreen video to be fully visible.
I am totally lost with what could be the reason for malfunction of this
method, I tried the reference example in gst-plugin-bad for waylandsink and
hide the main window within this example, no success. I would drop
waylandsink, but glimagesink seems to be too slow on RaspberryPI under
Weston.
Please, could anyone point me where the problem could be or should I stop
wasting time with plugin which is in plugin-bad or should I stop trying to
achieve anything in Weston?
Should I set out to the journey of compiling up date Wayland and Weston?
It is 1.14.4 stable Gstreamer version so I guess I am the one doing
something wrong.
Or should I drop GTK and try QT instead? Honestly I would rather prefer GTK.
There are hardly no examples on google search, therefore I would really
really like to kindly ask you for your help.

Thank you
Best regards,
Ivo





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstVideoOverlay

horai
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/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstVideoOverlay

horai
Ok, I found out that when I remove waylandsink from the unwanted pipelines
upon click this way:

        g_object_set(d->pipeline1, "video-sink", NULL, NULL);        
        g_object_set(d->pipeline2, "video-sink", NULL, NULL);
        g_object_set(d->pipeline3, "video-sink", NULL, NULL);

or unref the entire pipelines which video renderings are meant to be hidden
in fullscreen mode:
        gst_object_unref(d->pipeline1);
        gst_object_unref(d->pipeline2);
        gst_object_unref(d->pipeline3);

It works as it is, all the other rendering areas are cleared and the GtkBox
I clicked on resizes to fullscreen and it plays fullscreen without any
disturbing rectangle black rectangle from hidden rendering areas.

By some (for me) unknown mechanism all three unwanted rendering areas are
completely cleared and no random blanking of one of these rendering areas
occur, unfortunately, when I try to return the waylandsink back to the
pipeline and start the pipeline again, it does not work:
 g_object_set(d->pipeline1, "video-sink", d->sink1, NULL);
 gst_element_set_state(d->pipeline1, GST_STATE_PLAYING);

Well, I guess the problem is that the pipeline (probably waylandsink) still
keeps track of the area (dimensions and position) given to the overlay by
method:
gst_video_overlay_set_render_rectangle(d->overlay1, allocation.x,
                allocation.y, allocation.width, allocation.height);

withing the Gtk Window specified to the overlay by method:
        gst_video_overlay_set_window_handle(d->overlay1, (guintptr)
window_handle);

I need to force the pipeline or the sink to forget about the rendering area
for the time of clicked video rendering fullscreen, after the first video
returns from fullscreen, I need all the remaining pipelines to revive their
previous rendering areas or I can set it manually once more, but I cannot
force the pipeline  (or the sink) to release the rendering area on the
window (wl_surface).
Is method:

gst_video_overlay_set_render_rectangle(d->overlay1,allocation.x,allocation.y,-1,-1)
really not intended for clearing the rendering area?
Is there any convenient way how to clear the area without removing the
pipeline or removing the sink from the pipeline? I need all the hidden
overlays to keep the window_handles to possibly restart their rendering in
multi video window.

Thank you
Best regards,
Ivo




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel