1 /* 2 * GStreamer 3 * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved. 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_WINDOW_H__ 22 #define __QT_WINDOW_H__ 23 24 #include <gst/gst.h> 25 #include <gst/gl/gl.h> 26 27 #include "gstqtgl.h" 28 #include <QtQuick/QQuickWindow> 29 #include <QtGui/QOpenGLContext> 30 #include <QtGui/QOpenGLFunctions> 31 32 typedef struct _QtGLWindowPrivate QtGLWindowPrivate; 33 34 class QtGLWindow : public QQuickWindow, protected QOpenGLFunctions 35 { 36 Q_OBJECT 37 public: 38 QtGLWindow (QWindow * parent = NULL, QQuickWindow *source = NULL); 39 ~QtGLWindow (); 40 bool getGeometry (int * width, int * height); 41 42 /* private for C interface ... */ 43 QtGLWindowPrivate *priv; 44 45 private Q_SLOTS: 46 void beforeRendering (); 47 void afterRendering (); 48 void onSceneGraphInitialized (); 49 void onSceneGraphInvalidated (); 50 void aboutToQuit(); 51 52 private: 53 QQuickWindow * source; 54 QScopedPointer<QOpenGLFramebufferObject> fbo; 55 }; 56 57 extern "C" 58 { 59 gboolean qt_window_set_buffer (QtGLWindow * qt_window, GstBuffer * buffer); 60 gboolean qt_window_set_caps (QtGLWindow * qt_window, GstCaps * caps); 61 GstGLContext * qt_window_get_qt_context (QtGLWindow * qt_window); 62 GstGLContext * qt_window_get_context (QtGLWindow * qt_window); 63 gboolean qt_window_set_context (QtGLWindow * qt_window, GstGLContext * context); 64 GstGLDisplay * qt_window_get_display (QtGLWindow * qt_window); 65 gboolean qt_window_is_scenegraph_initialized (QtGLWindow * qt_window); 66 void qt_window_use_default_fbo (QtGLWindow * qt_window, gboolean useDefaultFbo); 67 } 68 69 #endif /* __QT_WINDOW_H__ */ 70