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 | typedef enum |
56 | { |
57 | GST_GL_DISPLAY_TYPE_NONE = 0, |
58 | GST_GL_DISPLAY_TYPE_X11 = (1 << 0), |
59 | GST_GL_DISPLAY_TYPE_WAYLAND = (1 << 1), |
60 | GST_GL_DISPLAY_TYPE_COCOA = (1 << 2), |
61 | GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3), |
62 | GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4), |
63 | GST_GL_DISPLAY_TYPE_EGL = (1 << 5), |
64 | GST_GL_DISPLAY_TYPE_VIV_FB = (1 << 6), |
65 | GST_GL_DISPLAY_TYPE_GBM = (1 << 7), |
66 | |
67 | GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32 |
68 | } GstGLDisplayType; |
69 | |
70 | /** |
71 | * GstGLDisplay: |
72 | * |
73 | * The contents of a #GstGLDisplay are private and should only be accessed |
74 | * through the provided API |
75 | */ |
76 | struct _GstGLDisplay |
77 | { |
78 | /* <private> */ |
79 | GstObject object; |
80 | |
81 | GstGLDisplayType type; |
82 | |
83 | /* <protected> */ |
84 | GList *windows; /* OBJECT lock */ |
85 | GMainContext *main_context; |
86 | GMainLoop *main_loop; |
87 | GSource *event_source; |
88 | |
89 | GstGLDisplayPrivate *priv; |
90 | }; |
91 | |
92 | struct _GstGLDisplayClass |
93 | { |
94 | GstObjectClass object_class; |
95 | |
96 | guintptr (*get_handle) (GstGLDisplay * display); |
97 | GstGLWindow * (*create_window) (GstGLDisplay * display); |
98 | |
99 | /* <private> */ |
100 | gpointer _padding[GST_PADDING]; |
101 | }; |
102 | |
103 | GST_GL_API |
104 | GstGLDisplay *gst_gl_display_new (void); |
105 | |
106 | #define gst_gl_display_lock(display) GST_OBJECT_LOCK (display) |
107 | #define gst_gl_display_unlock(display) GST_OBJECT_UNLOCK (display) |
108 | |
109 | GST_GL_API |
110 | guintptr gst_gl_display_get_handle (GstGLDisplay * display); |
111 | GST_GL_API |
112 | GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display); |
113 | GST_GL_API |
114 | void gst_gl_display_filter_gl_api (GstGLDisplay * display, |
115 | GstGLAPI gl_api); |
116 | GST_GL_API |
117 | GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display); |
118 | GST_GL_API |
119 | GstGLAPI gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display); |
120 | |
121 | /** |
122 | * GST_GL_DISPLAY_CONTEXT_TYPE: |
123 | * |
124 | * The name used in #GstContext queries for requesting a #GstGLDisplay |
125 | */ |
126 | #define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay" |
127 | GST_GL_API |
128 | void gst_context_set_gl_display (GstContext * context, GstGLDisplay * display); |
129 | GST_GL_API |
130 | gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display); |
131 | |
132 | GST_GL_API |
133 | gboolean gst_gl_display_create_context (GstGLDisplay * display, |
134 | GstGLContext * other_context, GstGLContext ** p_context, GError **error); |
135 | GST_GL_API |
136 | GstGLContext * gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display, |
137 | GThread * thread); |
138 | GST_GL_API |
139 | gboolean gst_gl_display_add_context (GstGLDisplay * display, |
140 | GstGLContext * context); |
141 | |
142 | GST_GL_API |
143 | GstGLWindow * gst_gl_display_create_window (GstGLDisplay * display); |
144 | GST_GL_API |
145 | gboolean gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window); |
146 | GST_GL_API |
147 | GstGLWindow * gst_gl_display_find_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func); |
148 | |
149 | G_END_DECLS |
150 | |
151 | #endif /* __GST_GL_DISPLAY_H__ */ |
152 | |