Greeting,
In our IMX8mp based board we are using yocto image based on wayland display server the board is linked to a LVDS screen where we want to display frames from our cameras with gstreamer .
As a first step our QT application is developed to show a dummy video (the src comes from videotestsrc). but whenever I try to launch the qt application in the board, it opens up an additional window where it stream the videotestsrc rather than streaming it inside my widget.
Any tips to how fix this problem ?
Thanks
Zsabhi
my .pro is as followed
QT += core gui multimedia multimediawidgets concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
camstream.cpp \
cusbutton.cpp \
main.cpp \
widget.cpp
HEADERS += \
camstream.h \
cusbutton.h \
widget.h
FORMS += \
widget.ui
CONFIG += link_pkgconfig
PKGCONFIG += gstreamer-1.0
PKGCONFIG += gstreamer-video-1.0
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
icones.qrc
and this is where i link the video stream to the widget ( or try to do )
#include "camstream.h"
CamStream::CamStream(QObject *parent,QWidget *ui):QObject(parent),
camID(-1),
video_sink(nullptr),
pipe_display(nullptr)
{
Q_UNUSED(ui);
/*** ***/
gst_init (nullptr, nullptr);
}
GError * CamStream::parse_gst_launch(gchar * cmd)
{
GError * error = nullptr;
//qDebug() << ""<<cmd ;
pipe_display = gst_parse_launch (cmd, &error);
return error;
}
GstStateChangeReturn CamStream::set_video_sink()
{
GstStateChangeReturn status ;
status = gst_element_set_state (this->pipe_display, GST_STATE_READY);
//this is the call to overlay the gstreamer's output to the Qt Widgets...
this->video_sink = (gst_bin_get_by_interface(GST_BIN(this->pipe_display), GST_TYPE_VIDEO_OVERLAY));
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (this->video_sink), this->camID);
return status;
}
GstStateChangeReturn CamStream::run_pipline()
{
GstStateChangeReturn status ;
status = gst_element_set_state (this->pipe_display, GST_STATE_PLAYING);
return status ;
}
void CamStream::set_cam_id(WId cam_id)
{
this->camID = cam_id ;
}