Search code examples
gstreamergtkmm

Resize gstremer video in gtkmm


I got a sample video application in gtk using gstreamer from their official site (https://gstreamer.freedesktop.org/documentation/tutorials/basic/toolkit-integration.html?gi-language=c). When I maximize the window, video didn't get resized. When I tried the same using d3dvideosink, video get resized but it was transparent.Attached screenshot for both. Any suggestion is really appreciated.

When maximize application obtained from gstremer site enter image description here

When using d3dvideosink video get transparent enter image description here


Solution

  • Finally I resolved issue by upgrading gstreamer plugin in GTK and use configure event Use d3d11videosink for video streaming which allow "gst_video_overlay_set_render_rectangle" api in the latest release(1.20.0). d3dvideosink has transparency issue so do not use that. Add a configure event for video window(Gtk::DrawingArea). video_window->signal_configure_event().connect(sigc::mem_fun(this, &example::example_function),false); In configure event do the following

    video_window(GdkEventConfigure *event) {   gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(video_sink), 0, 0, event->width, event->height);
        }
    

    where "video_sink" is the GST_TYPE_VIDEO_OVERLAY for pipeline. Please ensure it is not null (need to null initial), else it leads to application crash.

    This is for windows application.Please check this link for more details