adding in example of gst pipeline simple sink

This commit is contained in:
talksik
2023-08-28 14:01:31 -07:00
parent bb08f7262e
commit 3ce67d907a
7 changed files with 208 additions and 172 deletions
+24 -24
View File
@@ -44,37 +44,37 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
GstElement *pipeline = gst_pipeline_new (NULL);
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);
// GstElement *pipeline = gst_pipeline_new (NULL);
// 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);
// 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_element_set_state (pipeline, GST_STATE_PAUSED);
// gst_object_unref (pipeline);
}
gst_deinit ();