Skip to content

Commit

Permalink
Update AJA SDK to 17.1 (#572)
Browse files Browse the repository at this point in the history
### Update AJA SDK to 17.1

### Summarize your change.

- [x] Update the SDK version in aja.cmake and fix issues related with OS
specific header files that are no longer copied and the addition of the
mbedtls library that we need to link against
- [x] Replace code related to `ScanHardware()` and `GetDeviceInfoList()`
since both functions have been deprecated

### Describe the reason for the change.
The SDK needs to be at the latest version.

### Describe what you have tested and on which operating system.
Presentation mode with the AJA Io 4K Plus device with HDMI and SDI on
MacOS.

---------

Signed-off-by: Éloïse Brosseau <[email protected]>
  • Loading branch information
eloisebrosseau authored Dec 10, 2024
1 parent 73b02c3 commit 1a53c2d
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 249 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
dnf install -y epel-release
dnf config-manager --set-enabled ${{ matrix.extra_repo }} devel
dnf groupinstall "Development Tools" -y
dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget
dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget
dnf install -y xz-devel mesa-libGLU mesa-libGLU-devel
- name: Install other system dependencies
Expand Down Expand Up @@ -577,4 +577,4 @@ jobs:
- name: Install OpenRV
run: |
cmake --install _build --prefix $(pwd)/_install --config ${{ matrix.build-type }}
shell: msys2 {0}
shell: msys2 {0}
171 changes: 75 additions & 96 deletions cmake/dependencies/aja.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,79 @@
INCLUDE(ProcessorCount) # require CMake 3.15+
PROCESSORCOUNT(_cpu_count)

RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_AJA" "16.2" "make" "")
RV_CREATE_STANDARD_DEPS_VARIABLES("RV_DEPS_AJA" "17.1.0" "make" "")
RV_SHOW_STANDARD_DEPS_VARIABLES()

SET(_patch
"bugfix5"
)
STRING(REPLACE "." "_" _version_with_underscore ${_version})

SET(_download_url
"https://github.com/aja-video/ntv2/archive/refs/tags/v${_version}-${_patch}.zip"
"https://github.com/aja-video/libajantv2/archive/refs/tags/ntv2_${_version_with_underscore}.zip"
)

SET(_download_hash
"5ec7f3f7ecfc322ca9307203155a4481"
"b9d189f77e18dbdff7c39a339b1a5dd4"
)

SET(_install_dir
${RV_DEPS_BASE_DIR}/${_target}/install
IF(RV_TARGET_WINDOWS)
RV_MAKE_STANDARD_LIB_NAME(ajantv2_vs143_MT "" "SHARED" "d")
ELSE()
RV_MAKE_STANDARD_LIB_NAME(ajantv2 "" "SHARED" "d")
ENDIF()

SET(_aja_ntv2_include_dir
${_include_dir}/libajantv2/ajantv2/includes
)
SET(_include_dir
${_install_dir}/include
SET(_aja_include_dir
${_include_dir}/libajantv2
)

IF(RV_TARGET_LINUX)
SET(_lib_dir
${_install_dir}/lib64
)
IF(RHEL_VERBOSE)
SET(_mbedtls_lib_dir
${_build_dir}/ajantv2/mbedtls-install/lib64
)
ELSE()
SET(_lib_dir
${_install_dir}/lib
)
SET(_mbedtls_lib_dir
${_build_dir}/ajantv2/mbedtls-install/lib
)
ENDIF()

SET(_make_command
make
)
SET(_configure_command
cmake
)
SET(_mbedtls_lib ${_mbedtls_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}mbedtls${CMAKE_STATIC_LIBRARY_SUFFIX})
SET(_mbedx509_lib ${_mbedtls_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}mbedx509${CMAKE_STATIC_LIBRARY_SUFFIX})
SET(_mbedcrypto_lib ${_mbedtls_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX})

IF(${RV_OSX_EMULATION})
SET(_darwin_x86_64
"arch" "${RV_OSX_EMULATION_ARCH}"
)
LIST(APPEND _byproducts ${_mbedtls_lib} ${_mbedx509_lib} ${_mbedcrypto_lib})

SET(_make_command
${_darwin_x86_64} ${_make_command}
# There is an issue with the recent AJA SDK : the OS specific header files are no longer copied to _aja_ntv2_include_dir Adding custom paths here to work around
# this issue
IF(RV_TARGET_LINUX)
SET(_aja_ntv2_os_specific_include_dir
${_include_dir}/libajantv2/ajantv2/src/lin
)
SET(_configure_command
${_darwin_x86_64} ${_configure_command}
ELSEIF(RV_TARGET_DARWIN)
SET(_aja_ntv2_os_specific_include_dir
${_include_dir}/libajantv2/ajantv2/src/mac
)
ENDIF()

IF(RV_TARGET_WINDOWS)
# MSYS2/CMake defaults to Ninja
SET(_make_command
ninja
)
ENDIF()

IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
SET(AJA_DEBUG_POSTFIX
"d"
ELSEIF(RV_TARGET_WINDOWS)
SET(_aja_ntv2_os_specific_include_dir
${_include_dir}/libajantv2/ajantv2/src/win
)
ENDIF()

SET(_aja_ntv2_libname
${CMAKE_STATIC_LIBRARY_PREFIX}ajantv2${AJA_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
LIST(APPEND
_configure_options
"-DAJANTV2_DISABLE_DEMOS=ON"
"-DAJANTV2_DISABLE_TOOLS=ON"
"-DAJANTV2_DISABLE_TESTS=ON"
"-DAJANTV2_BUILD_SHARED=ON"
)

SET(_aja_ntv2_lib
${_lib_dir}/${_aja_ntv2_libname}
)
SET(_aja_ntv2_include_dir
${_include_dir}/ajalibraries/ajantv2/includes
)
SET(_aja_include_dir
${_include_dir}/ajalibraries
)
# In Debug, the MSVC runtime library needs to be set to MultiThreadedDebug. Otherwise, it will be set to MultiThreaded.
IF(RV_TARGET_WINDOWS AND CMAKE_BUILD_TYPE MATCHES "^Debug$")
LIST(APPEND
_configure_options
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug"
)
ENDIF()

EXTERNALPROJECT_ADD(
${_target}
Expand All @@ -93,34 +88,46 @@ EXTERNALPROJECT_ADD(
DOWNLOAD_NAME ${_target}_${_version}.zip
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_DIR ${RV_DEPS_BASE_DIR}/${_target}/src
SOURCE_DIR ${_source_dir}
BINARY_DIR ${_build_dir}
INSTALL_DIR ${_install_dir}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -G Ninja -DCMAKE_INSTALL_PREFIX=${_install_dir} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DAJA_BUILD_APPS=OFF ${RV_DEPS_BASE_DIR}/${_target}/src
# Not using _cmake_build_command and _cmake_install_command since the build dir need to change.
BUILD_COMMAND ${CMAKE_COMMAND} --build ${RV_DEPS_BASE_DIR}/${_target}/src --config ${CMAKE_BUILD_TYPE} -j${_cpu_count}
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${RV_DEPS_BASE_DIR}/${_target}/src --prefix ${_install_dir} --config ${CMAKE_BUILD_TYPE}
BUILD_IN_SOURCE TRUE
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${_configure_options}
BUILD_COMMAND ${_cmake_build_command}
INSTALL_COMMAND ${_cmake_install_command} && ${CMAKE_COMMAND} -E copy_directory ${_mbedtls_lib_dir} ${_lib_dir}
BUILD_IN_SOURCE FALSE
BUILD_ALWAYS FALSE
BUILD_BYPRODUCTS ${_aja_ntv2_lib}
BUILD_BYPRODUCTS ${_byproducts}
USES_TERMINAL_BUILD TRUE
)

ADD_LIBRARY(aja::ntv2 STATIC IMPORTED GLOBAL)
RV_COPY_LIB_BIN_FOLDERS()

ADD_LIBRARY(aja::ntv2 SHARED IMPORTED GLOBAL)
ADD_DEPENDENCIES(aja::ntv2 ${_target})
SET_PROPERTY(
TARGET aja::ntv2
PROPERTY IMPORTED_LOCATION ${_aja_ntv2_lib}
PROPERTY IMPORTED_LOCATION ${_libpath}
)
SET_PROPERTY(
TARGET aja::ntv2
PROPERTY IMPORTED_SONAME ${_aja_ntv2_libname}
PROPERTY IMPORTED_SONAME ${_libname}
)
IF(RV_TARGET_WINDOWS)
SET_PROPERTY(
TARGET aja::ntv2
PROPERTY IMPORTED_IMPLIB ${_implibpath}
)
ENDIF()

FILE(MAKE_DIRECTORY ${_aja_include_dir} ${_aja_ntv2_include_dir})
FILE(MAKE_DIRECTORY ${_aja_include_dir} ${_aja_ntv2_include_dir} ${_aja_ntv2_os_specific_include_dir})
TARGET_INCLUDE_DIRECTORIES(
aja::ntv2
INTERFACE ${_aja_include_dir} ${_aja_ntv2_include_dir}
INTERFACE ${_aja_include_dir} ${_aja_ntv2_include_dir} ${_aja_ntv2_os_specific_include_dir}
)

TARGET_LINK_LIBRARIES(
aja::ntv2 INTERFACE
${_mbedtls_lib} ${_mbedx509_lib} ${_mbedcrypto_lib}
)

IF(RV_TARGET_DARWIN)
Expand All @@ -140,37 +147,9 @@ SET(RV_DEPS_AJA_COMPILE_OPTIONS

LIST(APPEND RV_DEPS_LIST aja::ntv2)

IF(RV_TARGET_WINDOWS)
FILE(MAKE_DIRECTORY ${_install_dir}/lib)
FILE(MAKE_DIRECTORY ${_install_dir}/bin)

ADD_CUSTOM_COMMAND(
TARGET ${_target}
POST_BUILD
COMMENT "Installing ${_target}'s libs and bin into ${RV_STAGE_LIB_DIR} and ${RV_STAGE_BIN_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/lib ${RV_STAGE_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_install_dir}/bin ${RV_STAGE_BIN_DIR}
)
ADD_CUSTOM_TARGET(
${_target}-stage-target ALL
DEPENDS ${RV_STAGE_LIB_DIR}/${_aja_ntv2_libname}
)
ELSE()
ADD_CUSTOM_COMMAND(
COMMENT "Installing ${_target}'s libs into ${RV_STAGE_LIB_DIR}"
OUTPUT ${RV_STAGE_LIB_DIR}/${_aja_ntv2_libname}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_lib_dir} ${RV_STAGE_LIB_DIR}
DEPENDS ${_target}
)
ADD_CUSTOM_TARGET(
${_target}-stage-target ALL
DEPENDS ${RV_STAGE_LIB_DIR}/${_aja_ntv2_libname}
)
ENDIF()

ADD_DEPENDENCIES(dependencies ${_target}-stage-target)

SET(RV_DEPS_AJA_VERSION
${_version}
CACHE INTERNAL "" FORCE
)
)
16 changes: 9 additions & 7 deletions docs/build_system/config_linux_centos7.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

## Summary

1. [Install Basics](#install-basics)
1. [Install devtoolset-9](#install-devtoolset-9)
1. [Install tools and build dependencies](#install-tools-and-build-dependencies)
1. [Install CMake](#install-cmake)
1. [Install nasm](#install-nasm)
1. [Install Qt5](#install-qt)
- [Summary](#summary)
- [Install Basics](#install-basics)
- [Install devtoolset-9](#install-devtoolset-9)
- [Install tools and build dependencies](#install-tools-and-build-dependencies)
- [Install the python requirements](#install-the-python-requirements)
- [Install CMake](#install-cmake)
- [Install nasm](#install-nasm)
- [Install Qt](#install-qt)

## Install Basics

Expand Down Expand Up @@ -35,7 +37,7 @@ scl enable devtoolset-9 $SHELL
Most of the build requirements can be installed using the following command:

```bash
sudo yum install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex glew-devel libXcomposite libXi-devel libaio-devel libffi-devel ncurses-devel libtool libxkbcommon openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 mesa-libOSMesa mesa-libOSMesa-devel ocl-icd opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tk-devel yasm zlib-devel
sudo yum install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex glew-devel libXcomposite libXi-devel libaio-devel libffi-devel ncurses-devel libtool libudev-devel libxkbcommon openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 mesa-libOSMesa mesa-libOSMesa-devel ocl-icd opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tk-devel yasm zlib-devel
```

### Install the python requirements
Expand Down
4 changes: 2 additions & 2 deletions docs/build_system/config_linux_rocky8.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Some of the build dependencies come from outside the main AppStream repo. So fir
```bash
sudo dnf install epel-release
sudo dnf config-manager --set-enabled powertools
sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel
sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel
```

You can disable the devel repo afterwards since dnf will warn about it:
Expand Down Expand Up @@ -221,4 +221,4 @@ Container id is the same as the one used in the step [Go into the container](go_

```bash
docker cp <container id>:/home/rv/OpenRV/_build/stage ./openrv_stage
```
```
4 changes: 2 additions & 2 deletions docs/build_system/config_linux_rocky9.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Some of the build dependencies come from outside the main AppStream repo. So fir
```bash
sudo dnf install epel-release
sudo dnf config-manager --set-enabled crb devel
sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch perl-FindBin pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel
sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch perl-FindBin pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel
```

You can disable the devel repo afterwards since dnf will warn about it:
Expand Down Expand Up @@ -229,4 +229,4 @@ Container id is the same as the one used in the step [Go into the container](go_

```bash
docker cp <container id>:/home/rv/OpenRV/_build/stage ./openrv_stage
```
```
23 changes: 8 additions & 15 deletions src/plugins/output/AJADevices/AJADevices/AJAModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,19 @@ namespace AJADevices
SimpleMode
};

AJAModule( NativeDisplayPtr, unsigned int app4CC, OperationMode );
virtual ~AJAModule();
AJAModule( NativeDisplayPtr, unsigned int appID, OperationMode );
~AJAModule() override;

virtual std::string name() const;
virtual std::string SDKIdentifier() const;
virtual std::string SDKInfo() const;
virtual void open();
virtual void close();
virtual bool isOpen() const;

void* deviceScan() const
{
return m_devicescan;
}
[[nodiscard]] std::string name() const override;
[[nodiscard]] std::string SDKIdentifier() const override;
[[nodiscard]] std::string SDKInfo() const override;
void open() override;
void close() override;
[[nodiscard]] bool isOpen() const override;

private:
void* m_devicescan{ nullptr };
OperationMode m_mode{ OperationMode::ProMode };
unsigned int m_appID{ 0 };
};

} // namespace AJADevices

Loading

0 comments on commit 1a53c2d

Please sign in to comment.