gstavviddec: Limit default number of decoder threads
[platform/upstream/gstreamer.git] / meson.build
index 41f24a8..95aea47 100644 (file)
@@ -1,18 +1,29 @@
 project('gst-libav', 'c', 'cpp',
-  version : '1.13.0.1',
-  meson_version : '>= 0.36.0',
+  version : '1.17.0.1',
+  meson_version : '>= 0.48.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
 gst_version = meson.project_version()
 version_arr = gst_version.split('.')
-gst_version_major = version_arr[0]
-gst_version_minor = version_arr[1]
+gst_version_major = version_arr[0].to_int()
+gst_version_minor = version_arr[1].to_int()
+gst_version_micro = version_arr[2].to_int()
+ if version_arr.length() == 4
+  gst_version_nano = version_arr[3].to_int()
+else
+  gst_version_nano = 0
+endif
 
-libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100')
-libavformat_dep = dependency('libavformat', version: '>= 57.41.100')
-libavcodec_dep = dependency('libavcodec', version: '>= 57.48.101')
-libavutil_dep = dependency('libavutil', version: '>= 55.28.100')
+api_version = '1.0'
+libavfilter_dep = dependency('libavfilter', version: '>= 7.16.100',
+  fallback: ['FFmpeg', 'libavfilter_dep'])
+libavformat_dep = dependency('libavformat', version: '>= 58.12.100',
+  fallback: ['FFmpeg', 'libavformat_dep'])
+libavcodec_dep = dependency('libavcodec', version: '>= 58.18.100',
+  fallback: ['FFmpeg', 'libavcodec_dep'])
+libavutil_dep = dependency('libavutil', version: '>= 56.14.100',
+  fallback: ['FFmpeg', 'libavutil_dep'])
 
 libav_deps = [libavfilter_dep, libavformat_dep, libavcodec_dep, libavutil_dep]
 
@@ -25,14 +36,41 @@ check_ffmpeg_src = '''#include <libavcodec/avcodec.h>
 #error libav provider should be FFmpeg
 #endif'''
 
-if not cc.compiles(check_ffmpeg_src, dependencies : libav_deps, name : 'libav is provided by FFmpeg')
+libav_deps_type_name = ''
+
+foreach dep: libav_deps
+  if libav_deps_type_name != '' and dep.type_name() != libav_deps_type_name
+    error('Libav deps must be either all internal or all external')
+  endif
+  libav_deps_type_name = dep.type_name()
+endforeach
+
+if dep.type_name() != 'internal'
+  if not cc.compiles(check_ffmpeg_src, dependencies : libav_deps, name : 'libav is provided by FFmpeg')
     error('Uncompatible libavcodec found')
+  endif
 endif
 
 cdata = configuration_data()
 cdata.set('LIBAV_SOURCE', '"system install"')
 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
 cdata.set('PACKAGE', '"gst-libav"')
+
+# GStreamer package name and origin url
+gst_package_name = get_option('package-name')
+if gst_package_name == ''
+  if gst_version_nano == 0
+    gst_package_name = 'GStreamer FFMPEG Plug-ins source release'
+  elif gst_version_nano == 1
+    gst_package_name = 'GStreamer FFMPEG Plug-ins git'
+  else
+    gst_package_name = 'GStreamer FFMPEG Plug-ins prerelease'
+  endif
+endif
+cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
+cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
+
+
 check_headers = [['unistd.h', 'HAVE_UNISTD_H']]
 
 foreach h : check_headers
@@ -58,9 +96,7 @@ libm = cc.find_library('m', required : false)
 configure_file(output : 'config.h', configuration : cdata)
 
 gst_libav_args = ['-DHAVE_CONFIG_H']
-if cc.get_id() != 'msvc'
-  gst_libav_args += ['-Wno-deprecated-declarations']
-else
+if cc.get_id() == 'msvc'
   # Ignore several spurious warnings for things gstreamer does very commonly
   # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
   # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
@@ -73,10 +109,25 @@ else
       language : 'c')
 endif
 
+# Symbol visibility
+if cc.has_argument('-fvisibility=hidden')
+  add_project_arguments('-fvisibility=hidden', language: 'c')
+endif
+
+# Don't export any symbols from static ffmpeg libraries
+if cc.has_link_argument('-Wl,--exclude-libs=ALL')
+  add_project_link_arguments('-Wl,--exclude-libs=ALL', language: 'c')
+endif
+
+# Disable strict aliasing
+if cc.has_argument('-fno-strict-aliasing')
+  add_project_arguments('-fno-strict-aliasing', language: 'c')
+endif
+
 if gst_dep.type_name() == 'internal'
     gst_proj = subproject('gstreamer')
 
-    if gst_proj.get_variable('disable_gst_debug')
+    if not gst_proj.get_variable('gst_debug')
         message('GStreamer debug system is disabled')
         add_project_arguments('-Wno-unused', language: 'c')
     else
@@ -97,9 +148,45 @@ else
     endif
 endif
 
+warning_flags = [
+  '-Wmissing-declarations',
+  '-Wmissing-prototypes',
+  '-Wold-style-definition',
+  '-Wredundant-decls',
+  '-Wundef',
+  '-Wwrite-strings',
+  '-Wformat',
+  '-Wformat-nonliteral',
+  '-Wformat-security',
+  '-Winit-self',
+  '-Wmissing-include-dirs',
+  '-Waddress',
+  '-Wno-multichar',
+  '-Waggregate-return',
+  '-Wdeclaration-after-statement',
+  '-Wvla',
+  '-Wpointer-arith',
+]
+
+foreach extra_arg : warning_flags
+  if cc.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'c')
+  endif
+endforeach
+
 configinc = include_directories('.')
 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
-subdir('ext/libav/')
 
-python3 = find_program('python3')
+pkgconfig = import('pkgconfig')
+plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
+if get_option('default_library') == 'shared'
+  # If we don't build static plugins there is no need to generate pc files
+  plugins_pkgconfig_install_dir = disabler()
+endif
+
+plugins = []
+subdir('ext/libav')
+subdir('docs')
+
+python3 = import('python').find_installation()
 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')