D
D
dobrenkiy2020-06-08 20:00:56
Qt
dobrenkiy, 2020-06-08 20:00:56

How to output video from GStreamer to QWidget?

Hello.
There is a working project on Qt, QWidgets. It is necessary to display the image from the GStreamer'a stream to the widget.
The setting is done as follows:

gst_init(nullptr, nullptr);
//source, sink, pipeline, описанные ниже - GstElement* 
source = gst_element_factory_make("nvarguscamerasrc", "source");
sink = hst_element_factory_make("nv3dsink", "sink");
pipeline = gst_pipeline_new("pipeline");

gst_bin_add_many(GST_BIN(pipeline), source, sink, NULL);
gst_element_link(source, sink);

gst_element_set_state(pipeline, GST_STATE_READY);

//tmpwgt - QWidget*
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink), tmpwgt->winId());

gst_element_set_state(pipeline, GST_STATE_PLAYING);'


If I create an independent tmpwgt that is not any child, then video is output to it.
If you throw in a test program with a widget for output and a couple of buttons, then everything will work out fine.
If you comment out the line gst_element_set_state(pipeline, GST_STATE_PLAYING); , then it works as it should, displays it in the window launched by gstreamer.
If I make it a child of some object, no matter how nested it is in the Ui of the program (added to the mainWindow layout), nothing is displayed on it.
If you monitor messages generated by GStreamer. there are no errors. Judging by them, it starts normally, they are the same (at least the codes and statuses of the state transition)
I don’t know what to do, where to look, maybe there are some ideas?

PS Issue resolved. Prevented displaying the presence of the Qt::WA_TranslucentBackground flag.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question