Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/driver/linux/ajardma.mod
/driver/linux/ajardma.mod.c
.DS_Store
/.cache
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "thirdparty/wutils"]
path = thirdparty/wutils
url = git@github.com:mccakit/wutils.git
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

# For CMAKE_MSVC_RUNTIME_LIBRARY compatability. Per note: This must be before the first project()
# For CMAKE_MSVC_RUNTIME_LIBRARY compatability. Per note: This must be before the first project()
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
Expand All @@ -27,16 +27,16 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()

if(NOT CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
endif()
endif()

option(AJANTV2_BUILD_OPENSOURCE "Build libajantv2 as open-source (MIT license)?" ON)
option(AJANTV2_BUILD_SHARED "Build libajantv2 shared libraries?" OFF)
option(AJANTV2_BUILD_SHARED "Build libajantv2 shared libraries?" ON)

option(AJANTV2_DISABLE_DEMOS "Disable building libajantv2 demo apps?" OFF)
option(AJANTV2_DISABLE_DEMOS "Disable building libajantv2 demo apps?" ON)
option(AJANTV2_DISABLE_DRIVER "Disable building libajantv2 driver (Linux-only)?" OFF)
option(AJANTV2_DISABLE_TESTS "Disable building libajantv2 tests?" OFF)
option(AJANTV2_DISABLE_TESTS "Disable building libajantv2 tests?" ON)
option(AJANTV2_DISABLE_TOOLS "Disable building libajantv2 tools?" OFF)
option(AJANTV2_DISABLE_PLUGIN_LOAD "Disable NTV2 3rd party plugin loading?" OFF)
option(AJANTV2_DISABLE_RDMA "Disable building with Nvidia RDMA?" OFF)
Expand Down Expand Up @@ -73,9 +73,9 @@ endif()
if(DEFINED AJA_DISABLE_PLUGIN_LOAD)
set(AJANTV2_DISABLE_PLUGIN_LOAD ${AJA_DISABLE_PLUGIN_LOAD})
endif()

add_subdirectory(thirdparty/wutils)
add_subdirectory(ajantv2)
add_subdirectory(demos)
#add_subdirectory(demos)
add_subdirectory(tools)
add_subdirectory(driver)

Expand Down
8 changes: 3 additions & 5 deletions ajabase/common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <stdlib.h>
#include <wchar.h>

#include "wutils.hpp"
// check for C++11 compatibility
#if defined(_MSC_VER) && _MSC_VER >= 1800
// Visual Studio 2013 (_MSC_VER 1800) has the C++11 support we
Expand Down Expand Up @@ -249,8 +249,7 @@ bool string_to_wstring (const std::string & str, std::wstring & wstr)
{
// use C++11 functionality if available
#if defined(AJA_BASE_USECPP_11)
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converterX;
wstr = converterX.from_bytes(str);
wstr = wutils::ws(str).value;
return true;
#else
#if defined(AJA_WINDOWS)
Expand Down Expand Up @@ -286,8 +285,7 @@ bool wstring_to_string (const std::wstring & wstr, std::string & str)
{
// use C++11 functionality if available
#if defined(AJA_BASE_USECPP_11)
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converterX;
str = converterX.to_bytes(wstr);
str = wutils::s(wstr).value;
return true;
#else
#if defined(AJA_WINDOWS)
Expand Down
8 changes: 4 additions & 4 deletions ajantv2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ else()
GIT_TAG fix-win-dll-cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MBEDTLS_INSTALL_DIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DENABLE_TESTING=OFF
-DENABLE_TESTING=OFF
-DENABLE_PROGRAMS=OFF
-DCMAKE_C_FLAGS=${MBEDTLS_C_FLAGS}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
Expand Down Expand Up @@ -671,7 +671,7 @@ if (NOT TARGET ${PROJECT_NAME})
aja_ntv2_log_build_info()

add_library(${PROJECT_NAME} SHARED ${TARGET_SOURCES})

if (NOT AJANTV2_DISABLE_PLUGIN_LOAD)
add_dependencies(${PROJECT_NAME} mbedtls)
endif()
Expand All @@ -698,7 +698,7 @@ if (NOT TARGET ${PROJECT_NAME})
${TARGET_COMPILE_DEFS_STATIC}
${AJANTV2_TARGET_COMPILE_DEFS})
endif()

target_link_libraries(${PROJECT_NAME} PRIVATE wutils)
set(_compiler_id_c_or_cxx_msvc $<OR:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>)
set(_compiler_is_gnu_or_clang $<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>)
set(_compile_options_win_debug /Od /RTC1 /W3)
Expand Down Expand Up @@ -806,7 +806,7 @@ if (AJA_INSTALL_MISC)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../legacy/build/targets.mk DESTINATION ${CMAKE_INSTALL_PREFIX}/libajantv2/legacy/build)
endif()

install(TARGETS ${PROJECT_NAME}
install(TARGETS ${PROJECT_NAME} wutils
EXPORT ajantv2-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
12 changes: 6 additions & 6 deletions ajantv2/includes/ajatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@file ajatypes.h
@brief Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal
development platform, many typedefs are Windows-centric.
@copyright (C) 2004-2022 AJA Video Systems, Inc.
@copyright (C) 2004-2022 AJA Video Systems, Inc.
**/
#ifndef AJATYPES_H
#define AJATYPES_H
Expand Down Expand Up @@ -83,7 +83,7 @@

Introduced in SDK 12.4.
**************************************************************************************************************/
//#define NTV2_NULL_DEVICE
//#define NTV2_NULL_DEVICE


/**************************************************************************************************************
Expand All @@ -107,7 +107,7 @@

Introduced in SDK 12.4.
**************************************************************************************************************/
#define NTV2_NUB_CLIENT_SUPPORT
#define NTV2_NUB_CLIENT_SUPPORT


/**************************************************************************************************************
Expand Down Expand Up @@ -136,7 +136,7 @@
Introduced in SDK 16.0.
**************************************************************************************************************/
#if !defined(NTV2_USE_CPLUSPLUS11)
#define NTV2_USE_CPLUSPLUS11
#define NTV2_USE_CPLUSPLUS11
#endif // !defined(NTV2_USE_CPLUSPLUS11)


Expand Down Expand Up @@ -278,13 +278,13 @@
#define WIN32_LEAN_AND_MEAN
#endif

#include <Windows.h>
#include <windows.h>

#if defined(DeviceCapabilities)
#undef DeviceCapabilities
#endif
#endif
#include <Basetsd.h>
#include <basetsd.h>
typedef unsigned char Boolean;
typedef __int64 LWord64;
typedef unsigned __int64 ULWord64;
Expand Down
60 changes: 28 additions & 32 deletions ajantv2/src/ntv2config2110.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
@file ntv2config2110.cpp
@brief Implements the CNTV2Config2110 class.
@copyright (C) 2014-2022 AJA Video Systems, Inc.
@copyright (C) 2014-2022 AJA Video Systems, Inc.
**/

#include "ntv2config2110.h"
Expand Down Expand Up @@ -75,25 +75,18 @@ bool tx_2110Config::operator != ( const tx_2110Config &other )
return !(*this == other);
}

bool tx_2110Config::operator == ( const tx_2110Config &other )
bool tx_2110Config::operator==(const tx_2110Config &other)
{
if ((localPort == other.localPort) &&
(remotePort == other.remotePort) &&
(remoteIP == other.remoteIP) &&
(videoFormat == other.videoFormat) &&
(videoSamples == other.videoSamples) &&
(numAudioChannels == other.numAudioChannels) &&
(firstAudioChannel == other.firstAudioChannel) &&
(audioPktInterval == other.audioPktInterval))
{
return true;
}
else
{
return false;
}
return
std::memcmp(localPort, other.localPort, sizeof(localPort)) == 0 &&
std::memcmp(remotePort, other.remotePort, sizeof(remotePort)) == 0 &&
std::memcmp(remoteIP, other.remoteIP, sizeof(remoteIP)) == 0 &&
(videoFormat == other.videoFormat) &&
(videoSamples == other.videoSamples) &&
(numAudioChannels == other.numAudioChannels) &&
(firstAudioChannel== other.firstAudioChannel) &&
(audioPktInterval == other.audioPktInterval);
}

void rx_2110Config::init()
{
rxMatch = 0;
Expand Down Expand Up @@ -529,14 +522,18 @@ void CNTV2Config2110::SetVideoFormatForRxTx(const NTV2Stream stream, const NTV2V

uint32_t reg, reg2;
if (rx)
{
reg = stream - NTV2_CHANNEL1 + kRegRxVideoDecode1;
reg2 = stream - NTV2_CHANNEL1 + kRegRxNtv2VideoDecode1;
}
{
reg = static_cast<RegisterNum>(
static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegRxVideoDecode1)
);
reg2 = static_cast<RegisterNum>(
static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegRxNtv2VideoDecode1)
);
}
else
{
reg = stream - NTV2_CHANNEL1 + kRegTxVideoDecode1;
reg2 = stream - NTV2_CHANNEL1 + kRegTxNtv2VideoDecode1;
reg = static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegTxVideoDecode1);
reg2 = static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegTxNtv2VideoDecode1);
}

