glbuffer: support persistent buffer mappings
[platform/upstream/gst-plugins-base.git] / gst-libs / gst / gl / meson.build
1 if get_option('gl').disabled()
2   message('GStreamer OpenGL integration disabled via options.')
3   gstgl_dep = dependency('', required: false)
4   build_gstgl = false
5   subdir_done()
6 endif
7
8 gl_sources = [
9   'gstglapi.c',
10   'gstglbasefilter.c',
11   'gstglbasememory.c',
12   'gstglbasesrc.c',
13   'gstglcolorconvert.c',
14   'gstglbuffer.c',
15   'gstglbufferpool.c',
16   'gstglcontext.c',
17   'gstglcontextconfig.c',
18   'gstgldebug.c',
19   'gstgldisplay.c',
20   'gstglfeature.c',
21   'gstglfilter.c',
22   'gstglformat.c',
23   'gstglframebuffer.c',
24   'gstglmemory.c',
25   'gstglmemorypbo.c',
26   'gstgloverlaycompositor.c',
27   'gstglquery.c',
28   'gstglrenderbuffer.c',
29   'gstglshader.c',
30   'gstglshaderstrings.c',
31   'gstglsl.c',
32   'gstglslstage.c',
33   'gstglsyncmeta.c',
34   'gstglupload.c',
35   'gstglutils.c',
36   'gstglviewconvert.c',
37   'gstglwindow.c',
38 ]
39
40 gl_priv_sources = []
41
42 gir_gl_headers = [
43   'gl.h',
44   'gl-prelude.h',
45   'gstgl_enums.h',
46   'gstgl_fwd.h',
47   'gstglapi.h',
48   'gstglbasefilter.h',
49   'gstglbasememory.h',
50   'gstglbasesrc.h',
51   'gstglbuffer.h',
52   'gstglbufferpool.h',
53   'gstglcolorconvert.h',
54   'gstglcontext.h',
55   'gstglcontextconfig.h',
56   'gstgldebug.h',
57   'gstgldisplay.h',
58   'gstglfeature.h',
59   'gstglfilter.h',
60   'gstglformat.h',
61   'gstglframebuffer.h',
62   'gstglmemory.h',
63   'gstglmemorypbo.h',
64   'gstgloverlaycompositor.h',
65   'gstglquery.h',
66   'gstglrenderbuffer.h',
67   'gstglshader.h',
68   'gstglshaderstrings.h',
69   'gstglsl.h',
70   'gstglslstage.h',
71   'gstglsyncmeta.h',
72   'gstglupload.h',
73   'gstglutils.h',
74   'gstglviewconvert.h',
75   'gstglwindow.h',
76 ]
77
78 gl_headers = gir_gl_headers + [
79   'gstglfuncs.h',
80 ]
81
82 gl_prototype_headers = [
83   'glprototypes/all_functions.h',
84   'glprototypes/base.h',
85   'glprototypes/buffer_storage.h',
86   'glprototypes/blending.h',
87   'glprototypes/buffers.h',
88   'glprototypes/debug.h',
89   'glprototypes/eglimage.h',
90   'glprototypes/fbo.h',
91   'glprototypes/fixedfunction.h',
92   'glprototypes/gles.h',
93   'glprototypes/gstgl_compat.h',
94   'glprototypes/gstgl_gles2compat.h',
95   'glprototypes/opengl.h',
96   'glprototypes/query.h',
97   'glprototypes/shaders.h',
98   'glprototypes/sync.h',
99   'glprototypes/vao.h',
100 ]
101
102 gl_x11_sources = []
103 gl_x11_headers = []
104 gl_wayland_sources = []
105 gl_wayland_headers = []
106 gl_egl_sources = []
107 gl_egl_headers = []
108
109 glconf = configuration_data()
110 glconf_options = [
111     'GST_GL_HAVE_OPENGL',
112     'GST_GL_HAVE_GLES2',
113     'GST_GL_HAVE_GLES3',
114     'GST_GL_HAVE_GLES3EXT3_H',
115
116     'GST_GL_HAVE_WINDOW_X11',
117     'GST_GL_HAVE_WINDOW_COCOA',
118     'GST_GL_HAVE_WINDOW_WIN32',
119     'GST_GL_HAVE_WINDOW_WINRT',
120     'GST_GL_HAVE_WINDOW_WAYLAND',
121     'GST_GL_HAVE_WINDOW_ANDROID',
122     'GST_GL_HAVE_WINDOW_DISPMANX',
123     'GST_GL_HAVE_WINDOW_EAGL',
124     'GST_GL_HAVE_WINDOW_VIV_FB',
125     'GST_GL_HAVE_WINDOW_GBM',
126
127     'GST_GL_HAVE_PLATFORM_EGL',
128     'GST_GL_HAVE_PLATFORM_GLX',
129     'GST_GL_HAVE_PLATFORM_WGL',
130     'GST_GL_HAVE_PLATFORM_CGL',
131     'GST_GL_HAVE_PLATFORM_EAGL',
132
133     'GST_GL_HAVE_DMABUF',
134     'GST_GL_HAVE_VIV_DIRECTVIV',
135
136     'GST_GL_HAVE_GLEGLIMAGEOES',
137     'GST_GL_HAVE_GLCHAR',
138     'GST_GL_HAVE_GLSIZEIPTR',
139     'GST_GL_HAVE_GLINTPTR',
140     'GST_GL_HAVE_GLSYNC',
141     'GST_GL_HAVE_GLUINT64',
142     'GST_GL_HAVE_GLINT64',
143     'GST_GL_HAVE_EGLATTRIB',
144     'GST_GL_HAVE_EGLUINT64KHR',
145 ]
146
147 foreach option : glconf_options
148   glconf.set10(option, false)
149 endforeach
150
151 unneeded_dep = dependency('', required : false)
152 if unneeded_dep.found()
153   error ('Found unfindable dependency')
154 endif
155
156 # OpenGL/GLES2 libraries
157 gl_lib_deps = []
158 # GL platform - EGL, GLX, CGL, WGL, etc
159 gl_platform_deps = []
160 # GL winsys - wayland, X11, Cocoa, win32, etc
161 gl_winsys_deps = []
162 # other things we need.
163 gl_misc_deps = []
164 # Other preprocessor arguments
165 gl_cpp_args = []
166 gl_includes = []
167 gl_objc_args = []
168
169 enabled_gl_apis = []
170 enabled_gl_platforms = []
171 enabled_gl_winsys = []
172
173 # parse provided options
174 libegl_module_name = get_option('egl_module_name')
175 if libegl_module_name != ''
176   gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
177 endif
178 libgles2_module_name = get_option('gles2_module_name')
179 if libgles2_module_name != ''
180   gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
181 endif
182 libgl_module_name = get_option('opengl_module_name')
183 if libgl_module_name != ''
184   gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
185 endif
186
187 gl_apis = get_option('gl_api')
188 if gl_apis.contains('auto')
189   need_api_opengl = 'auto'
190   need_api_gles2 = 'auto'
191 else
192   need_api_opengl = 'no'
193   need_api_gles2 = 'no'
194   foreach api : gl_apis
195     if api == 'opengl'
196       need_api_opengl = 'yes'
197     elif api == 'gles2'
198       need_api_gles2 = 'yes'
199     else
200       error('Unsupported GL api provided ' + api)
201     endif
202   endforeach
203 endif
204
205 gl_platforms = get_option('gl_platform')
206 if gl_platforms.contains('auto')
207   need_platform_egl = 'auto'
208   need_platform_glx = 'auto'
209   need_platform_cgl = 'auto'
210   need_platform_wgl = 'auto'
211   need_platform_eagl = 'auto'
212 else
213   need_platform_egl = 'no'
214   need_platform_glx = 'no'
215   need_platform_cgl = 'no'
216   need_platform_wgl = 'no'
217   need_platform_eagl = 'no'
218   foreach platform : gl_platforms
219     if platform == 'egl'
220       need_platform_egl = 'yes'
221     elif platform == 'glx'
222       need_platform_glx = 'yes'
223     elif platform == 'cgl'
224       need_platform_cgl = 'yes'
225     elif platform == 'wgl'
226       need_platform_wgl = 'yes'
227     elif platform == 'eagl'
228       need_platform_eagl = 'yes'
229     else
230       error('Unsupported GL platform provided ' + platform)
231     endif
232   endforeach
233 endif
234
235 gl_winsys = get_option('gl_winsys')
236 if gl_winsys.contains('auto')
237   need_win_x11 = 'auto'
238   need_win_wayland = 'auto'
239   need_win_win32 = 'auto'
240   need_win_winrt = 'auto'
241   need_win_cocoa = 'auto'
242   need_win_egl = 'auto'
243   need_win_eagl = 'auto'
244   need_win_dispmanx = 'auto'
245   need_win_viv_fb = 'auto'
246   need_win_gbm = 'auto'
247   need_win_android = 'auto'
248 else
249   need_win_x11 = 'no'
250   need_win_wayland = 'no'
251   need_win_win32 = 'no'
252   need_win_winrt = 'no'
253   need_win_cocoa = 'no'
254   need_win_egl = 'no'
255   need_win_eagl = 'no'
256   need_win_dispmanx = 'no'
257   need_win_viv_fb = 'no'
258   need_win_gbm = 'no'
259   need_win_android = 'no'
260   foreach winsys : gl_winsys
261     if winsys == 'x11'
262       need_win_x11 = 'yes'
263     elif winsys == 'wayland'
264       need_win_wayland = 'yes'
265     elif winsys == 'win32'
266       need_win_win32 = 'yes'
267     elif winsys == 'winrt'
268       need_win_winrt = 'yes'
269     elif winsys == 'cocoa'
270       need_win_cocoa = 'yes'
271     elif winsys == 'egl'
272       need_win_egl = 'yes'
273     elif winsys == 'eagl'
274       need_win_eagl = 'yes'
275     elif winsys == 'dispmanx'
276       need_win_dispmanx = 'yes'
277     elif winsys == 'viv-fb'
278       need_win_viv_fb = 'yes'
279     elif winsys == 'gbm'
280       need_win_gbm = 'yes'
281     elif winsys == 'android'
282       need_win_android = 'yes'
283     else
284       error('Unsupported GL winsys provided ' + winsys)
285     endif
286   endforeach
287 endif
288
289 gl_include_header = '''
290 #ifdef __GNUC__
291 #  pragma GCC diagnostic push
292 #  pragma GCC diagnostic ignored "-Wredundant-decls"
293 #endif
294 #ifndef GL_GLEXT_PROTOTYPES
295 #define GL_GLEXT_PROTOTYPES 1
296 #endif
297 '''
298
299 # convoluted way of getting at the subproject taking into account the wrap-mode
300 # so we don't download a subproject unless allowed
301 gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
302     required : false)
303 if gl_header_dep.type_name() == 'internal'
304   # this will only contain the includes of headers that are not found
305   compat_includes = subproject('gl-headers').get_variable('compatibility_includes')
306 else
307   compat_includes = []
308 endif
309
310 # Desktop OpenGL checks
311 gl_dep = unneeded_dep
312 glx_dep = unneeded_dep
313
314 # (GLVND) OpenGL (without GLX) headers and interface
315 if need_api_opengl != 'no'
316   gl_dep = dependency('opengl', method: 'pkg-config', required : false)
317 endif
318
319 # non-GLVND aka Legacy OpenGL
320 if need_api_opengl != 'no' and not gl_dep.found()
321   if host_system == 'darwin'
322     gl_dep = dependency('appleframeworks', modules : ['OpenGL'], required : false)
323   else
324     # override meson's braindead gl detection on osx/windows/etc by forcing pkg-config
325     gl_dep = dependency('gl', method: 'pkg-config', required : false)
326   endif
327
328   if not gl_dep.found()
329     if host_system == 'windows'
330       gl_dep = cc.find_library('opengl32', required : false)
331     else
332       gl_dep = cc.find_library('GL', required : false)
333     endif
334
335     if not cc.has_header('GL/gl.h', include_directories : compat_includes)
336       gl_dep = unneeded_dep
337     endif
338
339     if not gl_dep.found() and need_api_opengl == 'yes'
340       error ('Could not find requested OpenGL library')
341     endif
342
343     if gl_dep.found()
344       gl_includes += [compat_includes]
345     endif
346   endif
347 endif
348
349 if need_platform_glx != 'no'
350   # (GLVND) GLX library and headers.
351   glx_dep = dependency('glx', method: 'pkg-config', required : false)
352
353   if not glx_dep.found()
354     if host_system == 'darwin'
355       glx_dep = cc.find_library('GL', required : false)
356     elif gl_dep.found()
357       glx_dep = gl_dep
358     elif need_platform_glx == 'yes'
359       error ('Could not find requested GLX library')
360     endif
361   endif
362 endif
363
364 if need_api_opengl != 'no'
365   opengl_includes = ''
366   if host_system == 'darwin'
367     opengl_includes += '''
368 #if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1014
369 # define GL_SILENCE_DEPRECATION
370 #endif
371 #include <OpenGL/OpenGL.h>
372 #include <OpenGL/gl.h>
373 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
374 # define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
375 # include <OpenGL/gl3.h>
376 #endif
377 '''
378   else
379     opengl_includes += '''
380 #if _MSC_VER
381 # include <windows.h>
382 #endif
383 #include <GL/gl.h>
384 #if __WIN32__ || _WIN32
385 # include <GL/glext.h>
386 #endif
387 '''
388   endif
389 endif
390
391 bcm_host_dep = unneeded_dep
392 if need_win_dispmanx != 'no'
393
394   # Try pkg-config for bcm_host then fallback to find_library to also
395   # support older distribution
396   bcm_host_dep = dependency('bcm_host', required : false)
397   if not bcm_host_dep.found()
398     bcm_host_dep = cc.find_library('bcm_host', required : false)
399   endif
400 endif
401
402 # GLES2 checks
403 gles2_dep = unneeded_dep
404 gles3_h = false
405 gles3ext3_h = false
406 if need_api_gles2 != 'no'
407   if host_system == 'ios'
408     gles2_dep = dependency('appleframeworks', modules : ['OpenGLES'], required : false)
409   else
410     if bcm_host_dep.found()
411       gles2_dep = dependency('brcmglesv2', required : false)
412     endif
413     if not gles2_dep.found()
414       gles2_dep = dependency('glesv2', required : false)
415     endif
416   endif
417
418   if not gles2_dep.found()
419 #    if host_system == 'windows'
420 #    elif host_system == ios
421 #      gles2_dep = cc.find_library('GLESv2', required : false)
422 #    else
423       gles2_dep = cc.find_library('GLESv2', required : false)
424 #    endif
425
426     if not cc.has_header('GLES2/gl2.h', include_directories : compat_includes)
427       gles2_dep = unneeded_dep
428     endif
429
430     if not gles2_dep.found() and need_api_gles2 == 'yes'
431       error ('Could not find requested OpenGL ES library')
432     endif
433
434     if gles2_dep.found()
435       gl_includes += [compat_includes]
436     endif
437   endif
438
439   gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', dependencies : gles2_dep, include_directories : compat_includes)
440
441   gles_includes = ''
442   if host_system == 'ios'
443     gles_includes += '''
444 # include <OpenGLES/ES2/gl.h>
445 # include <OpenGLES/ES2/glext.h>
446 '''
447   else
448     if gles3_h
449       gl_includes += [compat_includes]
450       gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', dependencies : gles2_dep, include_directories : compat_includes)
451       gles_includes += '''
452 # include <GLES3/gl3.h>
453 # include <GLES2/gl2ext.h>'''
454       if gles3ext3_h
455         gles_includes += '''
456 # include <GLES3/gl3ext.h>'''
457       endif
458     else
459       gles_includes += '''
460 # include <GLES2/gl2.h>
461 # include <GLES2/gl2ext.h>'''
462     endif
463   endif
464 endif
465
466 # can we include both gles2 and opengl headers?
467 if gles2_dep.found() and gl_dep.found()
468   gl_include_block = gl_include_header + gles_includes + opengl_includes
469   # TODO: Revert to passing gl_include_block via prefix: once
470   # https://github.com/mesonbuild/meson/issues/2364 is fixed
471   if not cc.compiles(gl_include_block + '\n' + 'void f (void) {}',dependencies : [gles2_dep, gl_dep], include_directories : compat_includes)
472     message ('Cannot include both OpenGL and OpenGL ES headers')
473     if need_api_gles2 != 'yes'
474       gles2_dep = unneeded_dep
475     elif need_api_opengl != 'yes'
476       gl_dep = unneeded_dep
477     else
478       error('Both OpenGL and OpenGL ES were requested but cannot be included together')
479     endif
480   endif
481 endif
482 gl_include_block = gl_include_header
483 if gles2_dep.found()
484   gl_include_block += gles_includes
485 endif
486 if gl_dep.found()
487   gl_include_block += opengl_includes
488 endif
489
490 if gles2_dep.found()
491   gl_lib_deps += gles2_dep
492   glconf.set10('GST_GL_HAVE_GLES2', 1)
493   if gles3_h
494     glconf.set10('GST_GL_HAVE_GLES3', 1)
495     if gles3ext3_h
496       glconf.set10('GST_GL_HAVE_GLES3EXT3_H', 1)
497     endif
498   endif
499   enabled_gl_apis += 'gles2'
500 endif
501
502 if gl_dep.found()
503   gl_lib_deps += gl_dep
504   glconf.set10('GST_GL_HAVE_OPENGL', 1)
505   enabled_gl_apis += 'gl'
506 endif
507
508 # EGL checks
509 egl_dep = unneeded_dep
510 if need_platform_egl != 'no'
511   if bcm_host_dep.found()
512     egl_dep = dependency('brcmegl', required : false)
513   endif
514   if not egl_dep.found()
515     egl_dep = dependency('egl', required : false)
516   endif
517   if not egl_dep.found()
518     egl_dep = cc.find_library('EGL', required : false)
519   endif
520
521   if egl_dep.found() and not cc.has_header('EGL/egl.h',
522                                            dependencies : egl_dep,
523                                            include_directories : compat_includes)
524     egl_dep = unneeded_dep
525   endif
526   if egl_dep.found() and not cc.has_header('EGL/eglext.h',
527                                            dependencies : egl_dep,
528                                            include_directories : compat_includes)
529     egl_dep = unneeded_dep
530   endif
531
532   if egl_dep.found()
533     gl_egl_sources += [
534       'egl/gstegl.c',
535       'egl/gsteglimage.c',
536       'egl/gstglcontext_egl.c',
537       'egl/gstgldisplay_egl.c',
538       'egl/gstglmemoryegl.c',
539       'egl/gstgldisplay_egl_device.c',
540     ]
541     gl_egl_headers += [
542       'egl/egl.h',
543       'egl/gstegl.h',
544       'egl/gsteglimage.h',
545       'egl/gstgldisplay_egl.h',
546       'egl/gstglmemoryegl.h',
547       'egl/gstgldisplay_egl_device.h',
548     ]
549     gl_platform_deps += egl_dep
550     glconf.set10('GST_GL_HAVE_PLATFORM_EGL', 1)
551
552     if cc.has_header('libdrm/drm_fourcc.h')
553       gl_misc_deps += allocators_dep
554       glconf.set10('GST_GL_HAVE_DMABUF', 1)
555     endif
556
557     egl_includes = '''
558 #include <EGL/egl.h>
559 #include <EGL/eglext.h>
560 '''
561     enabled_gl_platforms += 'egl'
562   elif need_platform_egl == 'yes'
563     error ('Could not find requested EGL library')
564   endif
565 endif
566
567 # winsys_egl checks
568 if need_win_egl == 'yes'
569   if need_platform_egl == 'no'
570     error('Impossible situation requested: Cannot use Winsys egl without EGL support')
571   elif not egl_dep.found()
572     error ('Could not find EGL libraries for Winsys egl')
573   else
574     enabled_gl_winsys += 'egl'
575   endif
576 endif
577
578 # wayland checks
579 wayland_client_dep = unneeded_dep
580 wayland_cursor_dep = unneeded_dep
581 wayland_egl_dep = unneeded_dep
582 if need_win_wayland != 'no'
583   if need_win_wayland == 'yes'
584     if need_platform_egl == 'no'
585       error('Impossible situation requested: Cannot use Wayland without EGL support')
586     endif
587   endif
588   if not egl_dep.found()
589     if need_win_wayland == 'yes'
590       error ('Could not find EGL libraries for wayland')
591     else
592       message ('Could not find EGL libraries for wayland')
593     endif
594   else
595     wayland_client_dep = dependency('wayland-client', version : '>= 1.11', required : false)
596     wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
597     wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
598     wayland_protocols_dep = dependency('wayland-protocols', version : '>= 1.15', required : false)
599     wayland_scanner = find_program('wayland-scanner', required: false)
600
601     if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found() and wayland_protocols_dep.found() and wayland_scanner.found()
602       # Generate the XDG shell interface
603       wayland_protocols_basedir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
604       xdg_shell_xml_spec = join_paths(wayland_protocols_basedir, 'stable', 'xdg-shell', 'xdg-shell.xml')
605       xdg_shell_header = custom_target('xdg-shell-client-header',
606         command: [ wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@' ],
607         input: xdg_shell_xml_spec,
608         output: 'xdg-shell-client-protocol.h',
609       )
610       xdg_shell_code = custom_target('xdg-shell-client-code',
611         command: [ wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@' ],
612         input: xdg_shell_xml_spec,
613         output: 'xdg-shell-client-protocol.c',
614       )
615
616       gl_wayland_sources += [
617         'wayland/gstgldisplay_wayland.c',
618       ]
619       gl_priv_sources += [
620         'wayland/gstglwindow_wayland_egl.c',
621         'wayland/wayland_event_source.c',
622         xdg_shell_header,
623         xdg_shell_code,
624       ]
625       gl_wayland_headers += [
626         'wayland/wayland.h',
627         'wayland/gstgldisplay_wayland.h'
628       ]
629       glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
630       gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
631       enabled_gl_winsys += 'wayland'
632     else
633       if need_win_wayland == 'yes'
634         error ('Could not find requested Wayland libraries')
635       endif
636       wayland_client_dep = unneeded_dep
637       wayland_cursor_dep = unneeded_dep
638       wayland_egl_dep = unneeded_dep
639       wayland_protocols_dep = unneeded_dep
640     endif
641   endif
642 endif
643
644 # X11 checks
645 if need_platform_glx == 'yes'
646   if need_win_x11 == 'no'
647     error('Impossible situation requested: Cannot use GLX without X11 support')
648   elif need_api_opengl == 'no'
649     error('Impossible situation requested: Cannot use GLX without the OpenGL library')
650   endif
651 endif
652
653 if need_win_x11 != 'no'
654   xcb_dep = dependency('x11-xcb', required : false)
655   if x11_dep.found() and xcb_dep.found()
656     gl_x11_sources += [
657       'x11/gstgldisplay_x11.c',
658     ]
659     gl_priv_sources += [
660       'x11/gstglwindow_x11.c',
661       'x11/xcb_event_source.c',
662     ]
663     gl_x11_headers += [
664       'x11/x11.h',
665       'x11/gstgldisplay_x11.h',
666     ]
667     glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
668     gl_winsys_deps += [x11_dep, xcb_dep]
669     enabled_gl_winsys += 'x11'
670
671     if need_platform_glx != 'no' and glx_dep.found() and cc.has_function ('glXMakeCurrent', dependencies : glx_dep)
672       glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
673       gl_priv_sources += [
674         'x11/gstglcontext_glx.c',
675       ]
676       # GLX is in the opengl library on linux
677       gl_platform_deps += glx_dep
678       enabled_gl_platforms += 'glx'
679     endif
680   elif need_win_x11 == 'yes'
681     error ('Could not find requested X11 libraries')
682   endif
683 endif
684
685 if need_win_dispmanx != 'no'
686   if bcm_host_dep.found()
687     if not egl_dep.found()
688       error('dispmanx requires the use of egl')
689     endif
690
691     gl_priv_sources += [
692       'dispmanx/gstglwindow_dispmanx_egl.c'
693     ]
694
695     glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
696     gl_winsys_deps += bcm_host_dep
697     enabled_gl_winsys += 'dispmanx'
698     gl_cpp_args += ['-DUSE_EGL_RPI']
699   elif need_win_dispmanx == 'yes'
700     error('Could not find dispmanx libraries')
701   endif
702 endif
703
704 # win32 checks
705 if need_platform_wgl == 'yes'
706   if need_win_win32 == 'no'
707     error('Impossible situation requested: Cannot use WGL without the win32 window system')
708   endif
709 endif
710
711 if host_system == 'windows' and need_win_win32 != 'no'
712   gdi_dep = cc.find_library('gdi32', required : false)
713   if gdi_dep.found()
714     have_wgl = false
715     have_egl_win32 = false
716     if need_platform_wgl != 'no'
717       wglext_h = cc.has_header('GL/wglext.h',
718                                prefix : '''#include <windows.h>
719                                            #include <GL/gl.h>''',
720                                include_directories : compat_includes)
721       have_wgl = wglext_h and gl_dep.found()
722     endif
723
724     have_egl_win32 = enabled_gl_platforms.contains('egl') and gles2_dep.found()
725     if have_wgl or have_egl_win32
726       gl_includes += [compat_includes]
727       gl_platform_deps += gdi_dep
728       gl_priv_sources += [
729         'win32/gstglwindow_win32.c',
730       ]
731       enabled_gl_winsys += 'win32'
732       gl_winsys_deps += gdi_dep
733       glconf.set('GST_GL_HAVE_WINDOW_WIN32', 1)
734     endif
735
736     if have_wgl
737       gl_priv_sources += [
738         'wgl/gstglcontext_wgl.c',
739       ]
740       enabled_gl_platforms += 'wgl'
741       glconf.set('GST_GL_HAVE_PLATFORM_WGL', 1)
742     endif
743   endif
744 endif
745
746 # WinRT ANGLE checks
747 if need_win_winrt != 'no' and host_system == 'windows'
748   if need_win_winrt == 'yes' and not enabled_gl_platforms.contains('egl')
749     error('Impossible situation requested: Cannot use WinRT ANGLE without EGL support')
750   endif
751
752   if egl_dep.found()
753     windows_graphics_h = cc.has_header('windows.graphics.h')
754     windows_app_dep = cc.find_library('WindowsApp', required: false)
755     runtimeobject_lib = cc.find_library('runtimeobject', required: false)
756
757     if windows_graphics_h and windows_app_dep.found() and runtimeobject_lib.found()
758       enabled_gl_winsys += 'winrt'
759       glconf.set10('GST_GL_HAVE_WINDOW_WINRT', 1)
760       gl_priv_sources += [
761         'winrt/gstglwindow_winrt_egl.cpp'
762       ]
763       gl_winsys_deps += runtimeobject_lib
764     elif need_win_winrt == 'yes'
765       error('WinRT is enabled, but headers/libraries were not found')
766     endif
767   elif need_win_winrt == 'yes'
768     error('WinRT ANGLE is enabled, but EGL was not found')
769   else
770     message('WinRT ANGLE disabled because EGL was not found')
771   endif
772 endif
773
774 if ['darwin', 'ios'].contains(host_system)
775   if not have_objc
776     error('No ObjC compiler found')
777   endif
778
779   objc = meson.get_compiler('objc')
780   if not objc.has_argument('-fobjc-arc')
781     error('ARC is required for building')
782   endif
783
784   gl_objc_args += ['-fobjc-arc']
785 endif
786
787 # OSX check
788 if need_platform_cgl == 'yes'
789   if need_win_cocoa == 'no'
790     error('Impossible situation requested: Cannot use CGL without Cocoa support')
791   elif need_api_opengl == 'no'
792     error('Impossible situation requested: Cannot use CGL without the OpenGL library')
793   endif
794 elif need_platform_cgl == 'no' and need_win_cocoa == 'yes'
795   error('Impossible situation requested: Cannot use Cocoa without CGL support')
796 endif
797
798 if host_system == 'darwin'
799   foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
800   quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
801   corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
802
803   if need_platform_cgl != 'no'
804     if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found()
805       gl_platform_deps += [quartzcore_dep, corefoundation_dep, foundation_dep]
806       enabled_gl_platforms += 'cgl'
807       glconf.set10('GST_GL_HAVE_PLATFORM_CGL', 1)
808
809       if need_win_cocoa != 'no'
810         cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : false)
811         if cocoa_dep.found()
812           gl_priv_sources += [
813             'cocoa/gstglcaopengllayer.m',
814             'cocoa/gstglcontext_cocoa.m',
815             'cocoa/gstgldisplay_cocoa.m',
816             'cocoa/gstglwindow_cocoa.m'
817           ]
818           gl_winsys_deps += cocoa_dep
819           enabled_gl_winsys += 'cocoa'
820           glconf.set10('GST_GL_HAVE_WINDOW_COCOA', 1)
821         elif need_win_cocoa == 'yes'
822           error('Could not find Cocoa')
823         endif
824       endif
825     elif need_platform_cgl == 'yes'
826       error('Could not find CGL dependencies')
827     endif
828   endif
829 endif
830
831 if need_platform_eagl == 'yes'
832   if host_system != 'ios'
833     error('Can only use EAGL on iOS')
834   endif
835   if need_win_eagl == 'no'
836     error('Impossible situation requested: Cannot use EAGL platform without the EAGL window system')
837   elif need_api_gles == 'no'
838     error('Impossible situation requested: Cannot use EAGL platform without the GLES library')
839   endif
840 elif need_platform_eagl == 'no' and need_win_eagl == 'yes'
841   error('Impossible situation requested: Cannot use EAGL window system without the EAGL platform')
842 endif
843
844 if host_system == 'ios' and need_platform_eagl != 'no' and need_win_eagl != 'no'
845   foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : false)
846   corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : false)
847   coregraphics_dep = dependency('appleframeworks', modules : ['CoreGraphics'], required : false)
848   quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : false)
849   uikit_dep = dependency('appleframeworks', modules : ['UIkit'], required : false)
850
851   if foundation_dep.found() and corefoundation_dep.found() and coregraphics_dep.found() and quartzcore_dep.found() and uikit_dep.found()
852     gl_platform_deps += [
853       corefoundation_dep,
854       foundation_dep,
855       coregraphics_dep,
856       quartzcore_dep,
857       uikit_dep,
858     ]
859     gl_priv_sources += [
860       'eagl/gstglcontext_eagl.m',
861       'eagl/gstglwindow_eagl.m',
862     ]
863     enabled_gl_winsys += 'eagl'
864     enabled_gl_platforms += 'eagl'
865     glconf.set('GST_GL_HAVE_WINDOW_EAGL', 1)
866     glconf.set('GST_GL_HAVE_PLATFORM_EAGL', 1)
867   elif need_platform_eagl == 'yes' or need_win_eagl == 'yes'
868     error('Could not find dependencies for EAGL')
869   endif
870 endif
871
872 # GBM Checks
873 gbm_gudev_dep = unneeded_dep
874 gbm_libdrm_dep = unneeded_dep
875 gbm_dep = unneeded_dep
876 if need_win_gbm != 'no'
877   if need_win_gbm == 'yes'
878     if need_platform_egl == 'no'
879       error('Impossible situation requested: Cannot use GBM without EGL support')
880     endif
881   endif
882
883   gbm_gudev_dep = dependency('gudev-1.0', version : '>=147', required : false)
884   gbm_libdrm_dep = dependency('libdrm', version : '>= 2.4.55', required : false)
885   gbm_dep = dependency('gbm', required : false)
886   if egl_dep.found() and gbm_gudev_dep.found() and gbm_libdrm_dep.found() and gbm_dep.found()
887     gl_priv_sources += [
888       'gbm/gstgldisplay_gbm.c',
889       'gbm/gstgl_gbm_utils.c',
890       'gbm/gstglwindow_gbm_egl.c',
891     ]
892     enabled_gl_winsys += 'gbm'
893     gl_winsys_deps += [gbm_gudev_dep, gbm_libdrm_dep, gbm_dep]
894     glconf.set('GST_GL_HAVE_WINDOW_GBM', 1)
895   else
896     if need_win_gbm == 'yes'
897       error ('Could not find requested GBM libraries')
898     endif
899     gbm_gudev_dep = unneeded_dep
900     gbm_libdrm_dep = unneeded_dep
901     gbm_dep = unneeded_dep
902   endif
903 endif
904
905 if need_platform_egl != 'no' and need_win_viv_fb != 'no'
906   if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
907     if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
908       enabled_gl_winsys += 'viv-fb'
909       glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1)
910       glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1)
911       gl_priv_sources += [
912         'viv-fb/gstgldisplay_viv_fb.c',
913         'viv-fb/gstglwindow_viv_fb_egl.c',
914       ]
915       gl_cpp_args += ['-DEGL_API_FB']
916     endif
917   endif
918 endif
919
920 if need_win_android == 'yes'
921   if need_platform_egl == 'no'
922     error('Impossible situation requested: Cannot build for Android without EGL')
923   elif need_api_gles2 == 'no'
924     error('Impossible situation requested: Cannot build for Android without GLES2 support')
925   elif host_system != 'android'
926     error('Impossible situation requested: Cannot build for Android without an android system')
927   endif
928 endif
929
930 if host_system == 'android' and need_win_android != 'no' and need_platform_egl != 'no'
931   if gles2_dep.found() and egl_dep.found()
932     enabled_gl_winsys += ['android']
933     glconf.set10('GST_GL_HAVE_WINDOW_ANDROID', 1)
934     gl_priv_sources += [
935       'android/gstglwindow_android_egl.c'
936     ]
937   endif
938 endif
939
940 gl_nvmm = false
941 nvbuf_utils_dep = unneeded_dep
942 if egl_dep.found()
943   # XXX: provide options for this?
944   # c_args and c_link_args can also cover this case just fine e.g.:
945   # -Dc_args='-I/usr/src/jetson_multimedia_api/include' -Dc_link_args='-L/usr/lib/aarch64-linux-gnu/tegra/'
946   nvbuf_utils_dep = cc.find_library('nvbuf_utils', required : false)
947   nvbuf_utils_h = cc.has_header('nvbuf_utils.h')
948   if nvbuf_utils_dep.found() and nvbuf_utils_h
949     gl_misc_deps += [nvbuf_utils_dep]
950     gl_nvmm = true
951     gl_cpp_args += ['-DHAVE_NVMM']
952   endif
953 endif
954
955 build_gstgl = true
956 if enabled_gl_apis.length() == 0
957   message('No OpenGL API libraries found or requested')
958   build_gstgl = false
959 endif
960 if enabled_gl_platforms.length() == 0
961   message('No OpenGL Platforms found or requested')
962   build_gstgl = false
963 endif
964 if enabled_gl_winsys.length() == 0
965   message('No OpenGL Window systems found or requested')
966   build_gstgl = false
967 endif
968
969 gstgl_dep = dependency('', required : false)
970 gstglproto_dep = dependency('', required : false)
971 gstglx11_dep = dependency('', required : false)
972 gstglwayland_dep = dependency('', required : false)
973 gstglegl_dep = dependency('', required : false)
974
975 if build_gstgl
976   # find some types that may or may not be defined
977   if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
978     glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
979   endif
980   if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
981     glconf.set('GST_GL_HAVE_GLCHAR', 1)
982   endif
983   if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
984     glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
985   endif
986   if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
987     glconf.set('GST_GL_HAVE_GLINTPTR', 1)
988   endif
989   if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
990     glconf.set('GST_GL_HAVE_GLSYNC', 1)
991   endif
992   if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
993     glconf.set('GST_GL_HAVE_GLUINT64', 1)
994   endif
995   if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps, include_directories : gl_includes)
996     glconf.set('GST_GL_HAVE_GLINT64', 1)
997   endif
998   if egl_dep.found() and cc.has_type('EGLAttrib', prefix : gl_include_block + egl_includes, dependencies : gl_lib_deps + [egl_dep], include_directories : gl_includes)
999     glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
1000   endif
1001   if egl_dep.found() and cc.has_type('EGLuint64KHR', prefix : gl_include_block + egl_includes, dependencies : gl_lib_deps + [egl_dep], include_directories : gl_includes)
1002     glconf.set('GST_GL_HAVE_EGLUINT64KHR', 1)
1003   endif
1004
1005   summary('GL api', enabled_gl_apis, list_sep: ', ')
1006   summary('GL platform', enabled_gl_platforms, list_sep: ', ')
1007   summary('GL winsys', enabled_gl_winsys, list_sep: ', ')
1008
1009   install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
1010   install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
1011
1012   configure_file(input : 'gstglconfig.h.meson',
1013     output : 'gstglconfig.h',
1014     install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
1015     configuration : glconf)
1016
1017   glib_mkenums = find_program('glib-mkenums')
1018   mkenums = find_program('gl_mkenum.py')
1019   gl_enumtypes_h = custom_target('gstglenumtypes_h',
1020     output : 'gl-enumtypes.h',
1021     input : gir_gl_headers,
1022     install : true,
1023     install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/gl/'),
1024     command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
1025
1026   gl_enumtypes_c = custom_target('gstglenumtypes_c',
1027     output : 'gl-enumtypes.c',
1028     input : gir_gl_headers,
1029     depends : [gl_enumtypes_h],
1030     command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
1031   gen_sources = [gl_enumtypes_h]
1032
1033   common_args = gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL']
1034
1035   # We have custom_target() that generate headers in the current build dir,
1036   # but with implicit_include_directories: false, meson >= 0.58.0 won't include
1037   # it by default. We cannot use include_directories('.') here because it would
1038   # also include current source dir which is what we want to avoid because
1039   # case-insensitive FS would include gst-libs/gl/egl/egl.h as EGL/egl.h.
1040   common_args += '-I@0@'.format(meson.current_build_dir())
1041
1042   gstgl = library('gstgl-' + api_version,
1043     gl_sources, gl_egl_sources, gl_x11_sources, gl_wayland_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h,
1044     c_args : common_args,
1045     cpp_args : common_args,
1046     objc_args : common_args + gl_objc_args,
1047     include_directories : [configinc, libsinc, gl_includes],
1048     version : libversion,
1049     soversion : soversion,
1050     darwin_versions : osxversion,
1051     install : true,
1052     dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
1053                     gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps],
1054     # don't confuse EGL/egl.h with gst-libs/gl/egl/egl.h on case-insensitive file systems
1055     implicit_include_directories : false)
1056
1057   pkgconfig_gl_variables = [
1058     'gl_platforms=' + ' '.join(enabled_gl_platforms),
1059     'gl_winsys=' + ' '.join(enabled_gl_winsys),
1060     'gl_apis=' + ' '.join(enabled_gl_apis),
1061   ]
1062
1063   pkgconfig.generate(gstgl,
1064     libraries : [gstvideo, gst_base_dep, gst_dep],
1065     variables : pkgconfig_variables + pkgconfig_gl_variables,
1066     uninstalled_variables : pkgconfig_gl_variables,
1067     subdirs : pkgconfig_subdirs,
1068     extra_cflags : ['-I${libdir}/gstreamer-1.0/include'],
1069     name : 'gstreamer-gl-1.0',
1070     description : 'Streaming media framework, OpenGL plugins libraries',
1071   )
1072
1073   # Desperate times, desperate measures... fix up escaping of our variables
1074   run_command(meson_pkg_config_file_fixup_script,
1075     'gstreamer-gl-1.0', 'gl_platforms', 'gl_winsys', 'gl_apis',
1076     check: true)
1077
1078   pkgconfig.generate(
1079     libraries : [gstgl, gl_lib_deps],
1080     subdirs : pkgconfig_subdirs,
1081     name : 'gstreamer-gl-prototypes-1.0',
1082     description : 'Streaming media framework, OpenGL plugins libraries (OpenGL Prototypes)',
1083   )
1084
1085   if build_gir
1086     gl_gir = gnome.generate_gir(gstgl,
1087       sources : gl_sources + [gl_enumtypes_h] + [gl_enumtypes_c] + gir_gl_headers,
1088       namespace : 'GstGL',
1089       nsversion : api_version,
1090       identifier_prefix : 'Gst',
1091       symbol_prefix : 'gst',
1092       export_packages : 'gstreamer-gl-1.0',
1093       includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
1094       install : true,
1095       extra_args : gir_init_section + ['--c-include=gst/gl/gl.h'],
1096       dependencies : [video_dep, gst_dep, gst_base_dep]
1097     )
1098     gen_sources += gl_gir
1099   endif
1100
1101   gstgl_dep = declare_dependency(link_with : gstgl,
1102     include_directories : [libsinc, compat_includes],
1103     sources: gen_sources,
1104     dependencies : [video_dep, gst_base_dep])
1105   gstglproto_dep = declare_dependency(dependencies : [gstgl_dep] + gl_lib_deps)
1106   meson.override_dependency('gstreamer-gl-1.0', gstgl_dep)
1107   meson.override_dependency('gstreamer-gl-prototypes-1.0', gstglproto_dep)
1108
1109   if gl_x11_headers.length() > 0
1110     install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
1111     pkgconfig.generate(
1112       libraries : [gstgl],
1113       requires: ['x11-xcb'],
1114       subdirs : pkgconfig_subdirs,
1115       name : 'gstreamer-gl-x11-1.0',
1116       description : 'Streaming media framework, OpenGL plugins libraries (X11 specifics)',
1117     )
1118     gl_x11_gir = []
1119     if build_gir
1120       gl_x11_gir = gnome.generate_gir(gstgl,
1121         sources : gl_x11_sources + gl_x11_headers,
1122         namespace : 'GstGLX11',
1123         nsversion : api_version,
1124         identifier_prefix : 'Gst',
1125         symbol_prefix : 'gst',
1126         export_packages : 'gstreamer-gl-x11-1.0',
1127         includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', gl_gir[0]],
1128         install : true,
1129         extra_args : gir_init_section + ['--c-include=gst/gl/x11/x11.h'],
1130         dependencies : [video_dep, gst_dep, gst_base_dep]
1131       )
1132     endif
1133     gstglx11_dep = declare_dependency(dependencies : [gstgl_dep],
1134       sources : gl_x11_gir)
1135     meson.override_dependency('gstreamer-gl-x11-1.0', gstglx11_dep)
1136   endif
1137
1138   if gl_wayland_headers.length() > 0
1139     install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
1140     pkgconfig.generate(
1141       libraries : [gstgl],
1142       requires: ['wayland-egl', 'wayland-client'],
1143       subdirs : pkgconfig_subdirs,
1144       name : 'gstreamer-gl-wayland-1.0',
1145       description : 'Streaming media framework, OpenGL plugins libraries (Wayland specifics)',
1146     )
1147     gl_wayland_gir = []
1148     if build_gir
1149       gl_wayland_gir = gnome.generate_gir(gstgl,
1150         sources : gl_wayland_sources + gl_wayland_headers,
1151         namespace : 'GstGLWayland',
1152         nsversion : api_version,
1153         identifier_prefix : 'Gst',
1154         symbol_prefix : 'gst',
1155         export_packages : 'gstreamer-gl-wayland-1.0',
1156         includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', gl_gir[0]],
1157         install : true,
1158         extra_args : gir_init_section + ['--c-include=gst/gl/wayland/wayland.h'],
1159         dependencies : [video_dep, gst_dep, gst_base_dep]
1160       )
1161     endif
1162     gstglwayland_dep = declare_dependency(dependencies : [gstgl_dep],
1163       sources : gl_wayland_gir)
1164     meson.override_dependency('gstreamer-gl-wayland-1.0', gstglwayland_dep)
1165   endif
1166
1167   if gl_egl_headers.length() > 0
1168     install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
1169     pkgconfig.generate(
1170       libraries : [gstgl, egl_dep],
1171       subdirs : pkgconfig_subdirs,
1172       name : 'gstreamer-gl-egl-1.0',
1173       description : 'Streaming media framework, OpenGL plugins libraries (EGL specifics)',
1174     )
1175     gl_egl_gir = []
1176     if build_gir
1177       gl_egl_gir = gnome.generate_gir(gstgl,
1178         sources : gl_egl_sources + gl_egl_headers,
1179         namespace : 'GstGLEGL',
1180         nsversion : api_version,
1181         identifier_prefix : 'Gst',
1182         symbol_prefix : 'gst',
1183         export_packages : 'gstreamer-gl-egl-1.0',
1184         includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0', gl_gir[0]],
1185         install : true,
1186         extra_args : gir_init_section + ['--c-include=gst/gl/egl/egl.h'],
1187         dependencies : [video_dep, gst_dep, gst_base_dep]
1188       )
1189     endif
1190     gstglegl_dep = declare_dependency(dependencies : [gstgl_dep],
1191       sources : gl_egl_gir)
1192     meson.override_dependency('gstreamer-gl-egl-1.0', gstglegl_dep)
1193   endif
1194
1195 elif get_option('gl').enabled()
1196   error('GStreamer OpenGL integration required via options, but needed dependencies not found.')
1197 endif