1 project('gst-omx', 'c',
3 meson_version : '>= 0.36.0',
4 default_options : [ 'warning_level=1',
5 'buildtype=debugoptimized' ])
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version_major = version_arr[0]
10 gst_version_minor = version_arr[1]
11 gst_version_micro = version_arr[2]
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3]
18 glib_req = '>= 2.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
20 tizil_req = '>= 0.1.0'
23 # maintaining compatibility with the previous libtool versioning
24 # current = minor * 100 + micro
25 libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
27 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
29 cc = meson.get_compiler('c')
31 if cc.get_id() == 'msvc'
32 # Ignore several spurious warnings for things gstreamer does very commonly
33 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
34 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
35 # NOTE: Only add warnings here if you are sure they're spurious
36 add_project_arguments(
37 '/wd4018', # implicit signed/unsigned conversion
38 '/wd4146', # unary minus on unsigned (beware INT_MIN)
39 '/wd4244', # lossy type conversion (e.g. double -> int)
40 '/wd4305', # truncating type conversion (e.g. double -> float)
42 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
43 # are built with MinGW
44 noseh_link_args = ['/SAFESEH:NO']
49 cdata = configuration_data()
51 # ['HAVE_DLFCN_H', 'dlfcn.h'],
52 # ['HAVE_FCNTL_H', 'fcntl.h'],
53 # ['HAVE_INTTYPES_H', 'inttypes.h'],
54 # ['HAVE_MEMORY_H', 'memory.h'],
55 # ['HAVE_MSACM_H', 'msacm.h'],
56 # ['HAVE_PTHREAD_H', 'pthread.h'],
57 # ['HAVE_STDINT_H', 'stdint.h'],
58 # ['HAVE_STDLIB_H', 'stdlib.h'],
59 # ['HAVE_STRINGS_H', 'strings.h'],
60 # ['HAVE_STRING_H', 'string.h'],
61 # ['HAVE_SYS_PARAM_H', 'sys/param.h'],
62 # ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
63 # ['HAVE_SYS_STAT_H', 'sys/stat.h'],
64 # ['HAVE_SYS_TIME_H', 'sys/time.h'],
65 # ['HAVE_SYS_TYPES_H', 'sys/types.h'],
66 # ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
67 # ['HAVE_UNISTD_H', 'unistd.h'],
70 foreach h : check_headers
71 if cc.has_header(h.get(1))
72 cdata.set(h.get(0), 1)
77 # check token HAVE_CPU_ALPHA
78 # check token HAVE_CPU_ARM
79 # check token HAVE_CPU_CRIS
80 # check token HAVE_CPU_CRISV32
81 # check token HAVE_CPU_HPPA
82 # check token HAVE_CPU_I386
83 # check token HAVE_CPU_IA64
84 # check token HAVE_CPU_M68K
85 # check token HAVE_CPU_MIPS
86 # check token HAVE_CPU_PPC
87 # check token HAVE_CPU_PPC64
88 # check token HAVE_CPU_S390
89 # check token HAVE_CPU_SPARC
90 # check token HAVE_CPU_X86_64
91 # ['HAVE_DCGETTEXT', 'dcgettext'],
92 # check token HAVE_EXPERIMENTAL
93 # check token HAVE_EXTERNAL
94 # ['HAVE_GETPAGESIZE', 'getpagesize'],
95 # check token HAVE_GETTEXT
98 foreach f : check_functions
99 if cc.has_function(f.get(1))
100 cdata.set(f.get(0), 1)
104 #cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
105 #cdata.set('SIZEOF_INT', cc.sizeof('int'))
106 #cdata.set('SIZEOF_LONG', cc.sizeof('long'))
107 #cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
108 #cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
110 cdata.set('VERSION', '"@0@"'.format(gst_version))
111 cdata.set('PACKAGE', '"gst-omx"')
112 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
113 cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
114 cdata.set('PACKAGE_NAME', '"GStreamer OMX Plugins"')
115 cdata.set('GETTEXT_PACKAGE', '"gst-omx-1.0"')
116 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
117 cdata.set('GST_PACKAGE_NAME', '"GStreamer OpenMX Plug-ins"')
118 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
119 cdata.set('GST_LICENSE', '"LGPL"')
120 cdata.set('LIBDIR', '"@0@"'.format(get_option('libdir')))
122 # FIXME: This should be exposed as a configuration option
123 host_system = host_machine.system()
124 if host_system == 'linux'
125 cdata.set('DEFAULT_VIDEOSRC', '"v4l2src"')
126 elif host_system == 'osx'
127 cdata.set('DEFAULT_VIDEOSRC', '"avfvideosrc"')
129 cdata.set('DEFAULT_VIDEOSRC', '"videotestsrc"')
133 gst_dep = dependency('gstreamer-1.0', version : gst_req,
134 fallback : ['gstreamer', 'gst_dep'])
135 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
136 fallback : ['gstreamer', 'gst_base_dep'])
137 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
138 fallback : ['gstreamer', 'gst_controller_dep'])
139 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
140 fallback : ['gst-plugins-base', 'allocators_dep'])
142 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
143 fallback : ['gst-plugins-base', 'pbutils_dep'])
144 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
145 fallback : ['gst-plugins-base', 'audio_dep'])
146 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
147 fallback : ['gst-plugins-base', 'fft_dep'])
148 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
149 fallback : ['gst-plugins-base', 'tag_dep'])
150 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
151 fallback : ['gst-plugins-base', 'video_dep'])
153 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
154 fallback : ['gst-plugins-bad', 'gstgl_dep'], required : false)
156 libm = cc.find_library('m', required : false)
157 glib_dep = dependency('glib-2.0', version : glib_req)
158 gio_dep = dependency('gio-2.0', version : glib_req)
159 gmodule_dep = dependency('gmodule-2.0', version : glib_req)
161 gst_omx_args = ['-DHAVE_CONFIG_H']
162 configinc = include_directories('.')
163 omx_header_path = get_option('with_omx_header_path')
164 if omx_header_path != ''
165 gst_omx_args += ['-I' + omx_header_path]
168 have_external_omx = cc.has_header(
172 extra_video_headers = ''
173 # Our internal OpenMAX IL headers have OMX_VideoExt.h, OMX_IndexExt.h and OMX_ComponentExt.h
174 have_video_ext = true
175 have_index_ext = true
176 have_component_ext = true
179 have_video_ext = cc.has_header (
184 extra_video_headers += '''
185 #include <OMX_VideoExt.h>'''
188 have_index_ext = cc.has_header (
193 have_component_ext = cc.has_header (
194 'OMX_ComponentExt.h',
200 cdata.set ('HAVE_VIDEO_EXT', 1)
204 cdata.set ('HAVE_INDEX_EXT', 1)
207 if have_component_ext
208 cdata.set ('HAVE_COMPONENT_EXT', 1)
211 have_omx_vp8 = cc.has_header_symbol(
213 'OMX_VIDEO_CodingVP8',
214 prefix : extra_video_headers,
218 cdata.set('HAVE_VP8', 1)
221 have_omx_theora = cc.has_header_symbol(
223 'OMX_VIDEO_CodingTheora',
224 prefix : extra_video_headers,
228 cdata.set('HAVE_THEORA', 1)
231 have_omx_hevc = cc.has_header_symbol(
233 'OMX_VIDEO_CodingHEVC',
234 prefix : extra_video_headers,
238 cdata.set('HAVE_HEVC', 1)
241 default_omx_struct_packing = 0
242 omx_target = get_option ('with_omx_target')
243 if omx_target == 'generic'
244 cdata.set('USE_OMX_TARGET_GENERIC', 1)
245 elif omx_target == 'rpi'
246 cdata.set('USE_OMX_TARGET_RPI', 1)
247 cdata.set('OMX_SKIP64BIT', 1)
248 default_omx_struct_packing = 4
251 if gstgl_dep.type_name() == 'pkgconfig'
252 gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split(',')
253 gl_platforms = gstgl_dep.get_pkgconfig_variable('gl_platforms').split(',')
254 elif gstgl_dep.type_name() == 'internal'
255 # XXX assume gst-plugins-bad was built with dispmanx and egl support
256 gl_winsys = ['dispmanx']
257 gl_platforms = ['egl']
259 error ('unreachable dependency type')
262 if not gl_winsys.contains('dispmanx') or not gl_platforms.contains ('egl')
263 gstgl_dep = dependency('', required : false)
266 elif omx_target == 'bellagio'
267 cdata.set('USE_OMX_TARGET_BELLAGIO', 1)
268 elif omx_target == 'zynqultrascaleplus'
269 cdata.set('USE_OMX_TARGET_ZYNQ_USCALE_PLUS', 1)
270 have_allegro_header = cc.has_header (
274 if not have_allegro_header
275 error ('Need Allegro OMX headers to build for Zynq UltraScale+. Use with_omx_header_path option to specify the path of those headers.')
277 elif omx_target == 'tizonia'
278 cdata.set('USE_OMX_TARGET_TIZONIA', 1)
279 tizil_dep = dependency('tizilheaders', version : tizil_req)
280 cdata.set('TIZONIA_LIBDIR', tizil_dep.get_pkgconfig_variable('libdir'))
281 tizil_includedir = tizil_dep.get_pkgconfig_variable('includedir')
282 add_global_arguments('-I' + tizil_includedir + '/tizonia', language : 'C')
284 error ('Unsupported omx target specified. Use the -Dwith_omx_target option')
288 cdata.set ('HAVE_GST_GL', 1)
291 omx_struct_packing = get_option ('with_omx_struct_packing').to_int()
292 if omx_struct_packing == 0
293 omx_struct_packing = default_omx_struct_packing
295 if omx_struct_packing != 0
296 cdata.set('GST_OMX_STRUCT_PACKING', omx_struct_packing)
299 omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
300 cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
302 configure_file(output : 'config.h', configuration : cdata)
309 python3 = find_program('python3')
310 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')