// Write the format for the firmware and also tuck it away in NTV2 flavor so we can retrieve it easily
Expand All @@ -552,13 +549,13 @@ void CNTV2Config2110::GetVideoFormatForRxTx(const NTV2Stream stream, NTV2VideoFo
uint32_t reg, reg2, value;
if (rx)
{
reg = stream - NTV2_CHANNEL1 + kRegRxVideoDecode1;
reg2 = stream - NTV2_CHANNEL1 + kRegRxNtv2VideoDecode1;
reg = static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegRxVideoDecode1);
reg2 = static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegRxNtv2VideoDecode1);
}
else
{
reg = stream - NTV2_CHANNEL1 + kRegTxVideoDecode1;
reg2 = stream - NTV2_CHANNEL1 + kRegTxNtv2VideoDecode1;
reg = static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegTxVideoDecode1);
reg2 = static_cast<RegisterNum>(static_cast<uint32_t>(stream) - static_cast<uint32_t>(NTV2_CHANNEL1) + static_cast<uint32_t>(kRegTxNtv2VideoDecode1));
}

// Write the format for the firmware and also tuck it away in NTV2 flavor so we can retrieve it easily
Expand Down Expand Up @@ -1623,7 +1620,7 @@ uint32_t CNTV2Config2110::GetPacketizerAddress(const NTV2Stream stream, const VP
uint32_t index = Get2110TxStreamIndex(stream);
mDevice.WriteRegister(kReg3190_pkt_chan_num + basePacketizer, index);
}

