[SOLVED] - Integration problems between Gstreamer and Qt5

Hello All,

I’m trying to show in streaming the Jetson tx2 oncamera in a simple Qt app.

I have the next code:

#include <QApplication>
#include <QMediaPlayer>
#include <QWidget>
#include <QVideoWidget>
#include <QBoxLayout>
#include <QProcess>
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QWidget *window = new QWidget;
    QVideoWidget *videoWidget = new QVideoWidget;
    QBoxLayout *layout = new QVBoxLayout;
    QMediaPlayer *player = new QMediaPlayer;
    QProcess *process = new QProcess;

    layout->addWidget(videoWidget);
    window->setLayout(layout);
    window->show();
    player->setVideoOutput(videoWidget);

    QString program = "gst-launch-1.0";
    QStringList arguments;
    arguments << "-v" << "videotestsrc" << "!" << "video/x-raw,width=1280,height=720" << "!" << "x264enc" << "!" << "filesink" << "location=/dev/stderr";

    process->start(program, arguments);
    process->waitForReadyRead();

    player->setMedia(QMediaContent(), process);
    player->play();

    return a.exec();
}

This code is from https://forum.qt.io/topic/93188/displaying-video-stream-using-qt-multimedia-and-gstreamer-process/2

When I try to run this little code it just appears a black windows and this error message:

Error: “This appears to be a text file”
appsrc: push buffer wrong state
appsrc: push buffer wrong state
appsrc: push buffer wrong state

I was also thinking instead of use the GStreamer application use the libargus Application because I don’t know how to solve this problem… I’ve spent time…

Thanks for the help,

Aitor

Sorted it out!

This is the code which has worked to me:

pipeline  = gst_parse_launch ("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)2592, height=(int)1944,format=(string)I420, "
                                                 "framerate=(fraction)30/1 ! nvvidconv ! xvimagesink", NULL);
sink = gst_bin_get_by_interface(GST_BIN(pipeline), GST_TYPE_VIDEO_OVERLAY); 

 
gst_element_set_state(pipeline, GST_STATE_READY);
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), widget->winId());
gst_element_set_state (pipeline,GST_STATE_PLAYING);