AJA Video Systems

NTV2 Porting Guide

This article suggests how to port application code that builds against an older NTV2 SDK to the most recent SDK.

(Last updated:  October, 2024)

Porting from the pre-13.0 “ancient world”

These four steps will cover 80% of the porting effort:

  1. Port “NTV2RoutingEntry” to use “NTV2InputCrosspointID”s
  2. Port “CNTV2Task” to new “AutoCirculateTransfer” API
  3. Replace old AutoCirculate calls with the new ones:
    • Replace all calls to InitAutoCirculate with AutoCirculateInitForInput or AutoCirculateInitForOutput
    • Replace all calls to StartAutoCirculate with AutoCirculateStart
    • Replace all calls to StopAutoCirculate with AutoCirculateStop
    • Replace all calls to AbortAutoCirculate with AutoCirculateStop(channel, true)
    • Replace all calls to PauseAutoCirculate with AutoCirculatePause or AutoCirculateResume
    • Replace all calls to TransferWithAutoCirculate with AutoCirculateTransfer
    • Replace all calls to FlushAutoCirculate with AutoCirculateFlush
    • Replace all calls to PrerollAutoCirculate with AutoCirculatePreRoll
    • Replace all calls to GetAutoCirculate with AutoCirculateGetStatus
    • Replace all calls to GetFrameStamp with AutoCirculateGetFrame
  4. Heed all compile-time deprecation warnings (e.g., “‘XXX’ is deprecated, use ‘YYY’ instead”).

If it compiles and links without error, congratulations! — your application is compliant with the latest SDK.

If not, make note of the symbols in the compilation errors. This article will show you how to fix them.

NOTE: You can always try to build with a new SDK, but turn off (comment-out) the #define NTV2_DEPRECATE… macros in ajatypes.h which restores most of the old symbols and APIs — but this is not a permanent solution. 

SDK Source Layout Changes

SDK version 13.0 was the first to have the source directories match on all three platforms (Linux, MacOS and Windows). In addition, the SDK was shipped as a .zip file on Windows and Linux for the first time.

Obsolete/Superceded Source Files

The contents of a number of source and header files have become obsolete and/or assumed into other source/header files. The obsolete files may be removed in a future SDK.

Obsolete/superceded implementation files:

Obsolete/superceded headers:

API Changes

It’s a good practice to start at the Knowledgebase article for the SDK version your application is currently built for, then “walk” forward through the Knowledgebase to each successive SDK, noting the API Changes. This section condenses many of these changes into a series of search/replace steps, for your convenience.

  1. Replace all occurrences of NTV2_TCDEST_… with NTV2_TCINDEX_…
  2. Replace all occurrences of NTV2_TCSOURCE_… with NTV2_TCINDEX_…
  3. Replace all occurrences of NTV2DeviceGetNumAudioStreams with NTV2DeviceGetNumAudioSystems
  4. Replace all uses of NTV2DeviceCanDoLTCOutN(id,N) with NTV2DeviceGetNumLTCOutputs(id) > N
  5. Replace all occurrences of NTV2BoardCanDo… with NTV2DeviceCanDo…
  6. Replace all occurrences of NTV2BoardGetNum… with NTV2DeviceGetNum…
  7. Remove all occurrences of NTV2BoardType.
  8. Remove all uses of NTV2DeviceType, DEVICETYPE_UNKNOWN and/or DEVICETYPE_NTV2.
  9. Any/all CNTV2Card::Open calls should have at most two parameters: the index number and an optional host name (now a std::string).
  10. Remove all calls to the NTV2DeviceTypeString function.
  11. Remove all uses of BOARDTYPE_SCANNABLE.
  12. Remove all uses of BOARDTYPE_NTV2.
  13. Remove all uses of BOARDTYPE_AS_COMPILED.
  14. Replace all occurrences of BOARD_ID_… with DEVICE_ID_….
  15. Remove all uses of NTV2BoardSubType.
  16. Remove all uses of BOARDSUBTYPE_….
  17. Replace all occurrences of NTV2_V2_STANDARD_… with NTV2_STANDARD_….
  18. Replace all occurrences of NTV2V2Standard with NTV2Standard.
  19. Replace all occurrences of IS_PROGRESSIVE_NTV2Standard and IS_PROGRESSIVE_STANDARD with NTV2_IS_PROGRESSIVE_STANDARD.
  20. Replace all occurrences of NTV2_IS_VALID_NTV2Standard and NTV2_IS_VALID_NTV2V2Standard with NTV2_IS_VALID_STANDARD.
  21. Anywhere an NTV2FrameDimensions value was used, replace all occurrences of .cx or .cy with .Width() and .Height() respectively.
  22. Replace calls to IsKonaIPDevice with IsIPDevice.
  23. Replace all occurrences of AJATestPatternGen with NTV2TestPatternGen.
  24. Replace calls to getTestPatternList with calls to getTestPatternNames.
  25. Replace all uses of AJATestPattern… data types with NTV2TestPattern… ones.
  26. Replace all uses of AJATestPattEx… enums with NTV2_TestPatt_… ones.
  27. Un-numbered HDMIIn output crosspoint IDs are now numbered, so replace NTV2_XptHDMIIn… with e.g. NTV2_XptHDMIIn1.

