• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <QApplication>
2 #include <QQmlApplicationEngine>
3 #include <QQmlContext>
4 
5 #include <gst/gst.h>
6 
7 int
main(int argc,char * argv[])8 main (int argc, char *argv[])
9 {
10   gst_init (&argc, &argv);
11 
12   QGuiApplication app (argc, argv);
13   QQmlApplicationEngine engine;
14 
15   /* make sure that plugin was loaded */
16   GstElement *qmlglsink = gst_element_factory_make ("qmlglsink", NULL);
17   g_assert (qmlglsink);
18 
19   /* anything supported by videotestsrc */
20   QStringList patterns (
21       {
22       "smpte", "ball", "spokes", "gamut"});
23 
24   engine.rootContext ()->setContextProperty ("patterns",
25       QVariant::fromValue (patterns));
26 
27   QObject::connect (&engine, &QQmlEngine::quit, [&] {
28         gst_object_unref (qmlglsink);
29         qApp->quit ();
30       });
31 
32   engine.load (QUrl (QStringLiteral ("qrc:///main.qml")));
33 
34   return app.exec ();
35 }
36