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
29G_BEGIN_DECLS
30
31GST_GL_API
32GType 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/**
84 * GST_GL_DISPLAY_TYPE_EGL_SURFACELESS:
85 *
86 * Mesa3D surfaceless display using the EGL_PLATFORM_SURFACELESS_MESA
87 * extension.
88 *
89 * Since: 1.24
90 */
91typedef enum
92{
93 GST_GL_DISPLAY_TYPE_NONE = 0,
94 GST_GL_DISPLAY_TYPE_X11 = (1 << 0),
95 GST_GL_DISPLAY_TYPE_WAYLAND = (1 << 1),
96 GST_GL_DISPLAY_TYPE_COCOA = (1 << 2),
97 GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
98 GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
99 GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
100 GST_GL_DISPLAY_TYPE_VIV_FB = (1 << 6),
101 GST_GL_DISPLAY_TYPE_GBM = (1 << 7),
102 GST_GL_DISPLAY_TYPE_EGL_DEVICE = (1 << 8),
103 GST_GL_DISPLAY_TYPE_EAGL = (1 << 9),
104 GST_GL_DISPLAY_TYPE_WINRT = (1 << 10),
105 GST_GL_DISPLAY_TYPE_ANDROID = (1 << 11),
106 GST_GL_DISPLAY_TYPE_EGL_SURFACELESS = (1 << 12),
107
108 GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
109} GstGLDisplayType;
110
111/**
112 * GstGLDisplay:
113 *
114 * The contents of a #GstGLDisplay are private and should only be accessed
115 * through the provided API
116 */
117struct _GstGLDisplay
118{
119 /*< private >*/
120 GstObject object;
121
122 GstGLDisplayType type;
123
124 /*< protected >*/
125 GList *windows; /* internal lock, use *_window functions instead */
126 GMainContext *main_context;
127 GMainLoop *main_loop;
128 GSource *event_source;
129
130 GstGLDisplayPrivate *priv;
131};
132
133struct _GstGLDisplayClass
134{
135 GstObjectClass object_class;
136
137 guintptr (*get_handle) (GstGLDisplay * display);
138 GstGLWindow * (*create_window) (GstGLDisplay * display);
139
140 /*< private >*/
141 gpointer _padding[GST_PADDING];
142};
143
144GST_GL_API
145GstGLDisplay *gst_gl_display_new (void);
146GST_GL_API
147GstGLDisplay *gst_gl_display_new_with_type (GstGLDisplayType type);
148
149#define gst_gl_display_lock(display) GST_OBJECT_LOCK (display)
150#define gst_gl_display_unlock(display) GST_OBJECT_UNLOCK (display)
151
152GST_GL_API
153guintptr gst_gl_display_get_handle (GstGLDisplay * display);
154GST_GL_API
155GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display);
156GST_GL_API
157void gst_gl_display_filter_gl_api (GstGLDisplay * display,
158 GstGLAPI gl_api);
159GST_GL_API
160GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display);
161GST_GL_API
162GstGLAPI gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display);
163
164/**
165 * GST_GL_DISPLAY_CONTEXT_TYPE:
166 *
167 * The name used in #GstContext queries for requesting a #GstGLDisplay
168 */
169#define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay"
170GST_GL_API
171void gst_context_set_gl_display (GstContext * context, GstGLDisplay * display);
172GST_GL_API
173gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display);
174
175GST_GL_API
176gboolean gst_gl_display_create_context (GstGLDisplay * display,
177 GstGLContext * other_context, GstGLContext ** p_context, GError **error);
178GST_GL_API
179GstGLContext * gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display,
180 GThread * thread);
181GST_GL_API
182gboolean gst_gl_display_add_context (GstGLDisplay * display,
183 GstGLContext * context);
184GST_GL_API
185void gst_gl_display_remove_context (GstGLDisplay * display,
186 GstGLContext * context);
187GST_GL_API
188gboolean gst_gl_display_ensure_context (GstGLDisplay * display,
189 GstGLContext * other_context,
190 GstGLContext ** context,
191 GError ** error);
192GST_GL_API
193GstGLWindow * gst_gl_display_create_window (GstGLDisplay * display);
194GST_GL_API
195gboolean gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window);
196GST_GL_DEPRECATED_FOR(gst_gl_display_retrieve_window)
197GstGLWindow * gst_gl_display_find_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func);
198GST_GL_API
199GstGLWindow * gst_gl_display_retrieve_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func);
200
201G_END_DECLS
202
203#endif /* __GST_GL_DISPLAY_H__ */
204

source code of include/gstreamer-1.0/gst/gl/gstgldisplay.h