3 * Copyright (C) 2020 Matthew Waters <matthew@centricular.com>
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.
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.
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.
22 * SECTION:gstglcontextconfig
23 * @short_description: OpenGL context configuration values
24 * @title: GstGLContext
25 * @see_also: #GstGLContext, #GstGLWindow
27 * A common list of well-known values for what a config retrievable from or set
28 * on a `GstGLContext` may contain.
35 #include "gstglcontextconfig.h"
36 #include <gst/gl/gl.h>
39 * GST_GL_CONFIG_ATTRIB_CONFIG_ID_NAME:
41 * The platform-specific config-id. This value is not stable across different
42 * machines or even different versions of the same underlying OpenGL
48 * GST_GL_CONFIG_ATTRIB_CONFIG_ID_GTYPE:
50 * The #GType of the config-id field.
54 const gchar *GST_GL_CONFIG_ATTRIB_CONFIG_ID_NAME = "config-id";
56 * GST_GL_CONFIG_ATTRIB_PLATFORM_NAME:
58 * The #GstGLPlatform this config was made for.
63 * GST_GL_CONFIG_ATTRIB_PLATFORM_GTYPE:
65 * The #GType of the 'platform' field.
69 const gchar *GST_GL_CONFIG_ATTRIB_PLATFORM_NAME = "platform";
71 * GST_GL_CONFIG_ATTRIB_CAVEAT_NAME:
73 * Any #GstGLConfigCaveat's applied to this configuration.
78 * GST_GL_CONFIG_ATTRIB_CAVEAT_GTYPE:
80 * The #GType of the 'caveat' field.
84 const gchar *GST_GL_CONFIG_ATTRIB_CAVEAT_NAME = "caveat";
86 * GST_GL_CONFIG_ATTRIB_SURFACE_TYPE_NAME:
88 * Flags of #GstGLConfigSurfaceType's that can apply to this configuration.
93 * GST_GL_CONFIG_ATTRIB_SURFACE_TYPE_GTYPE:
95 * The #GType of the 'surface-type' field.
99 const gchar *GST_GL_CONFIG_ATTRIB_SURFACE_TYPE_NAME = "surface-type";
101 * GST_GL_CONFIG_ATTRIB_CONFORMANT_API_NAME:
103 * The #GstGLAPI's that this configuration meets the conformance requirements
109 * GST_GL_CONFIG_ATTRIB_CONFORMANT_API_GTYPE:
111 * The #GType of the 'conformant-api' field.
115 const gchar *GST_GL_CONFIG_ATTRIB_CONFORMANT_API_NAME = "conformant-api";
117 * GST_GL_CONFIG_ATTRIB_RENDERABLE_API_NAME:
119 * The #GstGLAPI's that this configuration can be rendered with.
124 * GST_GL_CONFIG_ATTRIB_RENDERABLE_API_GTYPE:
126 * The #GType of the 'renderable-api' field.
130 const gchar *GST_GL_CONFIG_ATTRIB_RENDERABLE_API_NAME = "renderable-api";
132 * GST_GL_CONFIG_ATTRIB_RED_SIZE_NAME:
134 * The size of the red buffer with a colour backing buffer.
139 * GST_GL_CONFIG_ATTRIB_RED_SIZE_GTYPE:
141 * The #GType of the 'red-size' field.
145 const gchar *GST_GL_CONFIG_ATTRIB_RED_SIZE_NAME = "red-size";
147 * GST_GL_CONFIG_ATTRIB_GREEN_SIZE_NAME:
149 * The size of the green buffer with a colour backing buffer.
154 * GST_GL_CONFIG_ATTRIB_GREEN_SIZE_GTYPE:
156 * The #GType of the 'green-size' field.
160 const gchar *GST_GL_CONFIG_ATTRIB_GREEN_SIZE_NAME = "green-size";
162 * GST_GL_CONFIG_ATTRIB_BLUE_SIZE_NAME:
164 * The size of the blue buffer with a colour backing buffer.
169 * GST_GL_CONFIG_ATTRIB_BLUE_SIZE_GTYPE:
171 * The #GType of the 'blue-size' field.
175 const gchar *GST_GL_CONFIG_ATTRIB_BLUE_SIZE_NAME = "blue-size";
177 * GST_GL_CONFIG_ATTRIB_ALPHA_SIZE_NAME:
179 * The size of the alpha buffer with a colour backing buffer.
184 * GST_GL_CONFIG_ATTRIB_ALPHA_SIZE_GTYPE:
186 * The #GType of the 'alpha-size' field.
190 const gchar *GST_GL_CONFIG_ATTRIB_ALPHA_SIZE_NAME = "alpha-size";
192 * GST_GL_CONFIG_ATTRIB_LUMINANCE_SIZE_NAME:
194 * The size of the backing luminance buffer.
199 * GST_GL_CONFIG_ATTRIB_LUMINANCE_SIZE_GTYPE:
201 * The #GType of the 'luminance-size' field.
205 const gchar *GST_GL_CONFIG_ATTRIB_LUMINANCE_SIZE_NAME = "luminance-size";
207 * GST_GL_CONFIG_ATTRIB_DEPTH_SIZE_NAME:
209 * The size of the backing depth buffer.
214 * GST_GL_CONFIG_ATTRIB_DEPTH_SIZE_GTYPE:
216 * The #GType of the 'depth-size' field.
220 const gchar *GST_GL_CONFIG_ATTRIB_DEPTH_SIZE_NAME = "depth-size";
222 * GST_GL_CONFIG_ATTRIB_STENCIL_SIZE_NAME:
224 * The size of the backing stencil buffer.
229 * GST_GL_CONFIG_ATTRIB_STENCIL_SIZE_GTYPE:
231 * The #GType of the 'stencil-size' field.
235 const gchar *GST_GL_CONFIG_ATTRIB_STENCIL_SIZE_NAME = "stencil-size";
237 * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_WIDTH_NAME:
239 * The maximum width of a pbuffer created with this config.
244 * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_WIDTH_GTYPE:
246 * The #GType of the 'max-pbuffer-width' field.
250 const gchar *GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_WIDTH_NAME = "max-pbuffer-width";
252 * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_HEIGHT_NAME:
254 * The maximum height of a pbuffer created with this config.
259 * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_HEIGHT_GTYPE:
261 * The #GType of the 'max-pbuffer-height' field.
265 const gchar *GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_HEIGHT_NAME =
266 "max-pbuffer-height";
268 * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_PIXELS_NAME:
270 * The maximum number of pixels that a pbuffer can be created with this config.
275 * GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_PIXELS_GTYPE:
277 * The #GType of the 'max-pbuffer-pixels' field.
281 const gchar *GST_GL_CONFIG_ATTRIB_MAX_PBUFFER_PIXELS_NAME =
282 "max-pbuffer-pixels";
284 * GST_GL_CONFIG_ATTRIB_SAMPLE_BUFFERS_NAME:
286 * The number of sample buffers for this config.
291 * GST_GL_CONFIG_ATTRIB_SAMPLE_BUFFERS_GTYPE:
293 * The #GType of the 'sample-buffers' field.
297 const gchar *GST_GL_CONFIG_ATTRIB_SAMPLE_BUFFERS_NAME = "sample-buffers";
299 * GST_GL_CONFIG_ATTRIB_SAMPLES_NAME:
301 * The number of samples per pixel for this config.
306 * GST_GL_CONFIG_ATTRIB_SAMPLES_GTYPE:
308 * The #GType of the 'samples' field.
312 const gchar *GST_GL_CONFIG_ATTRIB_SAMPLES_NAME = "samples";
314 * GST_GL_CONFIG_ATTRIB_NATIVE_RENDERABLE_NAME:
316 * Whether this configuration is renderable to by the native drawing API.
321 * GST_GL_CONFIG_ATTRIB_NATIVE_RENDERABLE_GTYPE:
323 * The #GType of the 'native-renderable' field.
327 const gchar *GST_GL_CONFIG_ATTRIB_NATIVE_RENDERABLE_NAME = "native-renderable";
329 * GST_GL_CONFIG_ATTRIB_NATIVE_VISUAL_ID_NAME:
331 * The native visual ID of this config. This value may not be consistent
332 * across machines or even dependency versions.
337 * GST_GL_CONFIG_ATTRIB_NATIVE_VISUAL_ID_GTYPE:
339 * The #GType of the 'native-visual-id' field.
343 const gchar *GST_GL_CONFIG_ATTRIB_NATIVE_VISUAL_ID_NAME = "native-visual-id";
345 * GST_GL_CONFIG_ATTRIB_LEVEL_NAME:
347 * Level of the under/overlay of this config. Positive values correspond to
348 * overlay, negative values are underlay.
353 * GST_GL_CONFIG_ATTRIB_LEVEL_GTYPE:
355 * The #GType of the 'level' field.
359 const gchar *GST_GL_CONFIG_ATTRIB_LEVEL_NAME = "level";
361 * GST_GL_CONFIG_ATTRIB_MIN_SWAP_INTERVAL_NAME:
363 * The minimum value available for vsync synchronisation.
368 * GST_GL_CONFIG_ATTRIB_MIN_SWAP_INTERVAL_GTYPE:
370 * The #GType of the 'min-swap-interval' field.
374 const gchar *GST_GL_CONFIG_ATTRIB_MIN_SWAP_INTERVAL_NAME = "min-swap-interval";
376 * GST_GL_CONFIG_ATTRIB_MAX_SWAP_INTERVAL_NAME:
378 * The maximum value available for vsync synchronisation.
383 * GST_GL_CONFIG_ATTRIB_MAX_SWAP_INTERVAL_GTYPE:
385 * The #GType of the 'max-swap-interval' field.
389 const gchar *GST_GL_CONFIG_ATTRIB_MAX_SWAP_INTERVAL_NAME = "max-swap-interval";
392 gst_gl_enum_value_to_const_string (GType type, guint value)
394 GEnumClass *enum_class;
395 GEnumValue *enum_value;
396 const gchar *str = NULL;
398 enum_class = g_type_class_ref (type);
399 enum_value = g_enum_get_value (enum_class, value);
402 str = enum_value->value_nick;
404 g_type_class_unref (enum_class);
410 * gst_gl_config_caveat_to_string:
411 * @caveat: the #GstGLConfigCaveat
413 * Returns: (nullable): a string version of @caveat or %NULL if @caveat does not
419 gst_gl_config_caveat_to_string (GstGLConfigCaveat caveat)
421 return gst_gl_enum_value_to_const_string (GST_TYPE_GL_CONFIG_CAVEAT, caveat);
425 * gst_gl_config_surface_type_to_string:
426 * @surface_type: the #GstGLConfigSurfaceType
428 * Returns: (nullable): a string version of @caveat or %NULL if @surface_type does not
434 gst_gl_config_surface_type_to_string (GstGLConfigSurfaceType surface_type)
436 return gst_gl_enum_value_to_const_string (GST_TYPE_GL_CONFIG_SURFACE_TYPE,