gl: be consistent in gobject boilerpate
[platform/upstream/gst-plugins-good.git] / ext / qt / qtitem.h
1 /*
2  * GStreamer
3  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __QT_ITEM_H__
22 #define __QT_ITEM_H__
23
24 #include <gst/gst.h>
25 #include <gst/gl/gl.h>
26
27 #include "gstqtgl.h"
28 #include <QtQuick/QQuickItem>
29 #include <QtGui/QOpenGLContext>
30 #include <QtGui/QOpenGLFunctions>
31
32 typedef struct _QtGLVideoItemPrivate QtGLVideoItemPrivate;
33
34 class QtGLVideoItem : public QQuickItem, protected QOpenGLFunctions
35 {
36     Q_OBJECT
37 public:
38     QtGLVideoItem();
39     ~QtGLVideoItem();
40
41     void setDAR(gint, gint);
42     void getDAR(gint *, gint *);
43     void setForceAspectRatio(bool);
44     bool getForceAspectRatio();
45
46     /* private for C interface ... */
47     QtGLVideoItemPrivate *priv;
48
49 private Q_SLOTS:
50     void handleWindowChanged(QQuickWindow * win);
51     void onSceneGraphInitialized();
52     void onSceneGraphInvalidated();
53
54 protected:
55     QSGNode * updatePaintNode (QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData);
56
57 private:
58     void setViewportSize(const QSize &size);
59     void shareContext();
60
61     QSize m_viewportSize;
62 };
63
64 extern "C"
65 {
66 void            qt_item_set_buffer (QtGLVideoItem * widget, GstBuffer * buffer);
67 gboolean        qt_item_set_caps (QtGLVideoItem * widget, GstCaps * caps);
68 gboolean        qt_item_init_winsys (QtGLVideoItem * widget);
69 GstGLContext *  qt_item_get_qt_context (QtGLVideoItem * qt_item);
70 GstGLContext *  qt_item_get_context (QtGLVideoItem * qt_item);
71 GstGLDisplay *  qt_item_get_display (QtGLVideoItem * qt_item);
72 }
73
74 #endif /* __QT_ITEM_H__ */