AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2devicescanner.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef NTV2DEVICESCANNER_H
9 #define NTV2DEVICESCANNER_H
10 
11 #include "ntv2audiodefines.h"
12 #include "ntv2card.h"
13 #include <vector>
14 #include <algorithm>
15 
16 
17 typedef std::vector <AudioSampleRateEnum> NTV2AudioSampleRateList;
18 typedef NTV2AudioSampleRateList::const_iterator NTV2AudioSampleRateListConstIter;
19 typedef NTV2AudioSampleRateList::iterator NTV2AudioSampleRateListIter;
20 
21 typedef std::vector <AudioChannelsPerFrameEnum> NTV2AudioChannelsPerFrameList;
22 typedef NTV2AudioChannelsPerFrameList::const_iterator NTV2AudioChannelsPerFrameListConstIter;
23 typedef NTV2AudioChannelsPerFrameList::iterator NTV2AudioChannelsPerFrameListIter;
24 
25 typedef std::vector <AudioSourceEnum> NTV2AudioSourceList;
26 typedef NTV2AudioSourceList::const_iterator NTV2AudioSourceListConstIter;
27 typedef NTV2AudioSourceList::iterator NTV2AudioSourceListIter;
28 
29 typedef std::vector <AudioBitsPerSampleEnum> NTV2AudioBitsPerSampleList;
30 typedef NTV2AudioBitsPerSampleList::const_iterator NTV2AudioBitsPerSampleListConstIter;
31 typedef NTV2AudioBitsPerSampleList::iterator NTV2AudioBitsPerSampleListIter;
32 
33 
37 typedef struct NTV2DeviceInfo
38 {
42  uint64_t deviceSerialNumber;
43  std::string deviceIdentifier;
59  bool hdvSupport;
68  bool has2KSupport;
69  bool has4KSupport;
70  bool has8KSupport;
73  bool sdi3GSupport;
75  bool ipSupport;
77  bool ltcInSupport;
82  bool multiFormat;
100 
101  AJAExport bool operator == (const NTV2DeviceInfo & rhs) const;
102  AJAExport inline bool operator != (const NTV2DeviceInfo & rhs) const { return !(*this == rhs); }
103 
105 
106 
107 
108 // ostream operators
109 
116 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2AudioSampleRateList & inList);
117 
124 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2AudioChannelsPerFrameList & inList);
125 
132 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2AudioSourceList & inList);
133 
140 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2AudioBitsPerSampleList & inList);
141 
148 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2DeviceInfo & inInfo);
149 
150 
154 typedef std::vector <NTV2DeviceInfo> NTV2DeviceInfoList;
155 typedef NTV2DeviceInfoList::const_iterator NTV2DeviceInfoListConstIter; // Const iterator shorthand
156 typedef NTV2DeviceInfoList::iterator NTV2DeviceInfoListIter; // Iterator shorthand
157 
158 
165 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2DeviceInfoList & inList);
166 
167 
168 typedef struct {
176 
177 
184 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2AudioPhysicalFormat & inFormat);
185 
186 
190 typedef std::vector <NTV2AudioPhysicalFormat> NTV2AudioPhysicalFormatList;
191 typedef NTV2AudioPhysicalFormatList::const_iterator NTV2AudioPhysicalFormatListConstIter; // Shorthand for const_iterator
192 typedef NTV2AudioPhysicalFormatList::iterator NTV2AudioPhysicalFormatListIter; // Shorthand for iterator
193 
194 
201 AJAExport std::ostream & operator << (std::ostream & inOutStr, const NTV2AudioPhysicalFormatList & inList);
202 
203 
204 
209 {
210 // Class Methods
211 public:
218  static bool GetDeviceAtIndex (const ULWord inDeviceIndexNumber, CNTV2Card & outDevice);
219 
226  static bool GetFirstDeviceWithID (const NTV2DeviceID inDeviceID, CNTV2Card & outDevice);
227 
235  static bool GetFirstDeviceWithName (const std::string & inNameSubString, CNTV2Card & outDevice);
236 
244  static bool GetFirstDeviceWithSerial (const std::string & inSerialStr, CNTV2Card & outDevice); // New in SDK 16.0
245 
252  static bool GetDeviceWithSerial (const uint64_t inSerialNumber, CNTV2Card & outDevice); // New in SDK 16.0
253 
266  static bool GetFirstDeviceFromArgument (const std::string & inArgument, CNTV2Card & outDevice);
267 
276  static bool CompareDeviceInfoLists (const NTV2DeviceInfoList & inOldList,
277  const NTV2DeviceInfoList & inNewList,
278  NTV2DeviceInfoList & outDevicesAdded,
279  NTV2DeviceInfoList & outDevicesRemoved);
280 
285  static std::string GetDeviceRefName (CNTV2Card & inDevice); // New in SDK 16.0
286 
291  static bool IsLegalDecimalNumber (const std::string & inStr, const size_t inMaxLength = 2); // New in SDK 16.0
292  static uint64_t IsLegalHexSerialNumber (const std::string & inStr); // New in SDK 16.0 // e.g. "0x3236333331375458"
293  static bool IsHexDigit (const char inChr); // New in SDK 16.0
294  static bool IsDecimalDigit (const char inChr); // New in SDK 16.0
295  static bool IsAlphaNumeric (const char inStr); // New in SDK 16.0
296 
301  static bool IsAlphaNumeric (const std::string & inStr); // New in SDK 16.0
302 
307  static bool IsLegalSerialNumber (const std::string & inStr); // New in SDK 16.0
308 
309 // Instance Methods
310 public:
311  // Construction, Copying, Assigning
317  explicit CNTV2DeviceScanner (const bool inScanNow = true);
318  explicit CNTV2DeviceScanner (bool inScanNow, UWord inDeviceMask);
319 
324  explicit CNTV2DeviceScanner (const CNTV2DeviceScanner & inDeviceScanner);
325 
330  virtual CNTV2DeviceScanner & operator = (const CNTV2DeviceScanner & inDeviceScanner);
331 
332 
333  // Scanning
337  virtual void ScanHardware (void);
338  virtual void ScanHardware (UWord inDeviceMask);
339 
340 
341  // Inquiry
346  virtual inline size_t GetNumDevices (void) const { return GetDeviceInfoList ().size (); }
347 
354  virtual bool DeviceIDPresent (const NTV2DeviceID inDeviceID, const bool inRescan = false);
355 
363  virtual bool GetDeviceInfo (const ULWord inDeviceIndexNumber, NTV2DeviceInfo & outDeviceInfo, const bool inRescan = false);
364 
369  virtual inline NTV2DeviceInfoList & GetDeviceInfoList (void) { return _deviceInfoList; }
370 
375  virtual inline const NTV2DeviceInfoList & GetDeviceInfoList (void) const { return _deviceInfoList; }
376 
377 
378  // Sorting
382  virtual void SortDeviceInfoList (void);
383 
384  virtual inline ~CNTV2DeviceScanner () { }
385 
386 
387 private:
388  virtual void SetAudioAttributes(NTV2DeviceInfo & inDeviceInfo, CNTV2Card & inDevice) const;
389  virtual void SetVideoAttributes (NTV2DeviceInfo & inDevicInfo);
390  virtual void DeepCopy (const CNTV2DeviceScanner & inDeviceScanner);
391 
392 
393 // Instance Data
394 private:
395  NTV2DeviceInfoList _deviceInfoList;
396 
397 }; // CNTV2DeviceScanner
398 
399 #endif // NTV2DEVICESCANNER_H
NTV2AudioPhysicalFormat::sourceIn
AudioSourceEnum sourceIn
Definition: ntv2devicescanner.h:173
operator<<
std::ostream & operator<<(std::ostream &inOutStr, const NTV2AudioSampleRateList &inList)
Streams the NTV2AudioSampleRateList to the given output stream in a human-readable format.
AudioBitsPerSampleEnum
AudioBitsPerSampleEnum
Definition: ntv2audiodefines.h:48
NTV2DeviceInfo::audioOutSourceList
NTV2AudioSourceList audioOutSourceList
My supported audio output destinations (AES, etc.)
Definition: ntv2devicescanner.h:87
NTV2DeviceInfo::quarterExpandSupport
bool quarterExpandSupport
Definition: ntv2devicescanner.h:60
NTV2DeviceInfo::numAnalogAudioInputChannels
UWord numAnalogAudioInputChannels
Total number of analog audio input channels.
Definition: ntv2devicescanner.h:89
NTV2DeviceInfo::biDirectionalSDI
bool biDirectionalSDI
Supports Bi-directional SDI.
Definition: ntv2devicescanner.h:76
NTV2DeviceInfo::audioBitsPerSampleList
NTV2AudioBitsPerSampleList audioBitsPerSampleList
My supported audio bits-per-sample.
Definition: ntv2devicescanner.h:85
NTV2DeviceInfo::numDownConverters
UWord numDownConverters
Total number of down-converters.
Definition: ntv2devicescanner.h:53
NTV2DeviceInfo::numAnlgVidOutputs
UWord numAnlgVidOutputs
Total number of analog video outputs.
Definition: ntv2devicescanner.h:47
NTV2AudioPhysicalFormat::bitsPerSample
AudioBitsPerSampleEnum bitsPerSample
Definition: ntv2devicescanner.h:172
NTV2DeviceInfo::has3GLevelConversion
bool has3GLevelConversion
Supports 3G Level Conversion?
Definition: ntv2devicescanner.h:71
NTV2DeviceInfo::rateConvertSupport
bool rateConvertSupport
Definition: ntv2devicescanner.h:56
CNTV2DeviceScanner
This class is used to enumerate AJA devices that are attached and known to the local host computer.
Definition: ntv2devicescanner.h:208
NTV2DeviceInfo::numHDMIVidInputs
UWord numHDMIVidInputs
Total number of HDMI inputs.
Definition: ntv2devicescanner.h:48
NTV2DeviceInfo::sdi12GSupport
bool sdi12GSupport
Supports 12G?
Definition: ntv2devicescanner.h:74
NTV2DeviceInfoListIter
NTV2DeviceInfoList::iterator NTV2DeviceInfoListIter
Definition: ntv2devicescanner.h:156
ntv2audiodefines.h
Declares common audio macros and structs used in the SDK.
NTV2DeviceInfo::deviceSerialNumber
uint64_t deviceSerialNumber
Unique device serial number.
Definition: ntv2devicescanner.h:42
NTV2DeviceInfo::ltcInSupport
bool ltcInSupport
Accepts LTC input?
Definition: ntv2devicescanner.h:77
NTV2AudioSourceListConstIter
NTV2AudioSourceList::const_iterator NTV2AudioSourceListConstIter
Definition: ntv2devicescanner.h:26
CNTV2DeviceScanner::GetDeviceInfoList
virtual const NTV2DeviceInfoList & GetDeviceInfoList(void) const
Returns an NTV2DeviceInfoList that can be "walked" using standard C++ vector iteration techniques.
Definition: ntv2devicescanner.h:375
NTV2DeviceInfo::numHDMIVidOutputs
UWord numHDMIVidOutputs
Total number of HDMI outputs.
Definition: ntv2devicescanner.h:49
NTV2AudioPhysicalFormat::sourceOut
AudioSourceEnum sourceOut
Definition: ntv2devicescanner.h:174
NTV2DeviceInfoList
std::vector< NTV2DeviceInfo > NTV2DeviceInfoList
I am an ordered list of NTV2DeviceInfo structs.
Definition: ntv2devicescanner.h:154
NTV2DeviceInfo::numSerialPorts
UWord numSerialPorts
Total number of serial ports.
Definition: ntv2devicescanner.h:98
NTV2DeviceID
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
CNTV2DeviceScanner::GetDeviceInfoList
virtual NTV2DeviceInfoList & GetDeviceInfoList(void)
Returns an NTV2DeviceInfoList that can be "walked" using standard C++ vector iteration techniques.
Definition: ntv2devicescanner.h:369
NTV2DeviceInfo::numHDMIAudioOutputChannels
UWord numHDMIAudioOutputChannels
Total number of HDMI audio output channels.
Definition: ntv2devicescanner.h:96
NTV2DeviceInfo::vidProcSupport
bool vidProcSupport
Definition: ntv2devicescanner.h:61
NTV2DeviceInfo::numAnlgVidInputs
UWord numAnlgVidInputs
Total number of analog video inputs.
Definition: ntv2devicescanner.h:46
NTV2AudioChannelsPerFrameListConstIter
NTV2AudioChannelsPerFrameList::const_iterator NTV2AudioChannelsPerFrameListConstIter
Definition: ntv2devicescanner.h:22
NTV2AudioPhysicalFormat::boardNumber
ULWord boardNumber
Definition: ntv2devicescanner.h:169
NTV2AudioBitsPerSampleList
std::vector< AudioBitsPerSampleEnum > NTV2AudioBitsPerSampleList
Definition: ntv2devicescanner.h:29
NTV2AudioSampleRateList
std::vector< AudioSampleRateEnum > NTV2AudioSampleRateList
Definition: ntv2devicescanner.h:17
NTV2AudioPhysicalFormat::sampleRate
AudioSampleRateEnum sampleRate
Definition: ntv2devicescanner.h:170
NTV2DeviceInfo::numVidOutputs
UWord numVidOutputs
Total number of video outputs – analog, digital, whatever.
Definition: ntv2devicescanner.h:45
NTV2DeviceInfo::deviceIdentifier
std::string deviceIdentifier
Device name as seen in Control Panel, Watcher, Cables, etc.
Definition: ntv2devicescanner.h:43
NTV2DeviceInfo::audioInSourceList
NTV2AudioSourceList audioInSourceList
My supported audio input sources (AES, ADAT, etc.)
Definition: ntv2devicescanner.h:86
NTV2DeviceInfo::has4KSupport
bool has4KSupport
Supports 4K formats?
Definition: ntv2devicescanner.h:69
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2DeviceInfo::numOutputConverters
UWord numOutputConverters
Total number of output converters.
Definition: ntv2devicescanner.h:51
ntv2card.h
Declares the CNTV2Card class.
NTV2AudioSourceListIter
NTV2AudioSourceList::iterator NTV2AudioSourceListIter
Definition: ntv2devicescanner.h:27
CNTV2DeviceScanner::~CNTV2DeviceScanner
virtual ~CNTV2DeviceScanner()
Definition: ntv2devicescanner.h:384
UWord
uint16_t UWord
Definition: ajatypes.h:244
AudioChannelsPerFrameEnum
AudioChannelsPerFrameEnum
Definition: ntv2audiodefines.h:37
NTV2AudioPhysicalFormat
Definition: ntv2devicescanner.h:168
NTV2DeviceInfo::numDMAEngines
UWord numDMAEngines
Total number of DMA engines.
Definition: ntv2devicescanner.h:97
AudioSourceEnum
AudioSourceEnum
Definition: ntv2audiodefines.h:64
CNTV2Card
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:262
NTV2DeviceInfo::rgbAlphaOutputSupport
bool rgbAlphaOutputSupport
Supports RGB alpha channel?
Definition: ntv2devicescanner.h:65
NTV2DeviceInfo::numAESAudioOutputChannels
UWord numAESAudioOutputChannels
Total number of AES audio output channels.
Definition: ntv2devicescanner.h:94
NTV2AudioPhysicalFormatListIter
NTV2AudioPhysicalFormatList::iterator NTV2AudioPhysicalFormatListIter
Definition: ntv2devicescanner.h:192
NTV2DeviceInfo::has2KSupport
bool has2KSupport
Supports 2K formats?
Definition: ntv2devicescanner.h:68
NTV2DeviceInfo::procAmpSupport
bool procAmpSupport
Definition: ntv2devicescanner.h:67
NTV2DeviceInfo::proResSupport
bool proResSupport
Supports ProRes?
Definition: ntv2devicescanner.h:72
NTV2DeviceInfo::stereoOutSupport
bool stereoOutSupport
Supports stereo output?
Definition: ntv2devicescanner.h:80
NTV2DeviceInfo::qrezSupport
bool qrezSupport
Definition: ntv2devicescanner.h:58
NTV2DeviceInfo::numUpConverters
UWord numUpConverters
Total number of up-converters.
Definition: ntv2devicescanner.h:52
NTV2DeviceInfo::numEmbeddedAudioInputChannels
UWord numEmbeddedAudioInputChannels
Total number of embedded (SDI) audio input channels.
Definition: ntv2devicescanner.h:91
NTV2AudioPhysicalFormat::numChannels
AudioChannelsPerFrameEnum numChannels
Definition: ntv2devicescanner.h:171
NTV2DeviceInfo::programmableCSCSupport
bool programmableCSCSupport
Programmable color space converter?
Definition: ntv2devicescanner.h:64
NTV2DeviceInfoListConstIter
NTV2DeviceInfoList::const_iterator NTV2DeviceInfoListConstIter
Definition: ntv2devicescanner.h:155
NTV2DeviceInfo::multiFormat
bool multiFormat
Supports multiple video formats?
Definition: ntv2devicescanner.h:82
NTV2AudioSampleRateListIter
NTV2AudioSampleRateList::iterator NTV2AudioSampleRateListIter
Definition: ntv2devicescanner.h:19
NTV2DeviceInfo::isoConvertSupport
bool isoConvertSupport
Definition: ntv2devicescanner.h:55
NTV2DeviceInfo::deviceIndex
ULWord deviceIndex
Device index number – this will be phased out someday.
Definition: ntv2devicescanner.h:40
NTV2DeviceInfo::numAnalogAudioOutputChannels
UWord numAnalogAudioOutputChannels
Total number of analog audio output channels.
Definition: ntv2devicescanner.h:93
NTV2DeviceInfo::numHDMIAudioInputChannels
UWord numHDMIAudioInputChannels
Total number of HDMI audio input channels.
Definition: ntv2devicescanner.h:92
NTV2DeviceInfo::numVidInputs
UWord numVidInputs
Total number of video inputs – analog, digital, whatever.
Definition: ntv2devicescanner.h:44
NTV2DeviceInfo::has8KSupport
bool has8KSupport
Supports 8K formats?
Definition: ntv2devicescanner.h:70
NTV2AudioSourceList
std::vector< AudioSourceEnum > NTV2AudioSourceList
Definition: ntv2devicescanner.h:25
NTV2DeviceInfo
Definition: ntv2devicescanner.h:37
NTV2AudioPhysicalFormatListConstIter
NTV2AudioPhysicalFormatList::const_iterator NTV2AudioPhysicalFormatListConstIter
Definition: ntv2devicescanner.h:191
CNTV2DeviceScanner::GetNumDevices
virtual size_t GetNumDevices(void) const
Returns the number of AJA devices found on the local host.
Definition: ntv2devicescanner.h:346
NTV2DeviceInfo::audioSampleRateList
NTV2AudioSampleRateList audioSampleRateList
My supported audio sample rates.
Definition: ntv2devicescanner.h:83
NTV2AudioBitsPerSampleListIter
NTV2AudioBitsPerSampleList::iterator NTV2AudioBitsPerSampleListIter
Definition: ntv2devicescanner.h:31
AJAExport
#define AJAExport
Definition: export.h:33
NTV2DeviceInfo::pingLED
ULWord pingLED
Definition: ntv2devicescanner.h:99
AudioSampleRateEnum
AudioSampleRateEnum
Definition: ntv2audiodefines.h:56
NTV2DeviceInfo::operator==
bool operator==(const NTV2DeviceInfo &rhs) const
Definition: ntv2devicescanner.cpp:368
NTV2DeviceInfo::pciSlot
ULWord pciSlot
PCI slot (if applicable and/or known)
Definition: ntv2devicescanner.h:41
NTV2AudioSampleRateListConstIter
NTV2AudioSampleRateList::const_iterator NTV2AudioSampleRateListConstIter
Definition: ntv2devicescanner.h:18
NTV2DeviceInfo::ltcOutSupport
bool ltcOutSupport
Supports LTC output?
Definition: ntv2devicescanner.h:78
NTV2AudioChannelsPerFrameListIter
NTV2AudioChannelsPerFrameList::iterator NTV2AudioChannelsPerFrameListIter
Definition: ntv2devicescanner.h:23
NTV2DeviceInfo::numInputConverters
UWord numInputConverters
Total number of input converters.
Definition: ntv2devicescanner.h:50
NTV2DeviceInfo::dvcproHDSupport
bool dvcproHDSupport
Definition: ntv2devicescanner.h:57
NTV2DeviceInfo::ipSupport
bool ipSupport
Supports IP IO?
Definition: ntv2devicescanner.h:75
NTV2DeviceInfo::colorCorrectionSupport
bool colorCorrectionSupport
Supports color correction?
Definition: ntv2devicescanner.h:63
NTV2DeviceInfo::sdi3GSupport
bool sdi3GSupport
Supports 3G?
Definition: ntv2devicescanner.h:73
NTV2DeviceInfo::breakoutBoxSupport
bool breakoutBoxSupport
Can support a breakout box?
Definition: ntv2devicescanner.h:66
NTV2DeviceInfo
struct NTV2DeviceInfo NTV2DeviceInfo
NTV2AudioPhysicalFormatList
std::vector< NTV2AudioPhysicalFormat > NTV2AudioPhysicalFormatList
I am an ordered list of NTV2AudioPhysicalFormat structs.
Definition: ntv2devicescanner.h:190
NTV2DeviceInfo::ltcInOnRefPort
bool ltcInOnRefPort
Supports LTC on reference input?
Definition: ntv2devicescanner.h:79
NTV2DeviceInfo::audioNumChannelsList
NTV2AudioChannelsPerFrameList audioNumChannelsList
My supported number of audio channels per frame.
Definition: ntv2devicescanner.h:84
NTV2AudioChannelsPerFrameList
std::vector< AudioChannelsPerFrameEnum > NTV2AudioChannelsPerFrameList
Definition: ntv2devicescanner.h:21
NTV2DeviceInfo::downConverterDelay
UWord downConverterDelay
Definition: ntv2devicescanner.h:54
NTV2DeviceInfo::stereoInSupport
bool stereoInSupport
Supports stereo input?
Definition: ntv2devicescanner.h:81
NTV2DeviceInfo::numAESAudioInputChannels
UWord numAESAudioInputChannels
Total number of AES audio input channels.
Definition: ntv2devicescanner.h:90
NTV2DeviceInfo::deviceID
NTV2DeviceID deviceID
Device ID/species (e.g., DEVICE_ID_KONA3G, DEVICE_ID_IOXT, etc.)
Definition: ntv2devicescanner.h:39
NTV2AudioBitsPerSampleListConstIter
NTV2AudioBitsPerSampleList::const_iterator NTV2AudioBitsPerSampleListConstIter
Definition: ntv2devicescanner.h:30
NTV2DeviceInfo::numAudioStreams
UWord numAudioStreams
Maximum number of independent audio streams.
Definition: ntv2devicescanner.h:88
NTV2DeviceInfo::dualLinkSupport
bool dualLinkSupport
Supports dual-link?
Definition: ntv2devicescanner.h:62
NTV2DeviceInfo::hdvSupport
bool hdvSupport
Definition: ntv2devicescanner.h:59
NTV2DeviceInfo::numEmbeddedAudioOutputChannels
UWord numEmbeddedAudioOutputChannels
Total number of embedded (SDI) audio output channels.
Definition: ntv2devicescanner.h:95