1 /* 2 * GStreamer 3 * Copyright (C) 2007 David A. Schleef <ds@schleef.org> 4 * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> 5 * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com> 6 * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public 19 * License along with this library; if not, write to the 20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24 #ifndef __GST_GL_DISPLAY_H__ 25 #define __GST_GL_DISPLAY_H__ 26 27 #include <gst/gl/gstgl_fwd.h> 28 29 G_BEGIN_DECLS 30 31 GST_GL_API 32 GType gst_gl_display_get_type (void); 33 34 #define GST_TYPE_GL_DISPLAY (gst_gl_display_get_type()) 35 #define GST_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY,GstGLDisplay)) 36 #define GST_GL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY,GstGLDisplayClass)) 37 #define GST_IS_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY)) 38 #define GST_IS_GL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY)) 39 #define GST_GL_DISPLAY_CAST(obj) ((GstGLDisplay*)(obj)) 40 #define GST_GL_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_DISPLAY, GstGLDisplayClass)) 41 42 /** 43 * GstGLDisplayType: 44 * @GST_GL_DISPLAY_TYPE_NONE: no display type 45 * @GST_GL_DISPLAY_TYPE_X11: X11 display 46 * @GST_GL_DISPLAY_TYPE_WAYLAND: Wayland display 47 * @GST_GL_DISPLAY_TYPE_COCOA: Cocoa display 48 * @GST_GL_DISPLAY_TYPE_WIN32: Win32 display 49 * @GST_GL_DISPLAY_TYPE_DISPMANX: Dispmanx display 50 * @GST_GL_DISPLAY_TYPE_EGL: EGL display 51 * @GST_GL_DISPLAY_TYPE_VIV_FB: Vivante Framebuffer display 52 * @GST_GL_DISPLAY_TYPE_GBM: Mesa3D GBM display 53 * @GST_GL_DISPLAY_TYPE_ANY: any display type 54 */ 55 /** 56 * GST_GL_DISPLAY_TYPE_EGL_DEVICE: 57 * 58 * EGLDevice display. 59 * 60 * Since: 1.18 61 */ 62 /** 63 * GST_GL_DISPLAY_TYPE_EAGL: 64 * 65 * EAGL display. 66 * 67 * Since: 1.20 68 */ 69 /** 70 * GST_GL_DISPLAY_TYPE_WINRT: 71 * 72 * WinRT display. 73 * 74 * Since: 1.20 75 */ 76 /** 77 * GST_GL_DISPLAY_TYPE_ANDROID: 78 * 79 * Android display. 80 * 81 * Since: 1.20 82 */ 83 typedef enum 84 { 85 GST_GL_DISPLAY_TYPE_NONE = 0, 86 GST_GL_DISPLAY_TYPE_X11 = (1 << 0), 87 GST_GL_DISPLAY_TYPE_WAYLAND = (1 << 1), 88 GST_GL_DISPLAY_TYPE_COCOA = (1 << 2), 89 GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3), 90 GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4), 91 GST_GL_DISPLAY_TYPE_EGL = (1 << 5), 92 GST_GL_DISPLAY_TYPE_VIV_FB = (1 << 6), 93 GST_GL_DISPLAY_TYPE_GBM = (1 << 7), 94 GST_GL_DISPLAY_TYPE_EGL_DEVICE = (1 << 8), 95 GST_GL_DISPLAY_TYPE_EAGL = (1 << 9), 96 GST_GL_DISPLAY_TYPE_WINRT = (1 << 10), 97 GST_GL_DISPLAY_TYPE_ANDROID = (1 << 11), 98 99 GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32 100 } GstGLDisplayType; 101 102 /** 103 * GstGLDisplay: 104 * 105 * The contents of a #GstGLDisplay are private and should only be accessed 106 * through the provided API 107 */ 108 struct _GstGLDisplay 109 { 110 /*< private >*/ 111 GstObject object; 112 113 GstGLDisplayType type; 114 115 /*< protected >*/ 116 GList *windows; /* internal lock, use *_window functions instead */ 117 GMainContext *main_context; 118 GMainLoop *main_loop; 119 GSource *event_source; 120 121 GstGLDisplayPrivate *priv; 122 }; 123 124 struct _GstGLDisplayClass 125 { 126 GstObjectClass object_class; 127 128 guintptr (*get_handle) (GstGLDisplay * display); 129 GstGLWindow * (*create_window) (GstGLDisplay * display); 130 131 /*< private >*/ 132 gpointer _padding[GST_PADDING]; 133 }; 134 135 GST_GL_API 136 GstGLDisplay *gst_gl_display_new (void); 137 GST_GL_API 138 GstGLDisplay *gst_gl_display_new_with_type (GstGLDisplayType type); 139 140 #define gst_gl_display_lock(display) GST_OBJECT_LOCK (display) 141 #define gst_gl_display_unlock(display) GST_OBJECT_UNLOCK (display) 142 143 GST_GL_API 144 guintptr gst_gl_display_get_handle (GstGLDisplay * display); 145 GST_GL_API 146 GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display); 147 GST_GL_API 148 void gst_gl_display_filter_gl_api (GstGLDisplay * display, 149 GstGLAPI gl_api); 150 GST_GL_API 151 GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display); 152 GST_GL_API 153 GstGLAPI gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display); 154 155 /** 156 * GST_GL_DISPLAY_CONTEXT_TYPE: 157 * 158 * The name used in #GstContext queries for requesting a #GstGLDisplay 159 */ 160 #define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay" 161 GST_GL_API 162 void gst_context_set_gl_display (GstContext * context, GstGLDisplay * display); 163 GST_GL_API 164 gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display); 165 166 GST_GL_API 167 gboolean gst_gl_display_create_context (GstGLDisplay * display, 168 GstGLContext * other_context, GstGLContext ** p_context, GError **error); 169 GST_GL_API 170 GstGLContext * gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display, 171 GThread * thread); 172 GST_GL_API 173 gboolean gst_gl_display_add_context (GstGLDisplay * display, 174 GstGLContext * context); 175 GST_GL_API 176 void gst_gl_display_remove_context (GstGLDisplay * display, 177 GstGLContext * context); 178 179 GST_GL_API 180 GstGLWindow * gst_gl_display_create_window (GstGLDisplay * display); 181 GST_GL_API 182 gboolean gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window); 183 GST_GL_API G_DEPRECATED_FOR(gst_gl_display_retrieve_window) 184 GstGLWindow * gst_gl_display_find_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func); 185 GST_GL_API 186 GstGLWindow * gst_gl_display_retrieve_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func); 187 188 G_END_DECLS 189 190 #endif /* __GST_GL_DISPLAY_H__ */ 191