Add subproject for building the AJA NTV2 SDK from github

By default that subproject will be built now instead of requiring the
user to provide a location for the SDK.
This commit is contained in:
Sebastian Dröge 2023-10-21 10:02:43 +03:00
parent 63b1e261b2
commit 71be705fe6
5 changed files with 214 additions and 21 deletions

View file

@ -3,7 +3,12 @@
[GStreamer](https://gstreamer.freedesktop.org/) plugin for [GStreamer](https://gstreamer.freedesktop.org/) plugin for
[AJA](https://www.aja.com) capture and output cards. [AJA](https://www.aja.com) capture and output cards.
This plugin requires the NTV2 SDK version 16 or newer. This plugin requires the AJA NTV2 SDK version 16 or newer.
The location of the SDK can be configured via the `aja-sdk-dir` meson option.
If no location is given then the NTV2 SDK from
[GitHub](https://github.com/aja-video/ntv2.git) is compiled as a meson
subproject as part of the plugin.
## Example usage ## Example usage

View file

@ -1,6 +1,6 @@
project('gst-aja', 'cpp', project('gst-aja', 'cpp',
version : '0.1.0', version : '0.1.0',
meson_version : '>= 0.54.0', meson_version : '>= 0.63.0',
default_options : [ 'warning_level=1', default_options : [ 'warning_level=1',
'buildtype=debugoptimized', 'buildtype=debugoptimized',
'cpp_std=c++11', 'cpp_std=c++11',
@ -57,26 +57,39 @@ thread_dep = dependency('threads')
rt_dep = cxx.find_library('rt', required : false) rt_dep = cxx.find_library('rt', required : false)
aja_sdk_dir = get_option('aja-sdk-dir') aja_sdk_dir = get_option('aja-sdk-dir')
aja_includedirs = [ if aja_sdk_dir == ''
'-I@0@/ajalibraries'.format(aja_sdk_dir), ajantv2_dep = dependency('libajantv2')
'-I@0@/ajalibraries/ajantv2/includes'.format(aja_sdk_dir), aja_includedirs = []
'-I@0@/ajalibraries/ajantv2/src/lin'.format(aja_sdk_dir),
]
message('Looking for AJA SDK in directory ' + aja_sdk_dir) if not ajantv2_dep.found()
if not cxx.has_header('ajabase/common/videotypes.h', subdir_done()
args : aja_includedirs, endif
) else
error('Cannot find AJA SDK') aja_includedirs = include_directories(
f'@aja_sdk_dir@/ajalibraries',
f'@aja_sdk_dir@/ajalibraries/ajantv2/includes',
f'@aja_sdk_dir@/ajalibraries/ajantv2/src/lin',
)
message('Looking for AJA SDK in directory ' + aja_sdk_dir)
if not cxx.has_header('ajabase/common/videotypes.h',
include_directories : aja_includedirs,
)
error('Cannot find AJA SDK')
endif
ajantv2_lib = cxx.find_library('ajantv2',
# If the header is found, this should also be
required : true,
dirs : [f'@aja_sdk_dir@/lib'],
)
ajantv2_dep = declare_dependency(
dependencies: ajantv2_lib,
include_directories: aja_includedirs,
)
endif endif
aja_libdir = '@0@/lib'.format(aja_sdk_dir)
ajantv2_dep = cxx.find_library('ajantv2',
required : true,
dirs : [aja_libdir],
)
gstaja = library('gstaja', gstaja = library('gstaja',
['plugin.cpp', ['plugin.cpp',
'gstajacommon.cpp', 'gstajacommon.cpp',
@ -87,7 +100,6 @@ gstaja = library('gstaja',
'gstajadeviceprovider.cpp', 'gstajadeviceprovider.cpp',
], ],
cpp_args : [ cpp_args : [
aja_includedirs,
'-DPACKAGE="gst-aja"', '-DPACKAGE="gst-aja"',
'-DGST_PACKAGE_NAME="gstreamer-aja"', '-DGST_PACKAGE_NAME="gstreamer-aja"',
'-DGST_PACKAGE_ORIGIN="https://github.com/centricular/gstreamer-aja"', '-DGST_PACKAGE_ORIGIN="https://github.com/centricular/gstreamer-aja"',

View file

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

9
subprojects/ntv2.wrap Normal file
View file

@ -0,0 +1,9 @@
[wrap-file]
directory = ntv2-16.2-bugfix5
source_url = https://github.com/aja-video/ntv2/archive/refs/tags/v16.2-bugfix5.tar.gz
source_filename = ntv2-16.2-bugfix5.tar.gz
source_hash = 560c798c3a43aa0cef1cba6be5adb669ec72e648c28814158eb649275efc9f88
diff_files = ntv2-16.2-bugfix5/ntv2-16.2-bugfix5.meson.patch
[provide]
libajantv2 = libajantv2_dep

View file

@ -0,0 +1,167 @@
--- /dev/null 2023-10-13 08:29:31.027000134 +0300
+++ ntv2-16.2-bugfix5/meson.build 2023-10-21 09:58:37.680821179 +0300
@@ -0,0 +1,164 @@
+project('ntv2', 'cpp',
+ version : '16.2-bugfix5',
+ meson_version : '>= 0.54.0',
+ default_options : [ 'warning_level=1',
+ 'buildtype=debugoptimized',
+ 'cpp_std=c++11',
+ 'cpp_eh=none',
+ 'cpp_rtti=false',
+ ]
+)
+
+cxx = meson.get_compiler('cpp')
+test_cppflags = ['-Wno-non-virtual-dtor']
+
+common_flags = [
+ '-DAJALinux=1',
+ '-DAJA_LINUX=1',
+]
+foreach cxxflag: test_cppflags
+ if cxx.has_argument(cxxflag)
+ common_flags += [ cxxflag ]
+ endif
+endforeach
+
+thread_dep = dependency('threads')
+rt_dep = cxx.find_library('rt', required : false)
+
+ajantv2_sources = [
+ 'ajalibraries/ajaanc/src/ancillarydata.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydatafactory.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_cea608.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_cea608_line21.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_cea608_vanc.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_cea708.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_framestatusinfo524D.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_framestatusinfo5251.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_hdr_hdr10.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_hdr_hlg.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_hdr_sdr.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_timecode.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_timecode_atc.cpp',
+ 'ajalibraries/ajaanc/src/ancillarydata_timecode_vitc.cpp',
+ 'ajalibraries/ajaanc/src/ancillarylist.cpp',
+ 'ajalibraries/ajabase/system/atomic.cpp',
+ 'ajalibraries/ajabase/common/audioutilities.cpp',
+ 'ajalibraries/ajabase/common/buffer.cpp',
+ 'ajalibraries/ajabase/common/common.cpp',
+ 'ajalibraries/ajabase/system/debug.cpp',
+ 'ajalibraries/ajabase/common/dpx_hdr.cpp',
+ 'ajalibraries/ajabase/common/dpxfileio.cpp',
+ 'ajalibraries/ajabase/system/event.cpp',
+ 'ajalibraries/ajabase/system/linux/eventimpl.cpp',
+ 'ajalibraries/ajabase/system/file_io.cpp',
+ 'ajalibraries/ajabase/common/guid.cpp',
+ 'ajalibraries/ajabase/system/info.cpp',
+ 'ajalibraries/ajabase/system/linux/infoimpl.cpp',
+ 'ajalibraries/ajabase/network/ip_socket.cpp',
+ 'ajalibraries/ajabase/system/lock.cpp',
+ 'ajalibraries/ajabase/system/linux/lockimpl.cpp',
+ 'ajalibraries/ajabase/system/memory.cpp',
+ 'ajalibraries/ajabase/common/options_popt.cpp',
+ 'ajalibraries/ajabase/common/performance.cpp',
+ 'ajalibraries/ajabase/common/pixelformat.cpp',
+ 'ajalibraries/ajabase/pnp/pnp.cpp',
+ 'ajalibraries/ajabase/pnp/linux/pnpimpl.cpp',
+ 'ajalibraries/ajabase/system/process.cpp',
+ 'ajalibraries/ajabase/system/linux/processimpl.cpp',
+ 'ajalibraries/ajabase/system/system.cpp',
+ 'ajalibraries/ajabase/system/systemtime.cpp',
+ 'ajalibraries/ajabase/common/testpatterngen.cpp',
+ 'ajalibraries/ajabase/system/thread.cpp',
+ 'ajalibraries/ajabase/system/linux/threadimpl.cpp',
+ 'ajalibraries/ajabase/common/timebase.cpp',
+ 'ajalibraries/ajabase/common/timecode.cpp',
+ 'ajalibraries/ajabase/common/timecodeburn.cpp',
+ 'ajalibraries/ajabase/common/timer.cpp',
+ 'ajalibraries/ajabase/network/udp_socket.cpp',
+ 'ajalibraries/ajabase/common/videoutilities.cpp',
+ 'ajalibraries/ajabase/common/wavewriter.cpp',
+ 'ajalibraries/ajabase/persistence/persistence.cpp',
+ 'ajalibraries/ajantv2/src/ntv2audio.cpp',
+ 'ajalibraries/ajantv2/src/ntv2anc.cpp',
+ 'ajalibraries/ajantv2/src/ntv2autocirculate.cpp',
+ 'ajalibraries/ajantv2/src/ntv2bitfile.cpp',
+ 'ajalibraries/ajantv2/src/ntv2bitfilemanager.cpp',
+ 'ajalibraries/ajantv2/src/ntv2card.cpp',
+ 'ajalibraries/ajantv2/src/ntv2config2022.cpp',
+ 'ajalibraries/ajantv2/src/ntv2config2110.cpp',
+ 'ajalibraries/ajantv2/src/ntv2configts2022.cpp',
+ 'ajalibraries/ajantv2/src/ntv2csclut.cpp',
+ 'ajalibraries/ajantv2/src/ntv2cscmatrix.cpp',
+ 'ajalibraries/ajantv2/src/ntv2debug.cpp',
+ 'ajalibraries/ajantv2/src/ntv2devicefeatures.cpp',
+ 'ajalibraries/ajantv2/src/ntv2devicescanner.cpp',
+ 'ajalibraries/ajantv2/src/ntv2discover.cpp',
+ 'ajalibraries/ajantv2/src/ntv2dma.cpp',
+ 'ajalibraries/ajantv2/src/ntv2dynamicdevice.cpp',
+ 'ajalibraries/ajantv2/src/ntv2hdmi.cpp',
+ 'ajalibraries/ajantv2/src/ntv2hevc.cpp',
+ 'ajalibraries/ajantv2/src/ntv2driverinterface.cpp',
+ 'ajalibraries/ajantv2/src/ntv2enhancedcsc.cpp',
+ 'ajalibraries/ajantv2/src/ntv2formatdescriptor.cpp',
+ 'ajalibraries/ajantv2/src/ntv2interrupts.cpp',
+ 'ajalibraries/ajantv2/src/ntv2konaflashprogram.cpp',
+ 'ajalibraries/ajantv2/src/lin/ntv2linuxdriverinterface.cpp',
+ 'ajalibraries/ajantv2/src/ntv2mailbox.cpp',
+ 'ajalibraries/ajantv2/src/ntv2mbcontroller.cpp',
+ 'ajalibraries/ajantv2/src/ntv2mcsfile.cpp',
+ 'ajalibraries/ajantv2/src/ntv2nubaccess.cpp',
+ 'ajalibraries/ajantv2/src/ntv2nubpktcom.cpp',
+ 'ajalibraries/ajantv2/src/ntv2publicinterface.cpp',
+ 'ajalibraries/ajantv2/src/ntv2register.cpp',
+ 'ajalibraries/ajantv2/src/ntv2registerexpert.cpp',
+ 'ajalibraries/ajantv2/src/ntv2resample.cpp',
+ 'ajalibraries/ajantv2/src/ntv2routingexpert.cpp',
+ 'ajalibraries/ajantv2/src/ntv2rp188.cpp',
+ 'ajalibraries/ajantv2/src/ntv2serialcontrol.cpp',
+ 'ajalibraries/ajantv2/src/ntv2signalrouter.cpp',
+ 'ajalibraries/ajantv2/src/ntv2spiinterface.cpp',
+ 'ajalibraries/ajantv2/src/ntv2subscriptions.cpp',
+ 'ajalibraries/ajantv2/src/ntv2supportlogger.cpp',
+ 'ajalibraries/ajantv2/src/ntv2transcode.cpp',
+ 'ajalibraries/ajantv2/src/ntv2utf8.cpp',
+ 'ajalibraries/ajantv2/src/ntv2utils.cpp',
+ 'ajalibraries/ajantv2/src/ntv2verticalfilter.cpp',
+ 'ajalibraries/ajantv2/src/ntv2vpid.cpp',
+ 'ajalibraries/ajantv2/src/ntv2vpidfromspec.cpp',
+ 'ajalibraries/ajantv2/src/ntv2task.cpp',
+ 'ajalibraries/ajantv2/src/ntv2testpatterngen.cpp',
+]
+
+ajantv2_args = [
+ '-D_REENTRANT',
+ '-DAJASTATIC',
+ '-DAJALinux',
+ '-DAJA_LINUX',
+ '-D_LARGEFILE_SOURCE',
+ '-D_LARGEFILE64_SOURCE',
+ '-D_FILE_OFFSET_BITS=64',
+]
+
+ajantv2_inc = include_directories(
+ 'ajalibraries/ajaanc/includes',
+ 'ajalibraries/ajantv2/includes',
+ 'ajalibraries/ajantv2/src',
+ 'ajalibraries/ajantv2/src/lin',
+ 'ajalibraries',
+ 'ajalibraries/ajabase',
+)
+
+libajantv2 = static_library(
+ 'libajantv2',
+ sources: ajantv2_sources,
+ cpp_args: ajantv2_args,
+ include_directories: ajantv2_inc,
+ pic: true,
+ override_options: ['cpp_eh=default', 'werror=false'],
+ install: false
+)
+
+libajantv2_dep = declare_dependency(
+ link_with: libajantv2,
+ include_directories: ajantv2_inc,
+)