I'm trying to play video in a Qt widget on linux.
How to implement a video widget in Qt that builds upon GStreamer?
The above question is pretty close to what I want, but 6 years old. QApplication::syncX();
no longer exists in qt5 so I dropped that. I've also changed gst_x_overlay_set_xwindow_id()
to gst_video_overlay_set_window_handle
for the gstreamer version change.
My pipeline works if I don't pass any window handle to the video sink (it just pops up a new window with the video). I'm not sure if I'm missing something to get it to render inside of Qt though.
EDIT
I can set the entire app window as the overlay, but not a subsection of the main widget. Also, couldn't get the appsink working, but glimagesink seems to work.
// QWidget* widget = QApplication::activeWindow(); // this works
QWidget* widget = new QWidget(ui->base_widget); // this doesn't work
widget->setAttribute(Qt::WA_NativeWindow, true);
widget->resize(320,240);
widget->update();
widget->setStyleSheet("background-color: red");
widget->show();
winId = widget->winId();
QApplication::sync();
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink) , winId);