cleanup and making it work on raspberry pi
This commit is contained in:
@@ -1,15 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# this is special script for running on jetson nano
|
# this is special script for running on jetson nano
|
||||||
|
|
||||||
export QT_DEBUG_PLUGINS=1
|
|
||||||
|
|
||||||
export QT_QPA_EGLFS_DEBUG=1
|
export QT_QPA_EGLFS_DEBUG=1
|
||||||
# the below will run on kms. it will not work on X11/desktop environment
|
# the below will run on kms. it will not work on X11/desktop environment
|
||||||
# export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
|
# export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
|
||||||
export QT_QPA_EGLFS_HIDECURSOR=1
|
export QT_QPA_EGLFS_HIDECURSOR=1
|
||||||
|
|
||||||
export GST_DEBUG=2
|
export GST_DEBUG=2
|
||||||
export QT_QPA_EGLFS_DEBUG=1
|
|
||||||
|
|
||||||
rm -rf build
|
rm -rf build
|
||||||
mkdir build
|
mkdir build
|
||||||
|
|||||||
@@ -1,83 +1,45 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QQuickWindow>
|
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
|
#include <QQuickWindow>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
class SetPlaying : public QRunnable
|
class SetPlaying : public QRunnable {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
SetPlaying(GstElement *);
|
SetPlaying(GstElement *);
|
||||||
~SetPlaying();
|
~SetPlaying();
|
||||||
|
|
||||||
void run ();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GstElement * pipeline_;
|
GstElement *pipeline_;
|
||||||
};
|
};
|
||||||
|
|
||||||
SetPlaying::SetPlaying (GstElement * pipeline)
|
SetPlaying::SetPlaying(GstElement *pipeline) {
|
||||||
{
|
this->pipeline_ =
|
||||||
this->pipeline_ = pipeline ? static_cast<GstElement *> (gst_object_ref (pipeline)) : NULL;
|
pipeline ? static_cast<GstElement *>(gst_object_ref(pipeline)) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPlaying::~SetPlaying ()
|
SetPlaying::~SetPlaying() {
|
||||||
{
|
|
||||||
if (this->pipeline_)
|
if (this->pipeline_)
|
||||||
gst_object_unref (this->pipeline_);
|
gst_object_unref(this->pipeline_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void SetPlaying::run() {
|
||||||
SetPlaying::run ()
|
|
||||||
{
|
|
||||||
if (this->pipeline_)
|
if (this->pipeline_)
|
||||||
gst_element_set_state (this->pipeline_, GST_STATE_PLAYING);
|
gst_element_set_state(this->pipeline_, GST_STATE_PLAYING);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
{
|
QQmlApplicationEngine engine;
|
||||||
QGuiApplication app(argc, argv);
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
|
|
||||||
// GstElement *pipeline = gst_pipeline_new (NULL);
|
ret = app.exec();
|
||||||
// GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
|
|
||||||
// GstElement *glupload = gst_element_factory_make ("glupload", NULL);
|
|
||||||
// /* the plugin must be loaded before loading the qml file to register the
|
|
||||||
// * GstGLVideoItem qml item */
|
|
||||||
// GstElement *sink = gst_element_factory_make ("qmlglsink", NULL);
|
|
||||||
//
|
|
||||||
// g_assert (src && glupload && sink);
|
|
||||||
//
|
|
||||||
// gst_bin_add_many (GST_BIN (pipeline), src, glupload, sink, NULL);
|
|
||||||
// gst_element_link_many (src, glupload, sink, NULL);
|
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
||||||
|
|
||||||
// QQuickItem *videoItem;
|
|
||||||
// QQuickWindow *rootObject;
|
|
||||||
//
|
|
||||||
// /* find and set the videoItem on the sink */
|
|
||||||
// rootObject = static_cast<QQuickWindow *> (engine.rootObjects().first());
|
|
||||||
// videoItem = rootObject->findChild<QQuickItem *> ("videoItem");
|
|
||||||
// g_assert (videoItem);
|
|
||||||
// g_object_set(sink, "widget", videoItem, NULL);
|
|
||||||
//
|
|
||||||
// rootObject->scheduleRenderJob (new SetPlaying (pipeline),
|
|
||||||
// QQuickWindow::BeforeSynchronizingStage);
|
|
||||||
|
|
||||||
ret = app.exec();
|
|
||||||
|
|
||||||
// gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
// gst_object_unref (pipeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_deinit ();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ ApplicationWindow {
|
|||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
id: player
|
id: player
|
||||||
autoPlay: true
|
autoPlay: true
|
||||||
source: "gst-pipeline: videotestsrc ! qtvideosink"
|
source: "gst-pipeline: videotestsrc ! videoconvert ! qtvideosink"
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoOutput {
|
VideoOutput {
|
||||||
id: videoOutput
|
id: output
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: player
|
source: player
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,6 @@ ApplicationWindow {
|
|||||||
color: "red"
|
color: "red"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: "white"
|
border.color: "white"
|
||||||
anchors.bottom: video.bottom
|
|
||||||
anchors.bottomMargin: 15
|
anchors.bottomMargin: 15
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width : parent.width - 100
|
width : parent.width - 100
|
||||||
|
|||||||
Reference in New Issue
Block a user