1 #include "videowidget.h"
2 #include "public_key.h"
3 #include <QQmlApplicationEngine>
4 #include <QQuickWindow>
5 #include <QQuickItem>
6 #include <QRunnable>
7 #include <gst/gst.h>
8 #include <QHBoxLayout>
9
10 //class SetPlaying : public QRunnable
11 //{
12 //public:
13 // SetPlaying(GstElement *);
14 // ~SetPlaying();
15
16 // void run ();
17
18 //private:
19 // GstElement * pipeline_;
20 //};
21
22 //SetPlaying::SetPlaying (GstElement * pipeline)
23 //{
24 // this->pipeline_ = pipeline ? static_cast<GstElement *> (gst_object_ref (pipeline)) : NULL;
25 //}
26
27 //SetPlaying::~SetPlaying ()
28 //{
29 // if (this->pipeline_)
30 // gst_object_unref (this->pipeline_);
31 //}
32
33 //void
34 //SetPlaying::run ()
35 //{
36 // if (this->pipeline_)
37 // gst_element_set_state (this->pipeline_, GST_STATE_PLAYING);
38 //}
39
40
VideoWidget()41 VideoWidget::VideoWidget()
42 {
43 // GstElement *pipeline = gst_element_factory_make ("playbin", NULL);
44 // g_object_set(G_OBJECT(pipeline), "uri", argv[1], NULL);
45
46 // GstBin *sinkbin = (GstBin *) gst_parse_bin_from_description ("glupload ! qmlglsink name=sink", TRUE, NULL);
47 // GstElement *videosink = gst_bin_get_by_name (sinkbin, "sink");
48
49 // g_object_set(G_OBJECT(pipeline), "video-sink", sinkbin, NULL);
50
51 // QQmlApplicationEngine *engine = new QQmlApplicationEngine(this);
52 // engine->load(QUrl(QStringLiteral("qrc:/main.qml")));
53
54 // QQuickItem *videoItem;
55 // QQuickWindow *rootObject;
56
57 // /* find and set the videoItem on the sink */
58 // rootObject = static_cast<QQuickWindow *> (engine->rootObjects().first());
59 // videoItem = rootObject->findChild<QQuickItem *> ("videoItem");
60 // g_assert (videoItem);
61 // g_object_set(G_OBJECT(videosink), "widget", videoItem, NULL);
62
63 // rootObject->scheduleRenderJob (new SetPlaying (pipeline),
64 // QQuickWindow::BeforeSynchronizingStage);
65
66
67 }
68
~VideoWidget()69 VideoWidget::~VideoWidget()
70 {
71 // gst_element_set_state (pipeline, GST_STATE_NULL);
72 // gst_object_unref (pipeline);
73 // gst_deinit ();
74 }
75
id()76 QString VideoWidget::id()
77 {
78 return PUBLIC_KEY::OKQMLVIDEO;
79 }
80