AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
“libajantv2” Class Library

This library contains the principal classes and data types that interface with the NTV2 device driver, plus a number of utility classes that deal with NTV2-specific data formats.

Most NTV2 functions and class methods return a bool value of true for “success” and false for “failure”. NTV2 functions and classes do not intentionally or explicitly throw exceptions. Under unusual and extreme conditions (e.g. memory exhaustion), it's possible for an exception to be thrown (e.g. std::bad_alloc).

Principal Classes

Note
Avoid deriving subclasses from AJA-provided classes. AJA recommends using aggregation techniques to incorporate NTV2 functionality into your own classes.

CNTV2DeviceScanner Class

The CNTV2DeviceScanner class is used to enumerate or find available devices.

Example: Discovering all attached devices
CNTV2Card device;
ULWord ndx(0);
{
// The device instance is guaranteed to be open and valid if GetDeviceAtIndex returns true
std::cout << ndx << ": " << device.GetDisplayName() << std::endl;
ndx++;
}

CNTV2Card Class

The CNTV2Card class is used to interrogate and control an NTV2 device. Normally an instance of this class is obtained from one of the CNTV2DeviceScanner class methods.

Note
For multiple, concurrent ingest or playout threads, for better performance, AJA recommends using separate per-thread CNTV2Card instances.

CNTV2Card has a very large number of instance methods that inquire about and/or control different aspects of the hardware, which can be organized into several API groups. Here are some examples (this list is not comprehensive):

Example: Read FrameStore 1 Control Register
CNTV2Card device;
{
ULWord value(0);
device.ReadRegister(1, value);
}

Device Features API

The “NTV2Device…” functions describe AJA NTV2 device capabilities. All of the functions accept an NTV2DeviceID parameter that identifies the AJA device model (and in many cases firmware personality) of interest.

Note
A device need not be installed in or attached to the host to use these functions.

See also Determining Firmware Features for more information.

‘CanDo’ Functions

These functions have names starting with “NTV2DeviceCanDo…” and return a bool value that answers Yes or No for a particular device capability. Most of them accept a single NTV2DeviceID parameter, like NTV2DeviceCanDoAnalogAudio, which answers true if the device is capable of working with analog audio. A smaller set of functions accept two parameters: the NTV2DeviceID parameter, and a second enumeration parameter, for determining if a device is capable of working with a particular video format (e.g., NTV2DeviceCanDoVideoFormat) or frame buffer format (NTV2DeviceCanDoFrameBufferFormat), etc.

For example, to find out which Thunderbolt-connected devices support NTV2_FBF_10BIT_RGB, you can code the following:

const NTV2DeviceIDSet supportedDeviceIDs (::NTV2GetSupportedDevices());
NTV2DeviceIDSet deviceIDsWithThunderboltAndRGB10;
for (NTV2DeviceIDSetConstIter it(supportedDeviceIDs.begin()); it != supportedDeviceIDs.end(); ++it)
{
deviceIDsWithThunderboltAndRGB10.push_back (*it);
}

‘Has’ Functions

These functions are similar to the “Can Do” functions. They also return a bool value that answers Yes or No for a particular device capability. For example, you may want to know if a device has bi-directional SDI connectors:

CNTV2Card theDevice;
NTV2Channel outputChannel(NTV2_CHANNEL2);
. . .
theDevice.SetSDITransmitEnable(outputChannel, true);

‘GetNum’ Functions

These functions return a count of a particular device feature. For example, to find out which devices have at least one HDMI output:

const NTV2DeviceIDSet supportedDeviceIDs(::NTV2GetSupportedDevices());
NTV2DeviceIDSet deviceIDsWithHDMIOut;
for (NTV2DeviceIDSetConstIter it(supportedDeviceIDs.begin()); it != supportedDeviceIDs.end(); ++it)
{
deviceIDsWithHDMIOut.push_back(*it);
}

CNTV2SignalRouter Class

The CNTV2SignalRouter class is used to help perform Widget Signal Routing.

See Widget Signal Routing for more details.

NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1308
CNTV2MacDriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2macdriverinterface.cpp:709
NTV2GetSupportedDevices
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds=NTV2_DEVICEKIND_ALL)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7552
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific Frame Store. They're also commonly used to i...
Definition: ntv2enums.h:1305
NTV2DeviceIDSetConstIter
NTV2DeviceIDSet::const_iterator NTV2DeviceIDSetConstIter
A convenient const iterator for NTV2DeviceIDSet.
Definition: ntv2utils.h:1033
NTV2DeviceCanDoFrameBufferFormat
bool NTV2DeviceCanDoFrameBufferFormat(const NTV2DeviceID inDeviceID, const NTV2FrameBufferFormat inFBFormat)
Definition: ntv2devicefeatures.hpp:15330
CNTV2Card::SetSDITransmitEnable
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
Definition: ntv2register.cpp:3805
NTV2DeviceCanDoThunderbolt
bool NTV2DeviceCanDoThunderbolt(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:5466
CNTV2Card::GetDisplayName
virtual std::string GetDisplayName(void)
Answers with this device's display name.
Definition: ntv2card.cpp:84
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2DeviceHasBiDirectionalSDI
bool NTV2DeviceHasBiDirectionalSDI(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:6454
NTV2DeviceGetNumHDMIVideoOutputs
UWord NTV2DeviceGetNumHDMIVideoOutputs(const NTV2DeviceID inDeviceID)
Definition: ntv2devicefeatures.hpp:10855
CNTV2Card
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:262
CNTV2DeviceScanner::GetDeviceAtIndex
static bool GetDeviceAtIndex(const ULWord inDeviceIndexNumber, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device having the given zero-bas...
Definition: ntv2devicescanner.cpp:237
NTV2DeviceIDSet
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1031
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:371
NTV2_FBF_10BIT_RGB
@ NTV2_FBF_10BIT_RGB
See 10-Bit RGB Format.
Definition: ntv2enums.h:214