API Changes — NTV2FormatDescriptor and NTV2VANCMode:

  1. Any source file that contains NTV2FormatDescriptor must #include "ntv2formatdescriptor.h" (or include another header file that includes it).
  2. Any use of two booleans for “vancEnabled” and “wideVanc” (or “tallerVanc”) should simply use a single NTV2VANCMode.
  3. Replace calls to GetFormatDescriptor with the equivalent NTV2FormatDescriptor constructor.
  4. Replace calls to GetVideoWriteSize (videoFormat, pixelFormat, isVancEnabled, isWideVanc) with GetVideoWriteSize(videoFormat, pixelFormat, vancMode)
  5. Replace calls to SetEnableVANCData with SetVANCMode.
  6. Replace calls to GetEnableVANCData (&isVancEnabled, &isTallVanc, channel) with GetVANCMode (vancMode, channel)

API Changes — AJA Caption Library

  1. Replace all calls to IsCaptionChannel with call to IsLine21CaptionChannel
  2. Replace all calls to IsTextChannel with call to IsLine21TextChannel
  3. In SDK 14.2, caption library logging changed substantially to use the vastly more convenient AJA Logger utility.
  4. Most of the kCaptionLog_ constants were removed.
  5. GetDefaultCaptionLogOutputStream and SetDefaultCaptionLogOutputStream were removed.
  6. The Log, LogIf and SetLogStream methods are deprecated. Don’t use them.

API Changes — CXena2VidProc (Mixer)

  1. Replace all uses of CXena2VidProc class with CNTV2Card.
  2. Replace all calls to GetXena2VidProcMode, GetXena2VidProc2Mode, GetXena2VidProc3Mode, etc. with GetMixerMode, specifying the Mixer index number 0, 1, 2, etc. as appropriate.
  3. Replace all calls to SetXena2VidProcMode, SetXena2VidProc2Mode, SetXena2VidProc3Mode, etc. with SetMixerMode, specifying the Mixer index number 0, 1, 2, etc. as appropriate.
  4. Replace all calls to GetMixCoefficient, GetMix2Coefficient, GetMix3Coefficient, etc. with GetMixerCoefficient, specifying the Mixer index number 0, 1, 2, etc. as appropriate.
  5. Replace all calls to SetMixCoefficient, SetMix2Coefficient, SetMix3Coefficient, etc. with SetMixerCoefficient, specifying the Mixer index number 0, 1, 2, etc. as appropriate.
  6. Replace all calls to GetXena2VidProcInputControl, GetXena2VidProc2InputControl, GetXena2VidProc3InputControl, etc. with GetMixerFGInputControl for NTV2_CHANNEL1 or GetMixerBGInputControl for NTV2_CHANNEL2, specifying the Mixer index number 0, 1, 2, etc. as appropriate.
  7. Replace all calls to SetXena2VidProcInputControl, SetXena2VidProc2InputControl, SetXena2VidProc3InputControl, etc. with SetMixerFGInputControl for NTV2_CHANNEL1 or SetMixerBGInputControl for NTV2_CHANNEL2, specifying the Mixer index number 0, 1, 2, etc. as appropriate.
  8. Remove all calls to GetSplitMode, SetSplitMode, and SetSplitParameters – this feature is no longer supported by AJA devices.

API Changes — Use non-const-references instead of pointers for CNTV2Card “getter” methods:

When a “getter” method has a non-constant-reference return argument, we recommend using that instead of pointers — e.g., replace GetXXXX(&variable) with GetXXXX(variable).

SDK 12.4.2 changes (from 12.3)

SDK 12.5.0 changes (from 12.4.2)

SDK 13.0 changes (from 12.5.x)

SDK 13.1 changes (from 13.0)

SDK 14.0 changes (from 13.1)

SDK 14.2 & 14.3 changes (from 14.0)

SDK 15.0 changes (from 14.3)

SDK 15.2 changes (from 15.1)

SDK 15.2.2 changes (from 15.2)

SDK 15.5 changes (from 15.2.2)

SDK 16.0 changes (from 15.5)

New Device Support:

SDK 16.2 changes (from 16.0)

SDK changes after 16.2

The NTV2 SDK became open-source as of version 17.0. See the open-source documentation for SDK changes after 17.0.