From 009d85d512f432124cd7beaf5a484e60ef3ffe99 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 19 Apr 2021 09:34:16 +0200 Subject: [PATCH] NDI cap.: print NDI version in GitHub build --- .github/scripts/Linux/prepare.sh | 1 + .github/scripts/Windows/prepare_msys.sh | 1 + .github/scripts/macOS/prepare.sh | 1 + src/video_capture/ndi.cpp | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/.github/scripts/Linux/prepare.sh b/.github/scripts/Linux/prepare.sh index def2c68f0..b9109daca 100755 --- a/.github/scripts/Linux/prepare.sh +++ b/.github/scripts/Linux/prepare.sh @@ -63,6 +63,7 @@ if [ -n "$SDK_URL" -a "$GITHUB_REF" = refs/heads/ndi-build ]; then tar -C /var/tmp -xzf NDISDK_Linux.tar.gz yes | PAGER=cat /var/tmp/InstallNDI*sh sudo cp -r NDI\ SDK\ for\ Linux/include/* /usr/local/include + cat NDI\ SDK\ for\ Linux/Version.txt | sed 's/\(.*\)/\#define NDI_VERSION \"\1\"/' | sudo tee /usr/local/include/ndi_version.h sudo cp -r NDI\ SDK\ for\ Linux/lib/x86_64-linux-gnu/* /usr/local/lib sudo ldconfig fi diff --git a/.github/scripts/Windows/prepare_msys.sh b/.github/scripts/Windows/prepare_msys.sh index b57c5734f..5c6f60d30 100644 --- a/.github/scripts/Windows/prepare_msys.sh +++ b/.github/scripts/Windows/prepare_msys.sh @@ -18,6 +18,7 @@ if test -d /c/Program\ Files/NewTek; then NDI_D=$(ls -d /c/Program\ Files/NewTek/*SDK) export CPATH=$CPATH:$NDI_D/Include export LIBRARY_PATH=$LIBRARY_PATH:$NDI_D/Lib/x64 + cat $NDI_D/Version.txt | sed 's/\(.*\)/\#define NDI_VERSION \"\1\"/' | tee /usr/local/include/ndi_version.h fi JACK_D=/c/Program\ Files\ \(x86\)/Jack diff --git a/.github/scripts/macOS/prepare.sh b/.github/scripts/macOS/prepare.sh index a3006e0cc..c1bfcfc50 100755 --- a/.github/scripts/macOS/prepare.sh +++ b/.github/scripts/macOS/prepare.sh @@ -66,6 +66,7 @@ fi if [ -f /var/tmp/sdks/NDISDK_Apple.pkg ]; then sudo installer -pkg /var/tmp/sdks/NDISDK_Apple.pkg -target / sudo mv "/Library/NDI SDK for Apple/" /Library/NDI + cat /Library/NDI/Version.txt | sed 's/\(.*\)/\#define NDI_VERSION \"\1\"/' | sudo tee /usr/local/include/ndi_version.h cd /Library/NDI/lib/x64 sudo ln -s libndi.?.dylib libndi.dylib export CPATH=${CPATH:+"$CPATH:"}/Library/NDI/include diff --git a/src/video_capture/ndi.cpp b/src/video_capture/ndi.cpp index a6502b3a3..6f3342411 100644 --- a/src/video_capture/ndi.cpp +++ b/src/video_capture/ndi.cpp @@ -72,6 +72,10 @@ #include "video.h" #include "video_capture.h" +#if __has_include() +#include +#endif + static constexpr double DEFAULT_AUDIO_DIVISOR = 1; static constexpr const char *MOD_NAME = "[NDI cap.] "; @@ -164,6 +168,9 @@ static void show_help(const NDIlib_find_create_t *find_create_settings) { } cout << "\n"; NDIlib_find_destroy(pNDI_find); +#ifdef NDI_VERSION + cout << NDI_VERSION "\n"; +#endif } static int vidcap_ndi_init(struct vidcap_params *params, void **state)