aja: Integrate AJA plugin into the build system

Co-Authored-By: Nirbheek Chauhan <nirbheek@centricular.com>
This commit is contained in:
Sebastian Dröge 2023-10-21 10:26:40 +03:00
parent d2d947380e
commit 59f4146bdc
5 changed files with 543 additions and 65 deletions

File diff suppressed because one or more lines are too long

View file

@ -81,6 +81,7 @@ option('x11', type : 'feature', value : 'auto', description : 'X11 support in Vu
# Feature options for plugins that need external deps
option('aes', type : 'feature', value : 'auto', description : 'AES encryption/decryption plugin')
option('aja', type : 'feature', value : 'auto', description : 'AJA audio/video source/sink plugin')
option('aom', type : 'feature', value : 'auto', description : 'AOM AV1 video codec plugin')
option('avtp', type : 'feature', value : 'auto', description : 'Audio/Video Transport Protocol (AVTP) plugin')
option('amfcodec', type : 'feature', value : 'auto', description : 'AMD AMF codec plugin')
@ -204,6 +205,10 @@ option('v4l2codecs', type : 'feature', value : 'auto', description : 'Video4Linu
option('uvcgadget', type : 'feature', value : 'auto', description : 'uvc video gadget plugin')
option('isac', type : 'feature', value : 'auto', description : 'iSAC plugin')
# AJA plugin options
option('aja-sdk-dir', type : 'string', value : '',
description : 'Directory with AJA SDK, e.g. ntv2sdklinux_16.0.0.4')
# HLS plugin options
option('hls', type : 'feature', value : 'auto', description : 'HTTP Live Streaming plugin')
option('hls-crypto', type : 'combo', value : 'auto', choices : ['auto', 'nettle', 'libgcrypt', 'openssl'],

View file

@ -1,84 +1,41 @@
project('gst-aja', 'cpp',
version : '0.1.0',
meson_version : '>= 0.63.0',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized',
'cpp_std=c++11',
'cpp_eh=none',
'cpp_rtti=false',
]
)
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
cxx = meson.get_compiler('cpp')
if cxx.has_argument('-fvisibility=hidden')
add_project_arguments('-fvisibility=hidden', language: 'cpp')
endif
if cxx.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
# NOTE: Only add warnings here if you are sure they're spurious
test_cppflags = []
msvc_args = [
'/wd4018', # implicit signed/unsigned conversion
'/wd4146', # unary minus on unsigned (beware INT_MIN)
'/wd4244', # lossy type conversion (e.g. double -> int)
'/wd4305', # truncating type conversion (e.g. double -> float)
]
add_project_arguments(msvc_args, language : 'cpp')
# Disable SAFESEH with MSVC for plugins and libs that use external deps that
# are built with MinGW
noseh_link_args = ['/SAFESEH:NO']
else
test_cppflags = ['-Wno-non-virtual-dtor']
noseh_link_args = []
aja_option = get_option('aja') \
.require(host_system == 'linux',
error_message: 'AJA plugin is currently only available on Linux')
if aja_option.disabled()
subdir_done()
endif
common_flags = [
'-DAJALinux=1',
'-DAJA_LINUX=1',
]
foreach cxxflag: test_cppflags
if cxx.has_argument(cxxflag)
common_flags += [ cxxflag ]
endif
endforeach
gst_dep = dependency('gstreamer-1.0', version : '>= 1.18', required : true)
gstbase_dep = dependency('gstreamer-base-1.0', version : '>= 1.18', required : true)
gstaudio_dep = dependency('gstreamer-audio-1.0', version : '>= 1.18', required : true)
gstvideo_dep = dependency('gstreamer-video-1.0', version : '>= 1.18', required : true)
thread_dep = dependency('threads')
rt_dep = cxx.find_library('rt', required : false)
aja_sdk_dir = get_option('aja-sdk-dir')
if aja_sdk_dir == ''
ajantv2_dep = dependency('libajantv2')
aja_includedirs = []
ajantv2_dep = dependency('libajantv2', include_type: 'system',
required: aja_option, allow_fallback: true)
if not ajantv2_dep.found()
subdir_done()
endif
aja_includedirs = []
else
aja_includedirs = include_directories(
f'@aja_sdk_dir@/ajalibraries',
f'@aja_sdk_dir@/ajalibraries/ajantv2/includes',
f'@aja_sdk_dir@/ajalibraries/ajantv2/src/lin',
is_system: true,
)
message('Looking for AJA SDK in directory ' + aja_sdk_dir)
message(f'Looking for AJA SDK in @aja_sdk_dir@')
if not cxx.has_header('ajabase/common/videotypes.h',
include_directories : aja_includedirs,
)
error('Cannot find AJA SDK')
include_directories: aja_includedirs,
required: aja_option)
subdir_done()
endif
ajantv2_lib = cxx.find_library('ajantv2',
# If the header is found, this should also be
required : true,
@ -86,8 +43,7 @@ else
)
ajantv2_dep = declare_dependency(
dependencies: ajantv2_lib,
include_directories: aja_includedirs,
)
include_directories: aja_includedirs)
endif
gstaja = library('gstaja',
@ -99,14 +55,13 @@ gstaja = library('gstaja',
'gstajasrcdemux.cpp',
'gstajadeviceprovider.cpp',
],
cpp_args : [
'-DPACKAGE="gst-aja"',
'-DGST_PACKAGE_NAME="gstreamer-aja"',
'-DGST_PACKAGE_ORIGIN="https://github.com/centricular/gstreamer-aja"',
'-DVERSION="@0@"'.format(meson.project_version())] + common_flags,
override_options : ['cpp_std=c++11'],
cpp_args : gst_plugins_bad_args + common_flags,
include_directories : [configinc],
link_args : noseh_link_args,
dependencies : [gstvideo_dep, gstaudio_dep, gstbase_dep, gst_dep, ajantv2_dep, thread_dep, rt_dep],
install : true,
install_dir : plugins_install_dir,
)
plugins += [gstaja]

View file

@ -1,2 +0,0 @@
option('aja-sdk-dir', type : 'string', value : '',
description : 'Directory with AJA SDK, e.g. ntv2sdklinux_16.0.0.4')

View file

@ -1,3 +1,4 @@
subdir('aja')
subdir('amfcodec')
subdir('androidmedia')
subdir('applemedia')