gtk2/modules/media/meson.build
Chun-wei Fan ccdec5da77 gtkgstsink.c: Support EGL on Windows as well
Add support to look for and use the EGL context in Windows if it was activated
instead of desktop OpenGL.

GstGL may have been built with or without EGL/libANGLE support, so if it were,
check in GstGL whether we have gst_gl_display_new_with_type() to create a
GstGLDisplay that is of the GST_GL_WINDOW_WIN32 type when we are using
Desktop OpenGL (WGL), otherwise we show messages indicating that envvars
need to be set to initialize GstGL properly.

Due to a bug in GstGL, the GstGLContext can only be set up successfully
if one of the following is true:

*  An OpenGL 3.x or later emulator, such as Mesa is used (for WGL)
*  The latest GstGL master is being used, at the time of writing (for
   WGL)
*  GTK, libepoxy and GstGL are all built only with WGL support (for WGL)
*  EGL is being used in GTK at runtime

Special thanks to Matthew Waters for the help during the process.
2021-05-24 19:04:14 +08:00

80 lines
2.3 KiB
Meson

media_subdir = 'gtk-4.0/@0@/media'.format(gtk_binary_version)
media_install_dir = join_paths(get_option('libdir'), media_subdir)
media_backends = []
extra_c_args = [
'-DGTK_COMPILATION',
'-D_GLIB_EXTERN=@0@'.format(visibility_define),
]
extra_c_args += common_cflags
ffmpeg_opt = get_option('media-ffmpeg')
ffmpeg_versions = {
'libavfilter': '>= 6.47.100',
'libavformat': '>= 57.41.100',
'libavcodec': '>= 57.48.101',
'libavutil': '>= 55.28.100',
'libswscale': '>= 4.6.100',
}
ffmpeg_deps = []
ffmpeg_found = true
foreach name, version : ffmpeg_versions
dep = dependency(name, version: version, required: ffmpeg_opt)
ffmpeg_deps += dep
if not dep.found()
ffmpeg_found = false
break
endif
endforeach
if ffmpeg_found
media_backends += 'ffmpeg'
cdata.set('HAVE_FFMPEG', 1)
shared_module('media-ffmpeg',
sources: 'gtkffmediafile.c',
c_args: extra_c_args,
dependencies: [ libgtk_dep, ffmpeg_deps ],
name_suffix: module_suffix,
install_dir: media_install_dir,
install: true,
)
endif
gstplayer_dep = dependency('gstreamer-player-1.0', version: '>= 1.12.3',
required: get_option('media-gstreamer'))
gstgl_dep = dependency('gstreamer-gl-1.0', version: '>= 1.12.3',
required: get_option('media-gstreamer'))
if gstplayer_dep.found() and gstgl_dep.found()
extra_win_cflags = []
if host_machine.system() == 'windows'
new_gst_gl_display_code = \
'''#include <gst/gl/gstgldisplay.h>
int main (int a, char ** g) {
GstGLDisplay *d = gst_gl_display_new_with_type (GST_GL_DISPLAY_TYPE_WIN32);
return 0;
}'''
if cc.links(new_gst_gl_display_code, dependencies : gstgl_dep)
message('libgstgl has gst_gl_display_new_with_type()')
extra_win_cflags += '-DHAVE_GST_GL_DISPLAY_NEW_WITH_TYPE'
endif
endif
media_backends += 'gstreamer'
cdata.set('HAVE_GSTREAMER', 1)
shared_module('media-gstreamer',
sources: [
'gtkgstmediafile.c',
'gtkgstpaintable.c',
'gtkgstsink.c',
],
c_args: extra_c_args + extra_win_cflags,
dependencies: [ libm, libgtk_dep, gstplayer_dep, gstgl_dep ],
name_suffix: module_suffix,
install_dir: media_install_dir,
install: true,
)
endif