return basePacketizer;
}

Expand Down Expand Up @@ -1916,7 +1913,7 @@ bool CNTV2Config2110::GenSDP(const bool enableSfp1, const bool enableSfp2,
GetPTPStatus(ptpStatus);

char gmInfo[32];
snprintf(gmInfo, sizeof(gmInfo), "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X:%d",
sprintf(gmInfo, "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X:%d",
ptpStatus.PTP_gmId[0], ptpStatus.PTP_gmId[1], ptpStatus.PTP_gmId[2], ptpStatus.PTP_gmId[3],
ptpStatus.PTP_gmId[4], ptpStatus.PTP_gmId[5], ptpStatus.PTP_gmId[6], ptpStatus.PTP_gmId[7], ptpStatus.PTP_domain);

Expand All @@ -1937,7 +1934,7 @@ bool CNTV2Config2110::GenSDP(const bool enableSfp1, const bool enableSfp2,
{
GenAncStreamSDP(sdp, enableSfp1, enableSfp2, stream, &gmInfo[0]);
}

//cout << "SDP --------------- " << stream << endl << sdp.str() << endl;

bool rv = true;
Expand Down Expand Up @@ -3404,4 +3401,3 @@ uint64_t CNTV2Config2110::GetNTPTimestamp()
{
return CNTV2MBController::GetNTPTimestamp();
}

6 changes: 4 additions & 2 deletions ajantv2/src/ntv2enhancedcsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ bool CNTV2EnhancedCSC::SendToHardware (CNTV2Card & inDevice, const NTV2Channel i
cscRegs [11] = ConvertCoeffDoubleToULWord (Matrix().GetCoefficient (NTV2CSCCoeffIndex_C2));
cscRegs [12] = (ULWord(Matrix().GetOffset (NTV2CSCOffsetIndex_PostB)) << 16) | (ULWord(Matrix().GetOffset (NTV2CSCOffsetIndex_PostA)&0xFFFF));
cscRegs [13] = ULWord(Matrix().GetOffset (NTV2CSCOffsetIndex_PostC));
cscRegs [14] = ULWord((mKeyOutputRange & kK2RegMaskEnhancedCSCKeyOutputRange) << kK2RegShiftEnhancedCSCKeyOutputRange) |
ULWord((mKeySource & kK2RegMaskEnhancedCSCKeySource) << kK2RegShiftEnhancedCSCKeySource);
cscRegs[14] =
ULWord((static_cast<uint32_t>(mKeyOutputRange) & static_cast<uint32_t>(kK2RegMaskEnhancedCSCKeyOutputRange)) << kK2RegShiftEnhancedCSCKeyOutputRange) |
ULWord((static_cast<uint32_t>(mKeySource) & static_cast<uint32_t>(kK2RegMaskEnhancedCSCKeySource)) << kK2RegShiftEnhancedCSCKeySource);

cscRegs [15] = (ULWord(mKeyOutputOffset) << 16) | ULWord(mKeyInputOffset);
cscRegs [16] = (ULWord(mKeyGain * 4096.0));

Expand Down
Loading