-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (29 loc) · 1.02 KB
/
main.cpp
File metadata and controls
39 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <gst/gst.h>
#include <QLoggingCategory>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlEngineExtensionPlugin>
#include <QQuickWindow>
#include "WebRTSP/Qt/QML/QmlLibGst.h"
Q_IMPORT_QML_PLUGIN(org_webrtsp_clientPlugin)
int main(int argc, char *argv[])
{
QmlLibGst libGst;
QGuiApplication app(argc, argv);
QLoggingCategory::setFilterRules("*webrtsp.qml.client.debug=false");
// trick to load plugin and register required QML elements
if(GstPlugin* plugin = gst_plugin_load_by_name("qml6")) {
gst_object_unref(plugin);
} else {
qCritical() << "Something went wrong with Qt6 Qml GStreamer plugin load";
return -1;
}
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QQmlApplicationEngine engine;
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreationFailed,
&app, []() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("QMLDemo", "Main");
return app.exec();
}