AJA NTV2 SDK  18.1.0.2145
NTV2 SDK 18.1.0.2145
ntv2publicinterface.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #include "ntv2publicinterface.h"
8 #include "ntv2devicefeatures.h"
9 #include "ntv2utils.h"
10 #include "ntv2endian.h"
11 #include "ajabase/system/memory.h"
12 #include "ajabase/system/debug.h"
13 #include "ajabase/common/common.h"
14 #include "ntv2registerexpert.h"
15 #include "ntv2nubtypes.h"
16 #include "ntv2version.h"
17 #include "ntv2debug.h"
18 #include <iomanip>
19 #include <locale> // For std::locale, std::numpunct, std::use_facet
20 #include <string.h> // For memset, et al.
21 #include <algorithm> // For set_difference
22 #include <iterator> // For std::inserter
23 #include "ntv2rp188.h"
24 #if !defined(MSWindows)
25  #include <unistd.h>
26 #endif
27 using namespace std;
28 
29 //#define NTV2BUFFER_NO_MEMCMP
30 
31 
33 
34 ostream & operator << (ostream & inOutStream, const NTV2StringList & inData)
35 {
36  for (NTV2StringListConstIter it(inData.begin()); it != inData.end(); )
37  {
38  inOutStream << *it;
39  if (++it != inData.end())
40  inOutStream << ", ";
41  }
42  return inOutStream;
43 }
44 
45 ostream & operator << (ostream & inOutStream, const NTV2StringSet & inData)
46 {
47  for (NTV2StringSetConstIter it(inData.begin()); it != inData.end(); )
48  {
49  inOutStream << *it;
50  if (++it != inData.end())
51  inOutStream << ", ";
52  }
53  return inOutStream;
54 }
55 
56 ostream & operator << (ostream & inOutStr, const NTV2AudioChannelPairs & inSet)
57 {
58  if (inSet.empty())
59  inOutStr << "(none)";
60  else
61  for (NTV2AudioChannelPairsConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
62  inOutStr << (iter != inSet.begin() ? ", " : "") << ::NTV2AudioChannelPairToString (*iter, true);
63  return inOutStr;
64 }
65 
66 ostream & operator << (ostream & inOutStr, const NTV2AudioChannelQuads & inSet)
67 {
68  for (NTV2AudioChannelQuadsConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
69  inOutStr << (iter != inSet.begin () ? ", " : "") << ::NTV2AudioChannelQuadToString (*iter, true);
70  return inOutStr;
71 }
72 
73 ostream & operator << (ostream & inOutStr, const NTV2AudioChannelOctets & inSet)
74 {
75  for (NTV2AudioChannelOctetsConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
76  inOutStr << (iter != inSet.begin () ? ", " : "") << ::NTV2AudioChannelOctetToString (*iter, true);
77  return inOutStr;
78 }
79 
80 ostream & operator << (ostream & inOutStr, const NTV2DoubleArray & inVector)
81 {
82  for (NTV2DoubleArrayConstIter iter (inVector.begin ()); iter != inVector.end (); ++iter)
83  inOutStr << *iter << endl;
84  return inOutStr;
85 }
86 
87 ostream & operator << (ostream & inOutStr, const NTV2DIDSet & inDIDs)
88 {
89  for (NTV2DIDSetConstIter it (inDIDs.begin()); it != inDIDs.end(); )
90  {
91  inOutStr << xHEX0N(uint16_t(*it),2);
92  if (++it != inDIDs.end())
93  inOutStr << ", ";
94  }
95  return inOutStr;
96 }
97 
98 ostream & operator << (ostream & inOutStream, const UWordSequence & inData)
99 {
100  inOutStream << DEC(inData.size()) << " UWords: ";
101  for (UWordSequenceConstIter iter(inData.begin()); iter != inData.end(); )
102  {
103  inOutStream << HEX0N(*iter,4);
104  if (++iter != inData.end())
105  inOutStream << " ";
106  }
107  return inOutStream;
108 }
109 
110 ostream & operator << (ostream & inOutStream, const ULWordSequence & inData)
111 {
112  inOutStream << DEC(inData.size()) << " ULWords: ";
113  for (ULWordSequenceConstIter iter(inData.begin()); iter != inData.end(); )
114  {
115  inOutStream << HEX0N(*iter,8);
116  if (++iter != inData.end())
117  inOutStream << " ";
118  }
119  return inOutStream;
120 }
121 
122 ostream & operator << (ostream & inOutStream, const ULWord64Sequence & inData)
123 {
124  inOutStream << DEC(inData.size()) << " ULWord64s: ";
125  for (ULWord64SequenceConstIter iter(inData.begin()); iter != inData.end(); )
126  {
127  inOutStream << HEX0N(*iter,16);
128  if (++iter != inData.end())
129  inOutStream << " ";
130  }
131  return inOutStream;
132 }
133 
134 
136 {
137  Clear ();
138 }
139 
140 
142 {
143  mCRCTallyA = 0;
144  mCRCTallyB = 0;
145  mUnlockTally = 0;
146  mFrameRefClockCount = 0;
147  mGlobalClockCount = 0;
148  mFrameTRSError = false;
149  mLocked = false;
150  mVPIDValidA = false;
151  mVPIDValidB = false;
152 }
153 
154 
155 ostream & NTV2SDIInputStatus::Print (ostream & inOutStream) const
156 {
157  inOutStream << "[CRCA=" << DEC(mCRCTallyA)
158  << " CRCB=" << DEC(mCRCTallyB)
159  << " unlk=" << xHEX0N(mUnlockTally,8)
160  << " frmRefClkCnt=" << xHEX0N(mFrameRefClockCount,16)
161  << " globalClkCnt=" << xHEX0N(mGlobalClockCount,16)
162  << " frmTRS=" << YesNo(mFrameTRSError)
163  << " locked=" << YesNo(mLocked)
164  << " VPIDA=" << YesNo(mVPIDValidA)
165  << " VPIDB=" << YesNo(mVPIDValidB)
166  << "]";
167  return inOutStream;
168 }
169 
170 
172 {
173  mEnabled = false;
174  mPixel420 = false;
175  mColorSpace = NTV2_INVALID_HDMI_COLORSPACE;
176  mRGBRange = NTV2_INVALID_HDMI_RANGE;
177  mProtocol = NTV2_INVALID_HDMI_PROTOCOL;
178  mVideoStandard = NTV2_STANDARD_INVALID;
179  mVideoRate = NTV2_FRAMERATE_UNKNOWN;
180  mVideoBitDepth = NTV2_INVALID_HDMIBitDepth;
181  mAudioFormat = NTV2_AUDIO_FORMAT_INVALID;
182  mAudioRate = NTV2_AUDIO_RATE_INVALID;
183  mAudioChannels = NTV2_INVALID_HDMI_AUDIO_CHANNELS;
184 }
185 
187 {
188  Clear();
190  if (mVideoRate == NTV2_FRAMERATE_UNKNOWN)
191  return true; // Not enabled -- success
192  mEnabled = true;
193  mPixel420 = ((inData & kVRegMaskHDMOutPixel420) >> kVRegShiftHDMOutPixel420) == 1;
198  mVideoBitDepth = NTV2HDMIBitDepth((inData & kVRegMaskHDMOutBitDepth) >> kVRegShiftHDMOutBitDepth);
202  return true;
203 }
204 
205 ostream & NTV2HDMIOutputStatus::Print (ostream & inOutStream) const
206 {
207  inOutStream << "Enabled: " << YesNo(mEnabled);
208  if (mEnabled)
209  inOutStream << endl
210  << "Is 4:2:0: " << YesNo(mPixel420) << endl
211  << "Color Space: " << ::NTV2HDMIColorSpaceToString(mColorSpace,true) << endl;
212  if (mColorSpace == NTV2_HDMIColorSpaceRGB)
213  inOutStream << "RGB Range: " << ::NTV2HDMIRangeToString(mRGBRange,true) << endl;
214  inOutStream << "Protocol: " << ::NTV2HDMIProtocolToString(mProtocol,true) << endl
215  << "Video Standard: " << ::NTV2StandardToString(mVideoStandard,true) << endl
216  << "Frame Rate: " << ::NTV2FrameRateToString(mVideoRate,true) << endl
217  << "Bit Depth: " << ::NTV2HDMIBitDepthToString(mVideoBitDepth,true) << endl
218  << "Audio Format: " << ::NTV2AudioFormatToString(mAudioFormat,true) << endl
219  << "Audio Rate: " << ::NTV2AudioRateToString(mAudioRate,true) << endl
220  << "Audio Channels: " << ::NTV2HDMIAudioChannelsToString(mAudioChannels,true);
221  return inOutStream;
222 }
223 
224 
226  : mode (AUTOCIRCVIDPROCMODE_MIX),
227  foregroundVideoCrosspoint (NTV2CROSSPOINT_CHANNEL1),
228  backgroundVideoCrosspoint (NTV2CROSSPOINT_CHANNEL1),
229  foregroundKeyCrosspoint (NTV2CROSSPOINT_CHANNEL1),
230  backgroundKeyCrosspoint (NTV2CROSSPOINT_CHANNEL1),
231  transitionCoefficient (0),
232  transitionSoftness (0)
233 {
234 }
235 
236 
238  : eCommand (inCommand),
239  channelSpec (inCrosspoint),
240  lVal1 (0),
241  lVal2 (0),
242  lVal3 (0),
243  lVal4 (0),
244  lVal5 (0),
245  lVal6 (0),
246  bVal1 (false),
247  bVal2 (false),
248  bVal3 (false),
249  bVal4 (false),
250  bVal5 (false),
251  bVal6 (false),
252  bVal7 (false),
253  bVal8 (false),
254  pvVal1 (AJA_NULL),
255  pvVal2 (AJA_NULL),
256  pvVal3 (AJA_NULL),
257  pvVal4 (AJA_NULL)
258 {
259 }
260 
261 ostream & AUTOCIRCULATE_DATA::Print (ostream & oss) const
262 {
263  static const string sCmds [] = {"ACInit","ACStart","ACStop","ACPause","GetAC","ACFrmStmp",
264  "ACFlush","ACPreRoll","ACXfer","ACAbort","ACStartAt",
265  "ACXfer1","ACXfer2","ACFrmStmp2","ACTask","ACSetActFrm"};
266  if (size_t(eCommand) < sizeof(sCmds))
267  { oss << sCmds[eCommand];
268  switch (eCommand)
269  {
270  case eInitAutoCirc:
271  oss << " " << ::NTV2CrosspointToString(channelSpec);
272  oss << " frms " << DEC(lVal1) << "-" << DEC(lVal2);
273  if (lVal4 > 1) oss << " +" << DEC(lVal4) << " chls";
274  if (lVal6 & AUTOCIRCULATE_WITH_FIELDS) oss << " +FieldMode";
275  if (lVal6 & AUTOCIRCULATE_WITH_HDMIAUX) oss << " +HDMIAux";
276  if (bVal2) oss << " +RP188";
277  if (bVal3) oss << " +FBFChg";
278  if (bVal4) oss << " +FBOChg";
279  if (bVal5) oss << " +ColCorr";
280  if (bVal6) oss << " +VidProc";
281  if (bVal7) oss << " +Anc";
282  if (bVal8) oss << " +LTC";
283  oss << " " << ::NTV2AudioSystemToString(NTV2AudioSystem(lVal3 & 0xF), true);
284  if (!bVal1 && ((lVal3 & 0xF) == NTV2_MAX_NUM_AudioSystemEnums)) oss << " +AudCtrl";
285  if (lVal3 & NTV2_AUDIOSYSTEM_Plus1) oss << " +MLAud1";
286  if (lVal3 & NTV2_AUDIOSYSTEM_Plus2) oss << " +MLAud2";
287  if (lVal3 & NTV2_AUDIOSYSTEM_Plus3) oss << " +MLAud3";
288  break;
289  case eStartAutoCirc:
290  break;
292  if (lVal1 || lVal2)
293  oss << " at " << xHEX0N((uint64_t(lVal1) << 32) | uint64_t(lVal2),16);
294  break;
295  case eStopAutoCirc:
296  oss << " " << ::NTV2CrosspointToString(channelSpec);
297  break;
298  case eAbortAutoCirc:
299  oss << " " << ::NTV2CrosspointToString(channelSpec);
300  break;
301  case ePauseAutoCirc:
302  oss << " " << ::NTV2CrosspointToString(channelSpec);
303  if (!bVal1 && lVal6) oss << " at frame " << DEC(lVal6);
304  if (bVal1) oss << " +resume";
305  if (bVal1 && bVal2) oss << " +clearDropCount";
306  break;
307  case eFlushAutoCirculate:
308  oss << " " << ::NTV2CrosspointToString(channelSpec);
309  if (bVal1) oss << " +clearDropCount";
310  break;
312  oss << " " << ::NTV2CrosspointToString(channelSpec) << " " << DEC(ULWord(lVal1)) << " frame(s)";
313  break;
314  case eGetAutoCirc:
315  oss << " " << ::NTV2CrosspointToString(channelSpec);
316  break;
317  case eSetActiveFrame:
318  case eGetFrameStamp:
319  oss << " " << ::NTV2CrosspointToString(channelSpec) << " frm " << DEC(ULWord(lVal1));
320  break;
321  default:
322  break;
323  }
324  }
325  return oss;
326 }
327 
328 
329 NTV2_HEADER::NTV2_HEADER (const ULWord inStructureType, const ULWord inStructSizeInBytes)
330  : fHeaderTag (NTV2_HEADER_TAG),
331  fType (inStructureType),
332  fHeaderVersion (NTV2_CURRENT_HEADER_VERSION),
333  fVersion (AUTOCIRCULATE_STRUCT_VERSION),
334  fSizeInBytes (inStructSizeInBytes),
335  fPointerSize (sizeof(int*)),
336  fOperation (0),
337  fResultStatus (0)
338 {
339 }
340 
341 
342 ostream & operator << (ostream & inOutStream, const NTV2_HEADER & inObj)
343 {
344  return inObj.Print (inOutStream);
345 }
346 
347 
348 ostream & NTV2_HEADER::Print (ostream & inOutStream) const
349 {
350  inOutStream << "[";
351  if (NTV2_IS_VALID_HEADER_TAG (fHeaderTag))
352  inOutStream << NTV2_4CC_AS_STRING (fHeaderTag);
353  else
354  inOutStream << "BAD-" << HEX0N(fHeaderTag,8);
355  if (NTV2_IS_VALID_STRUCT_TYPE (fType))
356  inOutStream << NTV2_4CC_AS_STRING (fType);
357  else
358  inOutStream << "|BAD-" << HEX0N(fType,8);
359  inOutStream << " v" << fHeaderVersion << " vers=" << fVersion << " sz=" << fSizeInBytes;
360  return inOutStream << "]";
361 }
362 
364 {
365  const char * pU32 (reinterpret_cast<const char *>(&in4CC));
366  ostringstream result;
367  size_t badTally(0);
368  result << "'";
369  for (size_t charPos(0); charPos < 4; charPos++)
370  {
371  #if AJATargetBigEndian
372  const char ch(pU32[charPos]);
373  #else // little-endian:
374  const char ch(pU32[3-charPos]);
375  #endif
376  if (ch < ' ' || ch > 126)
377  {result << '.'; badTally++;} // not printable
378  else
379  result << ch;
380  }
381  result << "'";
382  if (badTally)
383  result << " (" << xHEX0N(in4CC,8) << ")";
384  return result.str();
385 }
386 
387 
388 ostream & operator << (ostream & inOutStream, const NTV2_TRAILER & inObj)
389 {
390  inOutStream << "[";
392  inOutStream << NTV2_4CC_AS_STRING(inObj.fTrailerTag);
393  else
394  inOutStream << "BAD-" << HEX0N(inObj.fTrailerTag,8);
395  return inOutStream << " rawVers=" << xHEX0N(inObj.fTrailerVersion,8) << " clientSDK="
399  << "." << DEC(NTV2SDKVersionDecode_Build(inObj.fTrailerVersion)) << "]";
400 }
401 
402 
403 ostream & operator << (ostream & inOutStream, const NTV2Buffer & inObj)
404 {
405  return inObj.Print (inOutStream);
406 }
407 
408 
409 ostream & NTV2Buffer::Print (ostream & inOutStream) const
410 {
411  inOutStream << (IsAllocatedBySDK() ? "0X" : "0x") << HEX0N(GetRawHostPointer(),16) << "/" << DECN(GetByteCount(),10);
412  return inOutStream;
413 }
414 
415 
416 string NTV2Buffer::AsString (UWord inDumpMaxBytes) const
417 {
418  ostringstream oss;
419  oss << xHEX0N(GetRawHostPointer(),16) << ":" << DEC(GetByteCount()) << " bytes";
420  if (inDumpMaxBytes && GetHostPointer())
421  {
422  oss << ":";
423  if (inDumpMaxBytes > 256)
424  inDumpMaxBytes = 256;
425  if (ULWord(inDumpMaxBytes) > GetByteCount())
426  inDumpMaxBytes = UWord(GetByteCount());
427  const UByte * pBytes (reinterpret_cast<const UByte *>(GetHostPointer()));
428  for (UWord ndx(0); ndx < inDumpMaxBytes; ndx++)
429  oss << HEX0N(uint16_t(pBytes[ndx]),2);
430  }
431  return oss.str();
432 }
433 
434 string NTV2Buffer::AsCode (const size_t inBytesPerWord, const std::string & inVarName, const bool inUseSTL, const bool inByteSwap) const
435 {
436  ostringstream oss;
437  if (inBytesPerWord != 1 && inBytesPerWord != 2 && inBytesPerWord != 4 && inBytesPerWord != 8) return string();
438  NTV2Buffer tmp;
439  if (inBytesPerWord > 1)
440  { // Use a copy for U16s, U32s, or U64s...
441  tmp = *this;
442  if (!tmp)
443  return string();
444  }
445  const string cType (inBytesPerWord == 1 ? "uint8_t" : (inBytesPerWord == 2 ? "uint16_t" : (inBytesPerWord == 4 ? "uint32_t" : "uint64_t")));
446  const size_t numWords (GetByteCount() / inBytesPerWord);
447  const string vecType = "std::vector<" + cType + ">";
448  const string varName (inVarName.empty() ? (inUseSTL ? "tmpVector" : "tmpArray") : inVarName);
449  oss << "const " << (inUseSTL ? vecType : cType) << " " << varName << (inUseSTL ? "" : "[]") << " = {" << endl;
450  if (inByteSwap && inBytesPerWord > 1)
451  switch (inBytesPerWord)
452  {
453  case 2: tmp.ByteSwap16(); break;
454  case 4: tmp.ByteSwap32(); break;
455  case 8: tmp.ByteSwap64(); break;
456  }
457  for (size_t ndx(0); ndx < numWords; )
458  {
459  switch (inBytesPerWord)
460  {
461  case 1: oss << xHEX0N(UWord(U8(int(ndx))),2); break;
462  case 2: oss << xHEX0N(tmp.U16(int(ndx)),4); break;
463  case 4: oss << xHEX0N(tmp.U32(int(ndx)),8); break;
464  case 8: oss << xHEX0N(tmp.U64(int(ndx)),16); break;
465  }
466  if (++ndx < numWords)
467  oss << ",";
468  if (ndx % 128 == 0)
469  oss << endl;
470  }
471  oss << "};" << endl;
472  return oss.str();
473 }
474 
475 bool NTV2Buffer::toHexString (std::string & outStr, const size_t inLineBreakInterval) const
476 {
477  outStr.clear();
478  ostringstream oss;
479  if (GetHostPointer() && GetByteCount())
480  for (int ndx(0); ndx < int(GetByteCount()); )
481  {
482  oss << HEX0N(uint16_t(U8(ndx++)),2);
483  if (inLineBreakInterval && ndx < int(GetByteCount()) && ((size_t(ndx) % inLineBreakInterval) == 0))
484  oss << endl;
485  }
486  outStr = oss.str();
487  return !outStr.empty();
488 }
489 
490 static string print_address_offset (const size_t inRadix, const ULWord64 inOffset)
491 {
492  const streamsize maxAddrWidth (sizeof(ULWord64) * 2);
493  ostringstream oss;
494  if (inRadix == 8)
495  oss << OCT0N(inOffset,maxAddrWidth) << ": ";
496  else if (inRadix == 10)
497  oss << DEC0N(inOffset,maxAddrWidth) << ": ";
498  else
499  oss << xHEX0N(inOffset,maxAddrWidth) << ": ";
500  return oss.str();
501 }
502 
503 ostream & NTV2Buffer::Dump (ostream & inOStream,
504  const size_t inStartOffset,
505  const size_t inByteCount,
506  const size_t inRadix,
507  const size_t inBytesPerGroup,
508  const size_t inGroupsPerRow,
509  const size_t inAddressRadix,
510  const bool inShowAscii,
511  const size_t inAddrOffset) const
512 {
513  if (IsNULL())
514  return inOStream;
515  if (inRadix != 8 && inRadix != 10 && inRadix != 16 && inRadix != 2)
516  return inOStream;
517  if (inAddressRadix != 0 && inAddressRadix != 8 && inAddressRadix != 10 && inAddressRadix != 16)
518  return inOStream;
519  if (inBytesPerGroup == 0) // || inGroupsPerRow == 0)
520  return inOStream;
521 
522  {
523  const void * pInStartAddress (GetHostAddress(ULWord(inStartOffset)));
524  size_t bytesRemaining (inByteCount ? inByteCount : GetByteCount());
525  size_t bytesInThisGroup (0);
526  size_t groupsInThisRow (0);
527  const unsigned maxByteWidth (inRadix == 8 ? 4 : (inRadix == 10 ? 3 : (inRadix == 2 ? 8 : 2)));
528  const UByte * pBuffer (reinterpret_cast <const UByte *> (pInStartAddress));
529  const size_t asciiBufferSize (inShowAscii && inGroupsPerRow ? (inBytesPerGroup * inGroupsPerRow + 1) * sizeof (UByte) : 0); // Size in bytes, not chars
530 
531  if (!pInStartAddress)
532  return inOStream;
533 
534  UByte * pAsciiBuffer (asciiBufferSize ? new UByte[asciiBufferSize / sizeof(UByte)] : AJA_NULL);
535  if (pAsciiBuffer)
536  ::memset (pAsciiBuffer, 0, asciiBufferSize);
537 
538  if (inGroupsPerRow && inAddressRadix)
539  inOStream << print_address_offset (inAddressRadix, ULWord64(pBuffer) - ULWord64(pInStartAddress) + ULWord64(inAddrOffset));
540  while (bytesRemaining)
541  {
542  if (inRadix == 2)
543  inOStream << BIN08(*pBuffer);
544  else if (inRadix == 8)
545  inOStream << oOCT(uint16_t(*pBuffer));
546  else if (inRadix == 10)
547  inOStream << DEC0N(uint16_t(*pBuffer),maxByteWidth);
548  else if (inRadix == 16)
549  inOStream << HEX0N(uint16_t(*pBuffer),2);
550 
551  if (pAsciiBuffer)
552  pAsciiBuffer[groupsInThisRow * inBytesPerGroup + bytesInThisGroup] = isprint(*pBuffer) ? *pBuffer : '.';
553  pBuffer++;
554  bytesRemaining--;
555 
556  bytesInThisGroup++;
557  if (bytesInThisGroup >= inBytesPerGroup)
558  {
559  groupsInThisRow++;
560  if (inGroupsPerRow && groupsInThisRow >= inGroupsPerRow)
561  {
562  if (pAsciiBuffer)
563  {
564  inOStream << " " << pAsciiBuffer;
565  ::memset (pAsciiBuffer, 0, asciiBufferSize);
566  }
567  inOStream << endl;
568  if (inAddressRadix && bytesRemaining)
569  inOStream << print_address_offset (inAddressRadix, reinterpret_cast <ULWord64> (pBuffer) - reinterpret_cast <ULWord64> (pInStartAddress) + ULWord64 (inAddrOffset));
570  groupsInThisRow = 0;
571  } // if time for new row
572  else
573  inOStream << " ";
574  bytesInThisGroup = 0;
575  } // if time for new group
576  } // loop til no bytes remaining
577 
578  if (bytesInThisGroup && bytesInThisGroup < inBytesPerGroup && pAsciiBuffer)
579  {
580  groupsInThisRow++;
581  inOStream << string ((inBytesPerGroup - bytesInThisGroup) * maxByteWidth + 1, ' ');
582  }
583 
584  if (groupsInThisRow)
585  {
586  if (groupsInThisRow < inGroupsPerRow && pAsciiBuffer)
587  inOStream << string (((inGroupsPerRow - groupsInThisRow) * inBytesPerGroup * maxByteWidth + (inGroupsPerRow - groupsInThisRow)), ' ');
588  if (pAsciiBuffer)
589  inOStream << pAsciiBuffer;
590  inOStream << endl;
591  }
592  else if (bytesInThisGroup && bytesInThisGroup < inBytesPerGroup)
593  inOStream << endl;
594 
595  if (pAsciiBuffer)
596  delete [] pAsciiBuffer;
597  } // else radix is 16, 10, 8 or 2
598 
599  return inOStream;
600 } // Dump
601 
602 string & NTV2Buffer::Dump ( string & inOutputString,
603  const size_t inStartOffset,
604  const size_t inByteCount,
605  const size_t inRadix,
606  const size_t inBytesPerGroup,
607  const size_t inGroupsPerRow,
608  const size_t inAddressRadix,
609  const bool inShowAscii,
610  const size_t inAddrOffset) const
611 {
612  ostringstream oss;
613  Dump (oss, inStartOffset, inByteCount, inRadix, inBytesPerGroup, inGroupsPerRow, inAddressRadix, inShowAscii, inAddrOffset);
614  inOutputString = oss.str();
615  return inOutputString;
616 }
617 
618 NTV2Buffer & NTV2Buffer::Segment (NTV2Buffer & outPtr, const ULWord inByteOffset, const ULWord inByteCount) const
619 {
620  outPtr.Set(AJA_NULL, 0); // Make invalid
621  if (inByteOffset >= GetByteCount())
622  return outPtr; // Offset past end
623  if (inByteOffset+inByteCount > GetByteCount())
624  return outPtr; // Segment too long
625  outPtr.Set(GetHostAddress(inByteOffset), inByteCount);
626  return outPtr;
627 }
628 
629 
630 bool NTV2Buffer::GetU64s (ULWord64Sequence & outUint64s, const size_t inU64Offset, const size_t inMaxSize, const bool inByteSwap) const
631 {
632  outUint64s.clear();
633  if (IsNULL())
634  return false;
635 
636  size_t maxSize (size_t(GetByteCount()) / sizeof(uint64_t));
637  if (maxSize < inU64Offset)
638  return false; // Past end
639  maxSize -= inU64Offset; // Remove starting offset
640 
641  const uint64_t * pU64 (reinterpret_cast <const uint64_t *> (GetHostAddress(ULWord(inU64Offset * sizeof(uint64_t)))));
642  if (!pU64)
643  return false; // Past end
644 
645  if (inMaxSize && inMaxSize < maxSize)
646  maxSize = inMaxSize;
647 
648  try
649  {
650  outUint64s.reserve(maxSize);
651  for (size_t ndx(0); ndx < maxSize; ndx++)
652  {
653  const uint64_t u64 (*pU64++);
654  outUint64s.push_back(inByteSwap ? NTV2EndianSwap64(u64) : u64);
655  }
656  }
657  catch (...)
658  {
659  outUint64s.clear();
660  outUint64s.reserve(0);
661  return false;
662  }
663  return true;
664 }
665 
666 
667 bool NTV2Buffer::GetU32s (ULWordSequence & outUint32s, const size_t inU32Offset, const size_t inMaxSize, const bool inByteSwap) const
668 {
669  outUint32s.clear();
670  if (IsNULL())
671  return false;
672 
673  size_t maxNumU32s (size_t(GetByteCount()) / sizeof(uint32_t));
674  if (maxNumU32s < inU32Offset)
675  return false; // Past end
676  maxNumU32s -= inU32Offset; // Remove starting offset
677 
678  const uint32_t * pU32 (reinterpret_cast<const uint32_t*>(GetHostAddress(ULWord(inU32Offset * sizeof(uint32_t)))));
679  if (!pU32)
680  return false; // Past end
681 
682  if (inMaxSize && inMaxSize < maxNumU32s)
683  maxNumU32s = inMaxSize;
684 
685  try
686  {
687  outUint32s.reserve(maxNumU32s);
688  for (size_t ndx(0); ndx < maxNumU32s; ndx++)
689  {
690  const uint32_t u32 (*pU32++);
691  outUint32s.push_back(inByteSwap ? NTV2EndianSwap32(u32) : u32);
692  }
693  }
694  catch (...)
695  {
696  outUint32s.clear();
697  outUint32s.reserve(0);
698  return false;
699  }
700  return true;
701 }
702 
703 
704 bool NTV2Buffer::GetU16s (UWordSequence & outUint16s, const size_t inU16Offset, const size_t inMaxSize, const bool inByteSwap) const
705 {
706  outUint16s.clear();
707  if (IsNULL())
708  return false;
709 
710  size_t maxSize (size_t(GetByteCount()) / sizeof(uint16_t));
711  if (maxSize < inU16Offset)
712  return false; // Past end
713  maxSize -= inU16Offset; // Remove starting offset
714 
715  const uint16_t * pU16 (reinterpret_cast <const uint16_t *> (GetHostAddress(ULWord(inU16Offset * sizeof(uint16_t)))));
716  if (!pU16)
717  return false; // Past end
718 
719  if (inMaxSize && inMaxSize < maxSize)
720  maxSize = inMaxSize;
721 
722  try
723  {
724  outUint16s.reserve(maxSize);
725  for (size_t ndx(0); ndx < maxSize; ndx++)
726  {
727  const uint16_t u16 (*pU16++);
728  outUint16s.push_back(inByteSwap ? NTV2EndianSwap16(u16) : u16);
729  }
730  }
731  catch (...)
732  {
733  outUint16s.clear();
734  outUint16s.reserve(0);
735  return false;
736  }
737  return true;
738 }
739 
740 
741 bool NTV2Buffer::GetU8s (UByteSequence & outUint8s, const size_t inU8Offset, const size_t inMaxSize) const
742 {
743  outUint8s.clear();
744  if (IsNULL())
745  return false;
746 
747  size_t maxSize (GetByteCount());
748  if (maxSize < inU8Offset)
749  return false; // Past end
750  maxSize -= inU8Offset; // Remove starting offset
751 
752  const uint8_t * pU8 (reinterpret_cast <const uint8_t *> (GetHostAddress(ULWord(inU8Offset))));
753  if (!pU8)
754  return false; // Past end
755 
756  if (inMaxSize && inMaxSize < maxSize)
757  maxSize = inMaxSize;
758 
759  try
760  {
761  outUint8s.reserve(maxSize);
762  for (size_t ndx(0); ndx < maxSize; ndx++)
763  outUint8s.push_back(*pU8++);
764  }
765  catch (...)
766  {
767  outUint8s.clear();
768  outUint8s.reserve(0);
769  return false;
770  }
771  return true;
772 }
773 
775 {
776  const uint8_t * pU8 (reinterpret_cast<const uint8_t*> (GetHostPointer()));
777  if (!pU8)
778  return false; // Past end
779  const size_t maxSize (GetByteCount());
780  try
781  {
782  outU8s.reserve(outU8s.size() + maxSize);
783  outU8s.insert(outU8s.end(),pU8, pU8 + maxSize);
784  }
785  catch (...)
786  {
787  return false;
788  }
789  return true;
790 }
791 
792 
793 bool NTV2Buffer::GetString (std::string & outString, const size_t inU8Offset, const size_t inMaxSize) const
794 {
795  outString.clear();
796  if (IsNULL())
797  return false;
798 
799  size_t maxSize(GetByteCount());
800  if (maxSize < inU8Offset)
801  return false; // Past end
802  maxSize -= inU8Offset; // Remove starting offset
803 
804  const uint8_t * pU8 (reinterpret_cast <const uint8_t *> (GetHostAddress(ULWord(inU8Offset))));
805  if (!pU8)
806  return false; // Past end
807 
808  if (inMaxSize && inMaxSize < maxSize)
809  maxSize = inMaxSize;
810 
811  try
812  {
813  outString.reserve(maxSize);
814  for (size_t ndx(0); ndx < maxSize; ndx++)
815  {
816  const char c = *pU8++;
817  if (c)
818  outString += c;
819  else
820  break;
821  }
822  }
823  catch (...)
824  {
825  outString.clear();
826  outString.reserve(0);
827  return false;
828  }
829  return true;
830 }
831 
832 
833 bool NTV2Buffer::PutU64s (const ULWord64Sequence & inU64s, const size_t inU64Offset, const bool inByteSwap)
834 {
835  if (IsNULL())
836  return false; // No buffer or space
837  if (inU64s.empty())
838  return true; // Nothing to copy
839 
840  size_t maxU64s (GetByteCount() / sizeof(uint64_t));
841  uint64_t * pU64 (reinterpret_cast<uint64_t*>(GetHostAddress(ULWord(inU64Offset * sizeof(uint64_t)))));
842  if (!pU64)
843  return false; // Start offset is past end
844  if (maxU64s > inU64Offset)
845  maxU64s -= inU64Offset; // Don't go past end
846  if (maxU64s > inU64s.size())
847  maxU64s = inU64s.size(); // Truncate incoming vector to not go past my end
848  if (inU64s.size() > maxU64s)
849  return false; // Will write past end
850 
851  for (unsigned ndx(0); ndx < maxU64s; ndx++)
852 #if defined(_DEBUG)
853  *pU64++ = inByteSwap ? NTV2EndianSwap64(inU64s.at(ndx)) : inU64s.at(ndx);
854 #else
855  *pU64++ = inByteSwap ? NTV2EndianSwap64(inU64s[ndx]) : inU64s[ndx];
856 #endif
857  return true;
858 }
859 
860 
861 bool NTV2Buffer::PutU32s (const ULWordSequence & inU32s, const size_t inU32Offset, const bool inByteSwap)
862 {
863  if (IsNULL())
864  return false; // No buffer or space
865  if (inU32s.empty())
866  return true; // Nothing to copy
867 
868  size_t maxU32s (GetByteCount() / sizeof(uint32_t));
869  uint32_t * pU32 (reinterpret_cast<uint32_t*>(GetHostAddress(ULWord(inU32Offset * sizeof(uint32_t)))));
870  if (!pU32)
871  return false; // Start offset is past end
872  if (maxU32s > inU32Offset)
873  maxU32s -= inU32Offset; // Don't go past end
874  if (maxU32s > inU32s.size())
875  maxU32s = inU32s.size(); // Truncate incoming vector to not go past my end
876  if (inU32s.size() > maxU32s)
877  return false; // Will write past end
878 
879  for (unsigned ndx(0); ndx < maxU32s; ndx++)
880 #if defined(_DEBUG)
881  *pU32++ = inByteSwap ? NTV2EndianSwap32(inU32s.at(ndx)) : inU32s.at(ndx);
882 #else
883  *pU32++ = inByteSwap ? NTV2EndianSwap32(inU32s[ndx]) : inU32s[ndx];
884 #endif
885  return true;
886 }
887 
888 
889 bool NTV2Buffer::PutU16s (const UWordSequence & inU16s, const size_t inU16Offset, const bool inByteSwap)
890 {
891  if (IsNULL())
892  return false; // No buffer or space
893  if (inU16s.empty())
894  return true; // Nothing to copy
895 
896  size_t maxU16s (GetByteCount() / sizeof(uint16_t));
897  uint16_t * pU16 (reinterpret_cast<uint16_t*>(GetHostAddress(ULWord(inU16Offset * sizeof(uint16_t)))));
898  if (!pU16)
899  return false; // Start offset is past end
900  if (maxU16s > inU16Offset)
901  maxU16s -= inU16Offset; // Don't go past end
902  if (maxU16s > inU16s.size())
903  maxU16s = inU16s.size(); // Truncate incoming vector to not go past my end
904  if (inU16s.size() > maxU16s)
905  return false; // Will write past end
906 
907  for (unsigned ndx(0); ndx < maxU16s; ndx++)
908 #if defined(_DEBUG)
909  *pU16++ = inByteSwap ? NTV2EndianSwap16(inU16s.at(ndx)) : inU16s.at(ndx);
910 #else
911  *pU16++ = inByteSwap ? NTV2EndianSwap16(inU16s[ndx]) : inU16s[ndx];
912 #endif
913  return true;
914 }
915 
916 
917 bool NTV2Buffer::PutU8s (const UByteSequence & inU8s, const size_t inU8Offset)
918 {
919  if (IsNULL())
920  return false; // No buffer or space
921  if (inU8s.empty())
922  return true; // Nothing to copy
923 
924  size_t maxU8s (GetByteCount());
925  uint8_t * pU8 (reinterpret_cast<uint8_t*>(GetHostAddress(ULWord(inU8Offset))));
926  if (!pU8)
927  return false; // Start offset is past end
928  if (maxU8s > inU8Offset)
929  maxU8s -= inU8Offset; // Don't go past end
930  if (maxU8s > inU8s.size())
931  maxU8s = inU8s.size(); // Truncate incoming vector to not go past end
932  if (inU8s.size() > maxU8s)
933  return false; // Will write past end
934 #if 1
935  ::memcpy(pU8, &inU8s[0], maxU8s);
936 #else
937  for (unsigned ndx(0); ndx < maxU8s; ndx++)
938  #if defined(_DEBUG)
939  *pU8++ = inU8s.at(ndx);
940  #else
941  *pU8++ = inU8s[ndx];
942  #endif
943 #endif
944  return true;
945 }
946 
947 
948 ostream & operator << (ostream & inOutStream, const NTV2_RP188 & inObj)
949 {
950  if (inObj.IsValid ())
951  return inOutStream << "{Dx" << HEX0N(inObj.fDBB,8) << "|Lx" << HEX0N(inObj.fLo,8) << "|Hx" << HEX0N(inObj.fHi,8) << "}";
952  else
953  return inOutStream << "{invalid}";
954 }
955 
956 
958 {
959  inOutList.push_back (inRP188);
960  return inOutList;
961 }
962 
963 
964 ostream & operator << (ostream & inOutStream, const NTV2TimeCodeList & inObj)
965 {
966  inOutStream << inObj.size () << ":[";
967  for (NTV2TimeCodeListConstIter iter (inObj.begin ()); iter != inObj.end (); )
968  {
969  inOutStream << *iter;
970  if (++iter != inObj.end ())
971  inOutStream << ", ";
972  }
973  return inOutStream << "]";
974 }
975 
976 
977 ostream & operator << (std::ostream & inOutStream, const NTV2TimeCodes & inObj)
978 {
979  inOutStream << inObj.size () << ":[";
980  for (NTV2TimeCodesConstIter iter (inObj.begin ()); iter != inObj.end (); )
981  {
982  inOutStream << ::NTV2TCIndexToString (iter->first,true) << "=" << iter->second;
983  if (++iter != inObj.end ())
984  inOutStream << ", ";
985  }
986  return inOutStream << "]";
987 }
988 
989 
990 ostream & operator << (std::ostream & inOutStream, const NTV2TCIndexes & inObj)
991 {
992  for (NTV2TCIndexesConstIter iter (inObj.begin ()); iter != inObj.end (); )
993  {
994  inOutStream << ::NTV2TCIndexToString (*iter);
995  if (++iter != inObj.end ())
996  inOutStream << ", ";
997  }
998  return inOutStream;
999 }
1000 
1001 
1003 {
1004  for (NTV2TCIndexesConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
1005  inOutSet.insert (*iter);
1006  return inOutSet;
1007 }
1008 
1009 
1010 ostream & operator << (ostream & inOutStream, const FRAME_STAMP & inObj)
1011 {
1012  return inOutStream << inObj.acHeader
1013  << " frmTime=" << inObj.acFrameTime
1014  << " reqFrm=" << inObj.acRequestedFrame
1015  << " audClkTS=" << inObj.acAudioClockTimeStamp
1016  << " audExpAdr=" << hex << inObj.acAudioExpectedAddress << dec
1017  << " audInStrtAdr=" << hex << inObj.acAudioInStartAddress << dec
1018  << " audInStopAdr=" << hex << inObj.acAudioInStopAddress << dec
1019  << " audOutStrtAdr=" << hex << inObj.acAudioOutStartAddress << dec
1020  << " audOutStopAdr=" << hex << inObj.acAudioOutStopAddress << dec
1021  << " totBytes=" << inObj.acTotalBytesTransferred
1022  << " strtSamp=" << inObj.acStartSample
1023  << " curTime=" << inObj.acCurrentTime
1024  << " curFrm=" << inObj.acCurrentFrame
1025  << " curFrmTime=" << inObj.acCurrentFrameTime
1026  << " audClkCurTime=" << inObj.acAudioClockCurrentTime
1027  << " curAudExpAdr=" << hex << inObj.acCurrentAudioExpectedAddress << dec
1028  << " curAudStrtAdr=" << hex << inObj.acCurrentAudioStartAddress << dec
1029  << " curFldCnt=" << inObj.acCurrentFieldCount
1030  << " curLnCnt=" << inObj.acCurrentLineCount
1031  << " curReps=" << inObj.acCurrentReps
1032  << " curUsrCookie=" << hex << inObj.acCurrentUserCookie << dec
1033  << " acFrame=" << inObj.acFrame
1034  << " acRP188=" << inObj.acRP188 // deprecated
1035  << " " << inObj.acTrailer;
1036 }
1037 
1038 
1039 ostream & operator << (ostream & inOutStream, const NTV2SegmentedDMAInfo & inObj)
1040 {
1041  if (inObj.acNumSegments > 1)
1042  inOutStream << "segs=" << inObj.acNumSegments << " numActBPR=" << inObj.acNumActiveBytesPerRow
1043  << " segHostPitc=" << inObj.acSegmentHostPitch << " segDevPitc=" << inObj.acSegmentDevicePitch;
1044  else
1045  inOutStream << "n/a";
1046  return inOutStream;
1047 }
1048 
1049 
1050 ostream & operator << (ostream & inOutStream, const AUTOCIRCULATE_TRANSFER & inObj)
1051 {
1052  #if defined (_DEBUG)
1053  NTV2_ASSERT (inObj.NTV2_IS_STRUCT_VALID ());
1054  #endif
1055  string str (::NTV2FrameBufferFormatToString (inObj.acFrameBufferFormat, true));
1056  while (str.find (' ') != string::npos)
1057  str.erase (str.find (' '), 1);
1058  inOutStream << inObj.acHeader << " vid=" << inObj.acVideoBuffer
1059  << " aud=" << inObj.acAudioBuffer
1060  << " ancF1=" << inObj.acANCBuffer
1061  << " ancF2=" << inObj.acANCField2Buffer
1062  << " outTC(" << inObj.acOutputTimeCodes << ")"
1063  << " cookie=" << inObj.acInUserCookie
1064  << " vidDMAoff=" << inObj.acInVideoDMAOffset
1065  << " segDMA=" << inObj.acInSegmentedDMAInfo
1066  << " colcor=" << inObj.acColorCorrection
1067  << " fbf=" << str
1068  << " fbo=" << (inObj.acFrameBufferOrientation == NTV2_FRAMEBUFFER_ORIENTATION_BOTTOMUP ? "flip" : "norm")
1069  << " vidProc=" << inObj.acVidProcInfo
1070  << " quartsz=" << inObj.acVideoQuarterSizeExpand
1071  << " p2p=" << inObj.acPeerToPeerFlags
1072  << " repCnt=" << inObj.acFrameRepeatCount
1073  << " desFrm=" << inObj.acDesiredFrame
1074  << " rp188=" << inObj.acRP188 // deprecated
1075  << " xpt=" << inObj.acCrosspoint
1076  << " status{" << inObj.acTransferStatus << "}"
1077  << " " << inObj.acTrailer;
1078  return inOutStream;
1079 }
1080 
1081 
1082 ostream & operator << (ostream & inOutStream, const AUTOCIRCULATE_TRANSFER_STATUS & inObj)
1083 {
1084  inOutStream << inObj.acHeader << " state=" << ::NTV2AutoCirculateStateToString (inObj.acState)
1085  << " xferFrm=" << inObj.acTransferFrame
1086  << " bufLvl=" << inObj.acBufferLevel
1087  << " frms=" << inObj.acFramesProcessed
1088  << " drops=" << inObj.acFramesDropped
1089  << " " << inObj.acFrameStamp
1090  << " audXfrSz=" << inObj.acAudioTransferSize
1091  << " audStrtSamp=" << inObj.acAudioStartSample
1092  << " ancF1Siz=" << inObj.acAncTransferSize
1093  << " ancF2Siz=" << inObj.acAncField2TransferSize
1094  << " " << inObj.acTrailer;
1095  return inOutStream;
1096 }
1097 
1098 
1099 ostream & operator << (ostream & inOutStream, const NTV2RegisterValueMap & inObj)
1100 {
1101  NTV2RegValueMapConstIter iter (inObj.begin ());
1102  inOutStream << "RegValues:" << inObj.size () << "[";
1103  while (iter != inObj.end ())
1104  {
1105  const NTV2RegisterNumber registerNumber (static_cast <NTV2RegisterNumber> (iter->first));
1106  const ULWord registerValue (iter->second);
1107  inOutStream << ::NTV2RegisterNumberToString (registerNumber) << "=0x" << hex << registerValue << dec;
1108  if (++iter != inObj.end ())
1109  inOutStream << ",";
1110  }
1111  return inOutStream << "]";
1112 }
1113 
1114 
1115 ostream & operator << (ostream & inOutStream, const AutoCircVidProcInfo & inObj)
1116 {
1117  return inOutStream << "{mode=" << ::AutoCircVidProcModeToString (inObj.mode, true)
1118  << ", FGvid=" << ::NTV2CrosspointToString (inObj.foregroundVideoCrosspoint)
1119  << ", BGvid=" << ::NTV2CrosspointToString (inObj.backgroundVideoCrosspoint)
1120  << ", FGkey=" << ::NTV2CrosspointToString (inObj.foregroundKeyCrosspoint)
1121  << ", BGkey=" << ::NTV2CrosspointToString (inObj.backgroundKeyCrosspoint)
1122  << ", transCoeff=" << inObj.transitionCoefficient
1123  << ", transSoftn=" << inObj.transitionSoftness << "}";
1124 }
1125 
1126 
1127 ostream & operator << (ostream & inOutStream, const NTV2ColorCorrectionData & inObj)
1128 {
1129  return inOutStream << "{ccMode=" << ::NTV2ColorCorrectionModeToString (inObj.ccMode)
1130  << ", ccSatVal=" << inObj.ccSaturationValue
1131  << ", ccTables=" << inObj.ccLookupTables << "}";
1132 }
1133 
1134 
1136 {
1137  for (NTV2VideoFormatSetConstIter iter(inSet.begin()); iter != inSet.end(); ++iter)
1138  if (inOutSet.find(*iter) == inOutSet.end())
1139  inOutSet.insert(*iter);
1140  return inOutSet;
1141 }
1142 
1143 
1144 // Implementation of NTV2VideoFormatSet's ostream writer...
1145 ostream & operator << (ostream & inOStream, const NTV2VideoFormatSet & inFormats)
1146 {
1147  NTV2VideoFormatSet::const_iterator iter (inFormats.begin ());
1148 
1149  inOStream << inFormats.size ()
1150  << (inFormats.size () == 1 ? " video format: " : " video format(s): ");
1151 
1152  while (iter != inFormats.end ())
1153  {
1154  inOStream << std::string (::NTV2VideoFormatToString (*iter));
1155  inOStream << (++iter == inFormats.end () ? "" : ", ");
1156  }
1157 
1158  return inOStream;
1159 
1160 } // operator <<
1161 
1162 
1163 // Implementation of NTV2FrameBufferFormatSet's ostream writer...
1164 ostream & operator << (ostream & inOStream, const NTV2PixelFormats & inFormats)
1165 {
1166  NTV2PixelFormatsConstIter iter(inFormats.begin());
1167  inOStream << inFormats.size()
1168  << (inFormats.size() == 1 ? " pixel format: " : " pixel formats: ");
1169 
1170  while (iter != inFormats.end())
1171  {
1172  inOStream << ::NTV2FrameBufferFormatToString(*iter);
1173  inOStream << (++iter == inFormats.end() ? "" : ", ");
1174  }
1175  return inOStream;
1176 
1177 } // operator <<
1178 
1179 
1181 {
1182  for (NTV2PixelFormatsConstIter iter(inFBFs.begin()); iter != inFBFs.end(); ++iter)
1183  inOutSet.insert(*iter);
1184  return inOutSet;
1185 }
1186 
1187 
1188 // Implementation of NTV2StandardSet's ostream writer...
1189 ostream & operator << (ostream & inOStream, const NTV2StandardSet & inStandards)
1190 {
1191  NTV2StandardSetConstIter iter (inStandards.begin ());
1192 
1193  inOStream << inStandards.size ()
1194  << (inStandards.size () == 1 ? " standard: " : " standards: ");
1195 
1196  while (iter != inStandards.end ())
1197  {
1198  inOStream << ::NTV2StandardToString(*iter);
1199  inOStream << (++iter == inStandards.end () ? "" : ", ");
1200  }
1201 
1202  return inOStream;
1203 }
1204 
1205 
1207 {
1208  for (NTV2StandardSetConstIter iter(inSet.begin ()); iter != inSet.end(); ++iter)
1209  inOutSet.insert(*iter);
1210  return inOutSet;
1211 }
1212 
1213 
1214 // Implementation of NTV2GeometrySet's ostream writer...
1215 ostream & operator << (ostream & inOStream, const NTV2GeometrySet & inGeometries)
1216 {
1217  NTV2GeometrySetConstIter iter (inGeometries.begin ());
1218  inOStream << inGeometries.size ()
1219  << (inGeometries.size () == 1 ? " geometry: " : " geometries: ");
1220  while (iter != inGeometries.end ())
1221  {
1222  inOStream << ::NTV2FrameGeometryToString(*iter);
1223  inOStream << (++iter == inGeometries.end () ? "" : ", ");
1224  }
1225  return inOStream;
1226 }
1227 
1228 
1230 {
1231  for (NTV2GeometrySetConstIter iter(inSet.begin ()); iter != inSet.end(); ++iter)
1232  inOutSet.insert(*iter);
1233  return inOutSet;
1234 }
1235 
1236 
1237 // Implementation of NTV2FrameBufferFormatSet's ostream writer...
1238 ostream & operator << (ostream & inOStream, const NTV2InputSourceSet & inSet)
1239 {
1240  NTV2InputSourceSetConstIter iter(inSet.begin());
1241  inOStream << inSet.size()
1242  << (inSet.size() == 1 ? " input: " : " inputs: ");
1243  while (iter != inSet.end())
1244  {
1245  inOStream << ::NTV2InputSourceToString (*iter);
1246  inOStream << (++iter == inSet.end() ? "" : ", ");
1247  }
1248  return inOStream;
1249 } // operator <<
1250 
1251 
1253 {
1254  for (NTV2InputSourceSetConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
1255  inOutSet.insert (*iter);
1256  return inOutSet;
1257 }
1258 
1259 
1260 ostream & operator << (ostream & inOStream, const NTV2OutputDestinations & inSet)
1261 {
1262  NTV2OutputDestinationsConstIter iter(inSet.begin());
1263  inOStream << inSet.size()
1264  << (inSet.size() == 1 ? " output: " : " outputs: ");
1265  while (iter != inSet.end())
1266  {
1267  inOStream << ::NTV2OutputDestinationToString(*iter);
1268  inOStream << (++iter == inSet.end() ? "" : ", ");
1269  }
1270  return inOStream;
1271 }
1272 
1273 
1275 {
1276  for (NTV2OutputDestinationsConstIter iter(inSet.begin()); iter != inSet.end(); ++iter)
1277  inOutSet.insert(*iter);
1278  return inOutSet;
1279 }
1280 
1282 {
1283  outFormats.clear();
1284  const NTV2DeviceIDSet devIDs (::NTV2GetSupportedDevices());
1285  for (NTV2DeviceIDSetConstIter it(devIDs.begin()); it != devIDs.end(); ++it)
1286  {
1287  NTV2PixelFormats fmts;
1289  for (NTV2PixelFormatsConstIter fit(fmts.begin()); fit != fmts.end(); ++fit)
1290  if (outFormats.find(*fit) == outFormats.end())
1291  outFormats.insert(*fit);
1292  }
1293  return true;
1294 }
1295 
1297 {
1298  NTV2PixelFormats usedFormats;
1299  ::NTV2GetSupportedPixelFormats(usedFormats);
1300  for (NTV2PixelFormat pf(NTV2_FBF_FIRST); pf < NTV2_FBF_LAST; pf = NTV2PixelFormat(pf+1))
1301  if (usedFormats.find(pf) == usedFormats.end()) // if unused
1302  outFormats.insert(pf);
1303  return true;
1304 }
1305 
1307 {
1308  outStandards.clear();
1309  const NTV2DeviceIDSet devIDs (::NTV2GetSupportedDevices());
1310  for (NTV2DeviceIDSetConstIter it(devIDs.begin()); it != devIDs.end(); ++it)
1311  {
1312  NTV2StandardSet stds;
1314  for (NTV2StandardSetConstIter sit(stds.begin()); sit != stds.end(); ++sit)
1315  if (outStandards.find(*sit) == outStandards.end())
1316  outStandards.insert(*sit);
1317  }
1318  return true;
1319 }
1320 
1322 {
1323  NTV2StandardSet usedStandards;
1324  ::NTV2GetSupportedStandards(usedStandards);
1326  if (usedStandards.find(st) == usedStandards.end()) // if unused
1327  outStandards.insert(st);
1328  return true;
1329 }
1330 
1331 
1332 // This needs to be moved into a C++ compatible "device features" module:
1334 {
1335  bool isOkay(true);
1336  outFormats.clear();
1337 
1339  {
1340  if (inDeviceID != DEVICE_ID_INVALID && !::NTV2DeviceCanDoVideoFormat(inDeviceID, vf))
1341  continue; // Valid devID specified and VF not supported on that device
1342  if (inDeviceID == DEVICE_ID_INVALID && !NTV2_IS_VALID_VIDEO_FORMAT(vf))
1343  continue; // Invalid devID specified and invalid VF
1344  try
1345  {
1346  outFormats.insert(vf);
1347  }
1348  catch (const std::bad_alloc &)
1349  {
1350  isOkay = false;
1351  outFormats.clear();
1352  break;
1353  }
1354  } // for each video format
1355 
1356  NTV2_ASSERT ((isOkay && !outFormats.empty()) || (!isOkay && outFormats.empty()));
1357  return isOkay;
1358 
1359 } // NTV2DeviceGetSupportedVideoFormats
1360 
1361 // This needs to be moved into a C++ compatible "device features" module:
1363 {
1364  bool isOkay(true);
1365  outFormats.clear();
1366 
1367  for (NTV2PixelFormat pixelFormat(NTV2_FBF_FIRST); pixelFormat < NTV2_FBF_LAST; pixelFormat = NTV2PixelFormat(pixelFormat+1))
1368  if (::NTV2DeviceCanDoFrameBufferFormat (inDeviceID, pixelFormat))
1369  try
1370  {
1371  outFormats.insert(pixelFormat);
1372  }
1373  catch (const std::bad_alloc &)
1374  {
1375  isOkay = false;
1376  outFormats.clear();
1377  break;
1378  }
1379 
1381  if (supportedDevices.find(inDeviceID) != supportedDevices.end())
1382  {// NTV2_ASSERT ((isOkay && !outFormats.empty() ) || (!isOkay && outFormats.empty() ));
1383  return isOkay && !outFormats.empty();
1384  }
1385  return isOkay;
1386 
1387 } // NTV2DeviceGetSupportedPixelFormats
1388 
1389 // This needs to be moved into a C++ compatible "device features" module:
1390 bool NTV2DeviceGetSupportedStandards (const NTV2DeviceID inDeviceID, NTV2StandardSet & outStandards)
1391 {
1392  NTV2VideoFormatSet videoFormats;
1393  outStandards.clear();
1394  if (!::NTV2DeviceGetSupportedVideoFormats(inDeviceID, videoFormats))
1395  return false;
1396  for (NTV2VideoFormatSetConstIter it(videoFormats.begin()); it != videoFormats.end(); ++it)
1397  {
1399  if (NTV2_IS_VALID_STANDARD(std) && outStandards.find(std) == outStandards.end())
1400  outStandards.insert(std);
1401  }
1402  return true;
1403 }
1404 
1405 // This needs to be moved into a C++ compatible "device features" module:
1406 bool NTV2DeviceGetSupportedGeometries (const NTV2DeviceID inDeviceID, NTV2GeometrySet & outGeometries)
1407 {
1408  NTV2VideoFormatSet videoFormats;
1409  outGeometries.clear();
1410  if (!::NTV2DeviceGetSupportedVideoFormats(inDeviceID, videoFormats))
1411  return false;
1412  for (NTV2VideoFormatSetConstIter it(videoFormats.begin()); it != videoFormats.end(); ++it)
1413  {
1416  outGeometries += ::GetRelatedGeometries(fg);
1417  }
1418  return true;
1419 }
1420 
1421 bool NTV2DeviceGetSupportedInputSources (const NTV2DeviceID inDeviceID, NTV2InputSourceSet & outInputSources, const NTV2IOKinds inKinds)
1422 {
1423  outInputSources.clear();
1424  if (!NTV2_IS_VALID_IOKINDS(inKinds))
1425  return false;
1427  { const bool ok (inDeviceID == DEVICE_ID_INVALID ? true : ::NTV2DeviceCanDoInputSource(inDeviceID, src));
1428  if (ok)
1429  if ( (NTV2_INPUT_SOURCE_IS_SDI(src) && (inKinds & NTV2_IOKINDS_SDI))
1430  || (NTV2_INPUT_SOURCE_IS_HDMI(src) && (inKinds & NTV2_IOKINDS_HDMI))
1431  || (NTV2_INPUT_SOURCE_IS_ANALOG(src) && (inKinds & NTV2_IOKINDS_ANALOG)) )
1432  outInputSources.insert(src);
1433  }
1434  return true;
1435 }
1436 
1437 bool NTV2DeviceGetSupportedOutputDests (const NTV2DeviceID inDeviceID, NTV2OutputDestinations & outOutputDests, const NTV2IOKinds inKinds)
1438 {
1442  outOutputDests.clear();
1443  if (!NTV2_IS_VALID_IOKINDS(inKinds))
1444  return false;
1445  const UWord numSDI(inDeviceID == DEVICE_ID_INVALID ? 8 : ::NTV2DeviceGetNumVideoOutputs(inDeviceID)),
1446  numAnl(inDeviceID == DEVICE_ID_INVALID ? 1 : ::NTV2DeviceGetNumAnalogVideoOutputs(inDeviceID)),
1447  numHDM(inDeviceID == DEVICE_ID_INVALID ? 1 : ::NTV2DeviceGetNumHDMIVideoOutputs(inDeviceID));
1448  for (size_t ndx(0); ndx < 10; ndx++)
1449  {
1450  const NTV2OutputDest dst(sDsts[ndx]);
1451  if ( (NTV2_OUTPUT_DEST_IS_SDI(dst) && (inKinds & NTV2_IOKINDS_SDI) && (numSDI > ::NTV2OutputDestinationToChannel(dst)))
1452  || (NTV2_OUTPUT_DEST_IS_HDMI(dst) && (inKinds & NTV2_IOKINDS_HDMI) && (numHDM) )
1453  || (NTV2_OUTPUT_DEST_IS_ANALOG(dst) && (inKinds & NTV2_IOKINDS_ANALOG) && (numAnl) ) )
1454  outOutputDests.insert(dst);
1455  }
1456  return true;
1457 }
1458 
1459 ostream & operator << (ostream & oss, const NTV2FrameRateSet & inSet)
1460 {
1461  NTV2FrameRateSetConstIter it(inSet.begin());
1462  oss << inSet.size()
1463  << (inSet.size() == 1 ? " rate: " : " rates: ");
1464  while (it != inSet.end())
1465  {
1466  oss << ::NTV2FrameRateToString(*it);
1467  oss << (++it == inSet.end() ? "" : ", ");
1468  }
1469  return oss;
1470 }
1471 
1473 {
1474  for (NTV2FrameRateSetConstIter it(inSet.begin()); it != inSet.end(); ++it)
1475  if (inOutSet.find(*it) == inOutSet.end())
1476  inOutSet.insert(*it);
1477  return inOutSet;
1478 }
1479 
1481 {
1482  outRates.clear();
1483  NTV2VideoFormatSet vfs;
1484  if (!::NTV2DeviceGetSupportedVideoFormats (inDeviceID, vfs))
1485  return false;
1486  for (NTV2VideoFormatSetConstIter it(vfs.begin()); it != vfs.end(); ++it)
1487  { const NTV2FrameRate fr (::GetNTV2FrameRateFromVideoFormat(*it));
1489  outRates.insert(fr);
1490  }
1491  return true;
1492 }
1493 
1494 
1495 ostream & operator << (ostream & inOutStrm, const NTV2SegmentedXferInfo & inRun)
1496 {
1497  return inRun.Print(inOutStrm);
1498 }
1499 
1500 
1501 // Implementation of NTV2AutoCirculateStateToString...
1503 {
1504  static const char * sStateStrings [] = { "Disabled", "Initializing", "Starting", "Paused", "Stopping", "Running", "StartingAtTime", AJA_NULL};
1506  return string (sStateStrings [inState]);
1507  else
1508  return "<invalid>";
1509 }
1510 
1511 
1512 
1515  fTrailerTag (NTV2_TRAILER_TAG)
1516 {
1517 }
1518 
1519 
1520 NTV2FrameSize::operator NTV2FrameGeometry() const // Cast to NTV2FrameGeometry
1521 {
1522  return isValid() ? ::GetGeometryFromFrameDimensions(*this) : NTV2_FG_INVALID;
1523 }
1524 
1526 { // Requires C++11:
1527  static const FGSizesMap sFGWdths = { {NTV2_FG_720x486, 720},
1528  {NTV2_FG_720x508, 720},
1529  {NTV2_FG_720x514, 720},
1530  {NTV2_FG_720x576, 720},
1531  {NTV2_FG_720x598, 720},
1532  {NTV2_FG_720x612, 720},
1533  {NTV2_FG_1280x720, 1280},
1534  {NTV2_FG_1280x740, 1280},
1535  {NTV2_FG_1920x1080, 1920},
1536  {NTV2_FG_1920x1114, 1920},
1537  {NTV2_FG_1920x1112, 1920},
1538  {NTV2_FG_2048x1080, 2048},
1539  {NTV2_FG_2048x1112, 2048},
1540  {NTV2_FG_2048x1114, 2048},
1541  {NTV2_FG_2048x1556, 2048},
1542  {NTV2_FG_2048x1588, 2048},
1543  {NTV2_FG_3840x2160, 3840},
1544  {NTV2_FG_4096x2160, 4096},
1545  {NTV2_FG_7680x4320, 7680},
1546  {NTV2_FG_8192x4320, 8192} };
1547  FGSizesMapCI it (sFGWdths.find(fg));
1548  return it != sFGWdths.end() ? it->second : 0;
1549 }
1550 
1552 { // Requires C++11:
1553  static const FGSizesMap sFGHghts = { {NTV2_FG_720x486, 486},
1554  {NTV2_FG_720x508, 508},
1555  {NTV2_FG_720x514, 514},
1556  {NTV2_FG_720x576, 576},
1557  {NTV2_FG_720x598, 598},
1558  {NTV2_FG_720x612, 612},
1559  {NTV2_FG_1280x720, 720},
1560  {NTV2_FG_1280x740, 740},
1561  {NTV2_FG_2048x1556, 1556},
1562  {NTV2_FG_2048x1588, 1588},
1563  {NTV2_FG_1920x1080, 1080},
1564  {NTV2_FG_2048x1080, 1080},
1565  {NTV2_FG_1920x1114, 1114},
1566  {NTV2_FG_2048x1114, 1114},
1567  {NTV2_FG_1920x1112, 1112},
1568  {NTV2_FG_2048x1112, 1112},
1569  {NTV2_FG_3840x2160, 2160},
1570  {NTV2_FG_4096x2160, 2160},
1571  {NTV2_FG_7680x4320, 4320},
1572  {NTV2_FG_8192x4320, 4320} };
1573  FGSizesMapCI it (sFGHghts.find(fg));
1574  return it != sFGHghts.end() ? it->second : 0;
1575 }
1576 
1577 
1578 static const string sSegXferUnits[] = {"", " U8", " U16", "", " U32", "", "", "", " U64", ""};
1579 
1580 ostream & NTV2SegmentedXferInfo::Print (ostream & inStrm, const bool inDumpSegments) const
1581 {
1582  if (!isValid())
1583  return inStrm << "(invalid)";
1584  if (inDumpSegments)
1585  {
1586  // TBD
1587  }
1588  else
1589  {
1590  inStrm << DEC(getSegmentCount()) << " x " << DEC(getSegmentLength())
1591  << sSegXferUnits[getElementLength()] << " segs";
1592  if (getSourceOffset())
1593  inStrm << " srcOff=" << xHEX0N(getSourceOffset(),8);
1594  if (getSegmentCount() > 1)
1595  inStrm << " srcSpan=" << xHEX0N(getSourcePitch(),8) << (isSourceBottomUp()?" VF":"");
1596  if (getDestOffset())
1597  inStrm << " dstOff=" << xHEX0N(getDestOffset(),8);
1598  if (getSegmentCount() > 1)
1599  inStrm << " dstSpan=" << xHEX0N(getDestPitch(),8) << (isDestBottomUp()?" VF":"");
1600  inStrm << " totElm=" << DEC(getTotalElements()) << " totByt=" << xHEX0N(getTotalBytes(),8);
1601  }
1602  return inStrm;
1603 }
1604 
1605 string NTV2SegmentedXferInfo::getSourceCode (const bool inInclDecl) const
1606 {
1607  static string var("segInfo");
1608  ostringstream oss;
1609  string units("\t// bytes");
1610  if (!isValid())
1611  return "";
1612  if (inInclDecl)
1613  oss << "NTV2SegmentedXferInfo " << var << ";" << endl;
1614  if (getElementLength() > 1)
1615  {
1616  units = "\t// " + sSegXferUnits[getElementLength()] + "s";
1617  oss << var << ".setElementLength(" << getElementLength() << ");" << endl;
1618  }
1619  oss << var << ".setSegmentCount(" << DEC(getSegmentCount()) << ");" << endl;
1620  oss << var << ".setSegmentLength(" << DEC(getSegmentLength()) << ");" << units << endl;
1621  if (getSourceOffset())
1622  oss << var << ".setSourceOffset(" << DEC(getSourceOffset()) << ");" << units << endl;
1623  oss << var << ".setSourcePitch(" << DEC(getSourcePitch()) << ");" << units << endl;
1624  if (isSourceBottomUp())
1625  oss << var << ".setSourceDirection(false);" << endl;
1626  if (getDestOffset())
1627  oss << var << ".setDestOffset(" << DEC(getDestOffset()) << ");" << units << endl;
1628  if (getDestPitch())
1629  oss << var << ".setDestPitch(" << DEC(getDestPitch()) << ");" << units << endl;
1630  if (isDestBottomUp())
1631  oss << var << ".setDestDirection(false);" << endl;
1632  return oss.str();
1633 }
1634 
1635 bool NTV2SegmentedXferInfo::containsElementAtOffset (const ULWord inElementOffset) const
1636 {
1637  if (!isValid())
1638  return false;
1639  if (getSegmentCount() == 1)
1640  {
1641  if (inElementOffset >= getSourceOffset())
1642  if (inElementOffset < getSourceOffset()+getSegmentLength())
1643  return true;
1644  return false;
1645  }
1646  ULWord offset(getSourceOffset());
1647  for (ULWord seg(0); seg < getSegmentCount(); seg++)
1648  {
1649  if (inElementOffset < offset)
1650  return false; // past element of interest already
1651  if (inElementOffset < offset+getSegmentLength())
1652  return true; // must be within this segment
1653  offset += getSourcePitch(); // skip to next segment
1654  }
1655  return false;
1656 }
1657 
1659 {
1660  if (getElementLength() != inRHS.getElementLength())
1661  // FUTURE TBD: Need to transform RHS to match ElementLength so as to make apples-to-apples comparison
1662  return true; // For now, fail
1663  if (getSegmentCount() != inRHS.getSegmentCount())
1664  return true;
1665  if (getSegmentLength() != inRHS.getSegmentLength())
1666  return true;
1667  if (getSourceOffset() != inRHS.getSourceOffset())
1668  return true;
1669  if (getSourcePitch() != inRHS.getSourcePitch())
1670  return true;
1671  if (getDestOffset() != inRHS.getDestOffset())
1672  return true;
1673  if (getDestPitch() != inRHS.getDestPitch())
1674  return true;
1675  return false;
1676 }
1677 
1679 {
1680  mFlags = 0;
1681  mNumSegments = 0;
1682  mElementsPerSegment = 0;
1683  mInitialSrcOffset = 0;
1684  mInitialDstOffset = 0;
1685  mSrcElementsPerRow = 0;
1686  mDstElementsPerRow = 0;
1687  setElementLength(1); // elements == bytes
1688  return *this;
1689 }
1690 
1692 {
1693  std::swap(mSrcElementsPerRow, mDstElementsPerRow);
1694  std::swap(mInitialSrcOffset, mInitialDstOffset);
1695  const bool srcNormal(this->isSourceTopDown()), dstNormal(this->isDestTopDown());
1696  setSourceDirection(dstNormal).setDestDirection(srcNormal);
1697  return *this;
1698 }
1699 
1700 
1701 NTV2Buffer::NTV2Buffer (const void * pInUserPointer, const size_t inByteCount)
1702  : fUserSpacePtr (inByteCount ? NTV2Buffer_TO_ULWORD64(pInUserPointer) : 0),
1703  fByteCount (ULWord(pInUserPointer ? inByteCount : 0)),
1704  fFlags (0),
1705  #if defined (AJAMac)
1706  fKernelSpacePtr (0),
1707  fIOMemoryDesc (0),
1708  fIOMemoryMap (0)
1709  #else
1710  //fKernelSpacePtr (0),
1711  fKernelHandle (0)
1712  #endif
1713 {
1714 }
1715 
1716 
1717 NTV2Buffer::NTV2Buffer (const size_t inByteCount)
1718  : fUserSpacePtr (0),
1719  fByteCount (0),
1720  fFlags (0),
1721  #if defined (AJAMac)
1722  fKernelSpacePtr (0),
1723  fIOMemoryDesc (0),
1724  fIOMemoryMap (0)
1725  #else
1726  //fKernelSpacePtr (0),
1727  fKernelHandle (0)
1728  #endif
1729 {
1730  if (inByteCount)
1731  Allocate(inByteCount);
1732 }
1733 
1734 
1736  : fUserSpacePtr (0),
1737  fByteCount (0),
1738  fFlags (0),
1739  #if defined (AJAMac)
1740  fKernelSpacePtr (0),
1741  fIOMemoryDesc (0),
1742  fIOMemoryMap (0)
1743  #else
1744  //fKernelSpacePtr (0),
1745  fKernelHandle (0)
1746  #endif
1747 {
1748  if (Allocate(inObj.GetByteCount()))
1749  SetFrom(inObj);
1750 }
1751 
1752 bool NTV2Buffer::Truncate (const size_t inNewByteCount)
1753 {
1754  if (inNewByteCount == GetByteCount())
1755  return true; // Same size -- done!
1756  if (inNewByteCount > GetByteCount())
1757  return false; // Cannot enlarge -- i.e. can't be greater than my current size
1758  if (!inNewByteCount && IsAllocatedBySDK())
1759  return Deallocate(); // A newByteCount of zero calls Deallocate
1760  fByteCount = ULWord(inNewByteCount);
1761  return true;
1762 }
1763 
1765 {
1766  if (&inRHS != this)
1767  {
1768  if (inRHS.IsNULL())
1769  Set (AJA_NULL, 0);
1770  else if (GetByteCount() == inRHS.GetByteCount())
1771  SetFrom(inRHS);
1772  else if (Allocate(inRHS.GetByteCount()))
1773  SetFrom(inRHS);
1774  //else; // Error
1775  }
1776  return *this;
1777 }
1778 
1779 
1781 {
1782  Set (AJA_NULL, 0); // Call 'Set' to delete the array (if I allocated it)
1783 }
1784 
1785 
1787 {
1788  uint64_t * pU64s(reinterpret_cast<uint64_t*>(GetHostPointer()));
1789  const size_t loopCount(GetByteCount() / sizeof(uint64_t));
1790  if (IsNULL())
1791  return false;
1792  for (size_t ndx(0); ndx < loopCount; ndx++)
1793  pU64s[ndx] = NTV2EndianSwap64(pU64s[ndx]);
1794  return true;
1795 }
1796 
1797 
1799 {
1800  uint32_t * pU32s(reinterpret_cast<uint32_t*>(GetHostPointer()));
1801  const size_t loopCount(GetByteCount() / sizeof(uint32_t));
1802  if (IsNULL())
1803  return false;
1804  for (size_t ndx(0); ndx < loopCount; ndx++)
1805  pU32s[ndx] = NTV2EndianSwap32(pU32s[ndx]);
1806  return true;
1807 }
1808 
1809 
1811 {
1812  uint16_t * pU16s(reinterpret_cast<uint16_t*>(GetHostPointer()));
1813  const size_t loopCount(GetByteCount() / sizeof(uint16_t));
1814  if (IsNULL())
1815  return false;
1816  for (size_t ndx(0); ndx < loopCount; ndx++)
1817  pU16s[ndx] = NTV2EndianSwap16(pU16s[ndx]);
1818  return true;
1819 }
1820 
1821 
1822 bool NTV2Buffer::Set (const void * pInUserPointer, const size_t inByteCount)
1823 {
1824  if (uint64_t(inByteCount) >= 0x0000000100000000) // inByteCount >= 4GB?
1825  return false; // Can't store 4GB or larger value in fByteCount
1826  Deallocate();
1827  fUserSpacePtr = inByteCount ? NTV2Buffer_TO_ULWORD64(pInUserPointer) : 0;
1828  fByteCount = ULWord(pInUserPointer ? inByteCount : 0);
1829  // Return true only if both UserPointer and ByteCount are non-zero, or both are zero.
1830  return (pInUserPointer && inByteCount) || (!pInUserPointer && !inByteCount);
1831 }
1832 
1833 
1834 bool NTV2Buffer::SetAndFill (const void * pInUserPointer, const size_t inByteCount, const UByte inValue)
1835 {
1836  return Set(pInUserPointer, inByteCount) && Fill(inValue);
1837 }
1838 
1839 
1840 bool NTV2Buffer::Allocate (const size_t inByteCount, const bool inPageAligned)
1841 {
1842  if (uint64_t(inByteCount) >= 0x0000000100000000) // inByteCount >= 4GB?
1843  return false; // Can't store 4GB or more in fByteCount
1844  if (GetByteCount() && IsAllocatedBySDK()) // If already was Allocated
1845  if (inByteCount == GetByteCount()) // If same byte count
1846  {
1847  Fill(UByte(0)); // Zero it...
1848  return true; // ...and return true
1849  }
1850 
1851  bool result(Set(AJA_NULL, 0)); // Jettison existing buffer (if any)
1852  if (inByteCount)
1853  { // Allocate the byte array, and call Set...
1854  UByte * pBuffer(AJA_NULL);
1855  result = false;
1856  if (inPageAligned)
1857  pBuffer = reinterpret_cast<UByte*>(AJAMemory::AllocateAligned(inByteCount, DefaultPageSize()));
1858  else
1859  try
1860  {pBuffer = new UByte[inByteCount];}
1861  catch (const std::bad_alloc &)
1862  {pBuffer = AJA_NULL;}
1863  if (pBuffer && Set(pBuffer, inByteCount))
1864  { // SDK owns this memory -- set NTV2Buffer_ALLOCATED bit -- I'm responsible for deleting
1865  result = true;
1866  fFlags |= NTV2Buffer_ALLOCATED;
1867  if (inPageAligned)
1868  fFlags |= NTV2Buffer_PAGE_ALIGNED; // Set "page aligned" flag
1869  Fill(UByte(0)); // Zero it
1870  }
1871  } // if requested size is non-zero
1872  return result;
1873 }
1874 
1875 
1877 {
1878  if (IsAllocatedBySDK())
1879  {
1880  if (!IsNULL())
1881  {
1882  if (IsPageAligned())
1883  {
1885  fFlags &= ~NTV2Buffer_PAGE_ALIGNED;
1886  }
1887  else
1888  delete [] reinterpret_cast<UByte*>(GetHostPointer());
1889  }
1890  fUserSpacePtr = 0;
1891  fByteCount = 0;
1892  fFlags &= ~NTV2Buffer_ALLOCATED;
1893  }
1894  return true;
1895 }
1896 
1897 
1898 void * NTV2Buffer::GetHostAddress (const ULWord inByteOffset, const bool inFromEnd) const
1899 {
1900  if (IsNULL())
1901  return AJA_NULL;
1902  if (inByteOffset >= GetByteCount())
1903  return AJA_NULL;
1904  UByte * pBytes (reinterpret_cast<UByte*>(GetHostPointer()));
1905  if (inFromEnd)
1906  pBytes += GetByteCount() - inByteOffset;
1907  else
1908  pBytes += inByteOffset;
1909  return pBytes;
1910 }
1911 
1912 
1913 bool NTV2Buffer::SetFrom (const NTV2Buffer & inBuffer)
1914 {
1915  if (inBuffer.IsNULL())
1916  return false; // NULL or empty
1917  if (IsNULL())
1918  return false; // I am NULL or empty
1919  if (inBuffer.GetByteCount() == GetByteCount() && inBuffer.GetHostPointer() == GetHostPointer())
1920  return true; // Same buffer
1921 
1922  size_t bytesToCopy(inBuffer.GetByteCount());
1923  if (bytesToCopy > GetByteCount())
1924  bytesToCopy = GetByteCount();
1925  ::memcpy (GetHostPointer(), inBuffer.GetHostPointer(), bytesToCopy);
1926  return true;
1927 }
1928 
1929 
1930 bool NTV2Buffer::CopyFrom (const void * pInSrcBuffer, const ULWord inByteCount)
1931 {
1932  if (!inByteCount)
1933  return Set (AJA_NULL, 0); // Zero bytes
1934  if (!pInSrcBuffer)
1935  return false; // NULL src ptr
1936  if (!Allocate (inByteCount))
1937  return false; // Resize failed
1938  ::memcpy (GetHostPointer(), pInSrcBuffer, inByteCount);
1939  return true;
1940 }
1941 
1942 
1943 bool NTV2Buffer::CopyFrom (const NTV2Buffer & inBuffer,
1944  const ULWord inSrcByteOffset, const ULWord inDstByteOffset, const ULWord inByteCount)
1945 {
1946  if (inBuffer.IsNULL() || IsNULL())
1947  return false; // NULL or empty
1948  if (inSrcByteOffset + inByteCount > inBuffer.GetByteCount())
1949  return false; // Past end of src
1950  if (inDstByteOffset + inByteCount > GetByteCount())
1951  return false; // Past end of me
1952 
1953  const UByte * pSrc (inBuffer);
1954  pSrc += inSrcByteOffset;
1955 
1956  UByte * pDst (*this);
1957  pDst += inDstByteOffset;
1958 
1959  ::memcpy (pDst, pSrc, inByteCount);
1960  return true;
1961 }
1962 
1963 
1964 bool NTV2Buffer::CopyFrom (const NTV2Buffer & inSrcBuffer, const NTV2SegmentedXferInfo & inXferInfo)
1965 {
1966  if (!inXferInfo.isValid() || inSrcBuffer.IsNULL() || IsNULL())
1967  return false;
1968 
1969  // Copy every segment...
1970  LWord srcOffset (LWord(inXferInfo.getSourceOffset() * inXferInfo.getElementLength()));
1971  LWord dstOffset (LWord(inXferInfo.getDestOffset() * inXferInfo.getElementLength()));
1972  LWord srcPitch (LWord(inXferInfo.getSourcePitch() * inXferInfo.getElementLength()));
1973  LWord dstPitch (LWord(inXferInfo.getDestPitch() * inXferInfo.getElementLength()));
1974  const LWord bytesPerSeg (inXferInfo.getSegmentLength() * inXferInfo.getElementLength());
1975  if (inXferInfo.isSourceBottomUp())
1976  srcPitch = 0 - srcPitch;
1977  if (inXferInfo.isDestBottomUp())
1978  dstPitch = 0 - dstPitch;
1979  for (ULWord segNdx(0); segNdx < inXferInfo.getSegmentCount(); segNdx++)
1980  {
1981  const void * pSrc (inSrcBuffer.GetHostAddress(srcOffset));
1982  void * pDst (GetHostAddress(dstOffset));
1983  if (!pSrc) return false;
1984  if (!pDst) return false;
1985  if (srcOffset + bytesPerSeg > LWord(inSrcBuffer.GetByteCount()))
1986  return false; // memcpy will read past end of srcBuffer
1987  if (dstOffset + bytesPerSeg > LWord(GetByteCount()))
1988  return false; // memcpy will write past end of me
1989  ::memcpy (pDst, pSrc, size_t(bytesPerSeg));
1990  srcOffset += srcPitch; // Bump src offset
1991  dstOffset += dstPitch; // Bump dst offset
1992  } // for each segment
1993  return true;
1994 }
1995 
1996 bool NTV2Buffer::SetFromHexString (const string & inStr)
1997 {
1998  string str(inStr);
1999 
2000  // Remove all whitespace...
2001  const string newline("\n"), tab("\t");
2002  aja::replace(str, newline, string());
2003  aja::replace(str, tab, string());
2004  aja::upper(str);
2005 
2006  // Fail if any non-hex found...
2007  for (size_t ndx(0); ndx < str.size(); ndx++)
2008  if (!aja::is_hex_digit(str.at(ndx)))
2009  return false;
2010 
2011  if (str.size() & 1)
2012  return false; // Remaining length must be even
2013  if (!Allocate(str.size() / 2))
2014  return false; // Resize failed
2015 
2016  // Decode and copy in the data...
2017  for (size_t srcNdx(0), dstNdx(0); srcNdx < str.size(); srcNdx += 2)
2018  U8(int(dstNdx++)) = uint8_t(aja::stoul (str.substr(srcNdx,2), AJA_NULL, 16));
2019 
2020  return true;
2021 }
2022 
2024 {
2025  if (inBuffer.IsNULL ())
2026  return false; // NULL or empty
2027  if (IsNULL ())
2028  return false; // I am NULL or empty
2029  if (inBuffer.GetByteCount () != GetByteCount ())
2030  return false; // Different sizes
2031  if (fFlags != inBuffer.fFlags)
2032  return false; // Flags mismatch
2033  if (inBuffer.GetHostPointer () == GetHostPointer ())
2034  return true; // Same buffer
2035 
2036  ULWord64 tmp = fUserSpacePtr;
2037  fUserSpacePtr = inBuffer.fUserSpacePtr;
2038  inBuffer.fUserSpacePtr = tmp;
2039  return true;
2040 }
2041 
2042 ULWordSet & NTV2Buffer::Find (ULWordSet & outOffsets, const NTV2Buffer & inValue, const size_t inLimit) const
2043 {
2044  outOffsets.clear();
2045  if (IsNULL())
2046  return outOffsets; // NULL buffer, return "no matches"
2047  if (inValue.IsNULL())
2048  return outOffsets; // NULL buffer, return "no matches"
2049  const ULWord srchByteCount(inValue.GetByteCount());
2050  if (GetByteCount() < srchByteCount)
2051  return outOffsets; // I'm smaller than the search data, return "no matches"
2052 
2053  const ULWord maxOffset(GetByteCount() - srchByteCount); // Don't search past here
2054  const uint8_t * pSrchData (inValue); // Pointer to search data
2055  const uint8_t * pMyData (*this); // Pointer to where search starts in me
2056  ULWord offset(0); // Search starts at this byte offset
2057  do
2058  {
2059  if (!::memcmp(pMyData, pSrchData, srchByteCount))
2060  {
2061  outOffsets.insert(offset); // Record byte offset of match
2062  if (inLimit && outOffsets.size() >= inLimit)
2063  break; // reached limit, early exit
2064  }
2065  pMyData++; // Bump search pointer
2066  offset++; // Bump search byte offset
2067  } while (offset < maxOffset);
2068  return outOffsets;
2069 }
2070 
2071 bool NTV2Buffer::IsContentEqual (const NTV2Buffer & inBuffer, const ULWord inByteOffset, const ULWord inByteCount) const
2072 {
2073  if (IsNULL() || inBuffer.IsNULL())
2074  return false; // Buffer(s) are NULL/empty
2075  if (inBuffer.GetByteCount() != GetByteCount())
2076  return false; // Buffers are different sizes
2077 
2078  ULWord totalBytes(GetByteCount());
2079  if (inByteOffset >= totalBytes)
2080  return false; // Bad offset
2081 
2082  totalBytes -= inByteOffset;
2083 
2084  ULWord byteCount(inByteCount);
2085  if (byteCount > totalBytes)
2086  byteCount = totalBytes;
2087 
2088  if (inBuffer.GetHostPointer() == GetHostPointer())
2089  return true; // Same buffer
2090 
2091  const UByte * pByte1 (*this);
2092  const UByte * pByte2 (inBuffer);
2093  pByte1 += inByteOffset;
2094  pByte2 += inByteOffset;
2095  #if !defined(NTV2BUFFER_NO_MEMCMP)
2096  return ::memcmp (pByte1, pByte2, byteCount) == 0;
2097  #else // NTV2BUFFER_NO_MEMCMP
2098  ULWord offset(inByteOffset);
2099  while (byteCount)
2100  {
2101  if (*pByte1 != *pByte2)
2102  {
2103  cerr << "## ERROR: IsContentEqual: miscompare at offset " << xHEX0N(offset,8)
2104  << " (" << DEC(offset) << "): " << xHEX0N(UWord(*pByte1),2) << " != "
2105  << xHEX0N(UWord(*pByte2),2) << ", " << xHEX0N(byteCount,8) << " ("
2106  << DEC(byteCount) << ") bytes left to compare" << endl;
2107  return false;
2108  }
2109  pByte1++; pByte2++;
2110  byteCount--;
2111  offset++;
2112  }
2113  return true;
2114  #endif // NTV2BUFFER_NO_MEMCMP
2115 }
2116 
2117 bool NTV2Buffer::NextDifference (const NTV2Buffer & inBuffer, ULWord & byteOffset) const
2118 {
2119  if (byteOffset == 0xFFFFFFFF)
2120  return false; // bad offset
2121  if (IsNULL() || inBuffer.IsNULL())
2122  return false; // NULL or empty buffers
2123  if (inBuffer.GetByteCount() != GetByteCount())
2124  return false; // Different byte counts
2125  if (inBuffer.GetHostPointer() == GetHostPointer())
2126  {byteOffset = 0xFFFFFFFF; return true;} // Same buffer
2127 
2128  ULWord totalBytesToCompare(GetByteCount());
2129  if (byteOffset >= totalBytesToCompare)
2130  return false; // Bad offset
2131  totalBytesToCompare -= byteOffset;
2132 
2133  const UByte * pByte1 (*this);
2134  const UByte * pByte2 (inBuffer);
2135  while (totalBytesToCompare)
2136  {
2137  if (pByte1[byteOffset] != pByte2[byteOffset])
2138  return true;
2139  totalBytesToCompare--;
2140  byteOffset++;
2141  }
2142  byteOffset = 0xFFFFFFFF;
2143  return true;
2144 }
2145 
2146 bool NTV2Buffer::GetRingChangedByteRange (const NTV2Buffer & inBuffer, ULWord & outByteOffsetFirst, ULWord & outByteOffsetLast) const
2147 {
2148  outByteOffsetFirst = outByteOffsetLast = GetByteCount ();
2149  if (IsNULL () || inBuffer.IsNULL ())
2150  return false; // NULL or empty
2151  if (inBuffer.GetByteCount () != GetByteCount ())
2152  return false; // Different byte counts
2153  if (inBuffer.GetHostPointer () == GetHostPointer ())
2154  return true; // Same buffer
2155  if (GetByteCount() < 3)
2156  return false; // Too small
2157 
2158  const UByte * pByte1 (reinterpret_cast <const UByte *> (GetHostPointer()));
2159  const UByte * pByte2 (reinterpret_cast <const UByte *> (inBuffer.GetHostPointer()));
2160 
2161  outByteOffsetFirst = 0;
2162  while (outByteOffsetFirst < GetByteCount())
2163  {
2164  if (*pByte1 != *pByte2)
2165  break;
2166  pByte1++;
2167  pByte2++;
2168  outByteOffsetFirst++;
2169  }
2170  if (outByteOffsetFirst == 0)
2171  {
2172  // Wrap case -- look for first match...
2173  while (outByteOffsetFirst < GetByteCount())
2174  {
2175  if (*pByte1 == *pByte2)
2176  break;
2177  pByte1++;
2178  pByte2++;
2179  outByteOffsetFirst++;
2180  }
2181  if (outByteOffsetFirst < GetByteCount())
2182  outByteOffsetFirst--;
2183  }
2184  if (outByteOffsetFirst == GetByteCount())
2185  return true; // Identical --- outByteOffsetFirst == outByteOffsetLast == GetByteCount()
2186 
2187  // Now scan from the end...
2188  pByte1 = reinterpret_cast <const UByte *> (GetHostPointer());
2189  pByte2 = reinterpret_cast <const UByte *> (inBuffer.GetHostPointer());
2190  pByte1 += GetByteCount () - 1; // Point to last byte
2191  pByte2 += GetByteCount () - 1;
2192  while (--outByteOffsetLast)
2193  {
2194  if (*pByte1 != *pByte2)
2195  break;
2196  pByte1--;
2197  pByte2--;
2198  }
2199  if (outByteOffsetLast == (GetByteCount() - 1))
2200  {
2201  // Wrap case -- look for first match...
2202  while (outByteOffsetLast)
2203  {
2204  if (*pByte1 == *pByte2)
2205  break;
2206  pByte1--;
2207  pByte2--;
2208  outByteOffsetLast--;
2209  }
2210  if (outByteOffsetLast < GetByteCount())
2211  outByteOffsetLast++;
2212  if (outByteOffsetLast <= outByteOffsetFirst)
2213  cerr << "## WARNING: GetRingChangedByteRange: last " << outByteOffsetLast << " <= first " << outByteOffsetFirst << " in wrap condition" << endl;
2214  const ULWord tmp (outByteOffsetLast);
2215  outByteOffsetLast = outByteOffsetFirst;
2216  outByteOffsetFirst = tmp;
2217  if (outByteOffsetLast >= outByteOffsetFirst)
2218  cerr << "## WARNING: GetRingChangedByteRange: last " << outByteOffsetLast << " >= first " << outByteOffsetFirst << " in wrap condition" << endl;
2219  }
2220  return true;
2221 
2222 } // GetRingChangedByteRange
2223 
2224 
2225 static size_t gDefaultPageSize (AJA_PAGE_SIZE);
2226 
2228 {
2229  return gDefaultPageSize;
2230 }
2231 
2232 bool NTV2Buffer::SetDefaultPageSize (const size_t inNewSize)
2233 {
2234  const bool result (inNewSize && (!(inNewSize & (inNewSize - 1))));
2235  if (result)
2236  gDefaultPageSize = inNewSize;
2237  return result;
2238 }
2239 
2241 {
2242 #if defined(MSWindows) || defined(AJABareMetal)
2243  return AJA_PAGE_SIZE;
2244 #else
2245  return size_t(::getpagesize());
2246 #endif
2247 }
2248 
2249 
2251  : acHeader (NTV2_TYPE_ACFRAMESTAMP, sizeof(FRAME_STAMP)),
2252  acFrameTime (0),
2253  acRequestedFrame (0),
2254  acAudioClockTimeStamp (0),
2255  acAudioExpectedAddress (0),
2256  acAudioInStartAddress (0),
2257  acAudioInStopAddress (0),
2258  acAudioOutStopAddress (0),
2259  acAudioOutStartAddress (0),
2260  acTotalBytesTransferred (0),
2261  acStartSample (0),
2262  acTimeCodes (NTV2_MAX_NUM_TIMECODE_INDEXES * sizeof (NTV2_RP188)),
2263  acCurrentTime (0),
2264  acCurrentFrame (0),
2265  acCurrentFrameTime (0),
2266  acAudioClockCurrentTime (0),
2267  acCurrentAudioExpectedAddress (0),
2268  acCurrentAudioStartAddress (0),
2269  acCurrentFieldCount (0),
2270  acCurrentLineCount (0),
2271  acCurrentReps (0),
2272  acCurrentUserCookie (0),
2273  acFrame (0),
2274  acRP188 ()
2275 {
2277 }
2278 
2279 
2281  : acHeader (inObj.acHeader),
2282  acFrameTime (inObj.acFrameTime),
2283  acRequestedFrame (inObj.acRequestedFrame),
2284  acAudioClockTimeStamp (inObj.acAudioClockTimeStamp),
2285  acAudioExpectedAddress (inObj.acAudioExpectedAddress),
2286  acAudioInStartAddress (inObj.acAudioInStartAddress),
2287  acAudioInStopAddress (inObj.acAudioInStopAddress),
2288  acAudioOutStopAddress (inObj.acAudioOutStopAddress),
2289  acAudioOutStartAddress (inObj.acAudioOutStartAddress),
2290  acTotalBytesTransferred (inObj.acTotalBytesTransferred),
2291  acStartSample (inObj.acStartSample),
2292  acCurrentTime (inObj.acCurrentTime),
2293  acCurrentFrame (inObj.acCurrentFrame),
2294  acCurrentFrameTime (inObj.acCurrentFrameTime),
2295  acAudioClockCurrentTime (inObj.acAudioClockCurrentTime),
2296  acCurrentAudioExpectedAddress (inObj.acCurrentAudioExpectedAddress),
2297  acCurrentAudioStartAddress (inObj.acCurrentAudioStartAddress),
2298  acCurrentFieldCount (inObj.acCurrentFieldCount),
2299  acCurrentLineCount (inObj.acCurrentLineCount),
2300  acCurrentReps (inObj.acCurrentReps),
2301  acCurrentUserCookie (inObj.acCurrentUserCookie),
2302  acFrame (inObj.acFrame),
2303  acRP188 (inObj.acRP188),
2304  acTrailer (inObj.acTrailer)
2305 {
2307 }
2308 
2309 
2311 {
2312 }
2313 
2314 
2316 {
2318  ULWord numRP188s (acTimeCodes.GetByteCount () / sizeof (NTV2_RP188));
2319  const NTV2_RP188 * pArray (reinterpret_cast <const NTV2_RP188 *> (acTimeCodes.GetHostPointer ()));
2320  outValues.clear ();
2321  if (!pArray)
2322  return false; // No 'acTimeCodes' array!
2323 
2324  if (numRP188s > NTV2_MAX_NUM_TIMECODE_INDEXES)
2325  numRP188s = NTV2_MAX_NUM_TIMECODE_INDEXES; // clamp to this max number
2326 
2327  for (ULWord ndx (0); ndx < numRP188s; ndx++)
2328  outValues << pArray [ndx];
2329 
2330  return true;
2331 }
2332 
2333 
2334 bool FRAME_STAMP::GetInputTimeCode (NTV2_RP188 & outTimeCode, const NTV2TCIndex inTCIndex) const
2335 {
2337  ULWord numRP188s (acTimeCodes.GetByteCount () / sizeof (NTV2_RP188));
2338  const NTV2_RP188 * pArray (reinterpret_cast <const NTV2_RP188 *> (acTimeCodes.GetHostPointer ()));
2339  outTimeCode.Set (); // invalidate
2340  if (!pArray)
2341  return false; // No 'acTimeCodes' array!
2342  if (numRP188s > NTV2_MAX_NUM_TIMECODE_INDEXES)
2343  numRP188s = NTV2_MAX_NUM_TIMECODE_INDEXES; // clamp to this max number
2344  if (!NTV2_IS_VALID_TIMECODE_INDEX (inTCIndex))
2345  return false;
2346 
2347  outTimeCode = pArray [inTCIndex];
2348  return true;
2349 }
2350 
2351 
2352 bool FRAME_STAMP::GetInputTimeCodes (NTV2TimeCodes & outTimeCodes, const NTV2Channel inSDIInput, const bool inValidOnly) const
2353 {
2355  outTimeCodes.clear();
2356 
2357  if (!NTV2_IS_VALID_CHANNEL(inSDIInput))
2358  return false; // Bad SDI input
2359 
2360  NTV2TimeCodeList allTCs;
2361  if (!GetInputTimeCodes(allTCs))
2362  return false; // GetInputTimeCodes failed
2363 
2364  const NTV2TCIndexes tcIndexes (GetTCIndexesForSDIInput(inSDIInput));
2365  for (NTV2TCIndexesConstIter iter(tcIndexes.begin()); iter != tcIndexes.end(); ++iter)
2366  {
2367  const NTV2TCIndex tcIndex(*iter);
2369  const NTV2_RP188 tc(allTCs.at(tcIndex));
2370  if (!inValidOnly)
2371  outTimeCodes[tcIndex] = tc;
2372  else if (tc.IsValid())
2373  outTimeCodes[tcIndex] = tc;
2374  }
2375  return true;
2376 }
2377 
2378 
2379 bool FRAME_STAMP::GetSDIInputStatus(NTV2SDIInputStatus & outStatus, const UWord inSDIInputIndex0) const
2380 {
2382  (void)outStatus;
2383  (void)inSDIInputIndex0;
2384  return true;
2385 }
2386 
2387 bool FRAME_STAMP::SetInputTimecode (const NTV2TCIndex inTCNdx, const NTV2_RP188 & inTimecode)
2388 {
2389  ULWord numRP188s (acTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2390  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acTimeCodes.GetHostPointer()));
2391  if (!pArray || !numRP188s)
2392  return false; // No 'acTimeCodes' array!
2393 
2394  if (numRP188s > NTV2_MAX_NUM_TIMECODE_INDEXES)
2395  numRP188s = NTV2_MAX_NUM_TIMECODE_INDEXES; // clamp to this max number
2396  if (ULWord(inTCNdx) >= numRP188s)
2397  return false; // Past end
2398 
2399  pArray[inTCNdx] = inTimecode; // Write the new value
2400  return true; // Success!
2401 }
2402 
2403 
2405 {
2406  if (this != &inRHS)
2407  {
2408  acTimeCodes = inRHS.acTimeCodes;
2409  acHeader = inRHS.acHeader;
2410  acFrameTime = inRHS.acFrameTime;
2419  acStartSample = inRHS.acStartSample;
2420  acCurrentTime = inRHS.acCurrentTime;
2428  acCurrentReps = inRHS.acCurrentReps;
2430  acFrame = inRHS.acFrame;
2431  acRP188 = inRHS.acRP188;
2432  acTrailer = inRHS.acTrailer;
2433  }
2434  return *this;
2435 }
2436 
2437 
2438 bool FRAME_STAMP::SetFrom (const FRAME_STAMP_STRUCT & inOldStruct)
2439 {
2441  //acCrosspoint = inOldStruct.channelSpec;
2442  acFrameTime = inOldStruct.frameTime;
2443  acRequestedFrame = inOldStruct.frame;
2450  acTotalBytesTransferred = inOldStruct.bytesRead;
2451  acStartSample = inOldStruct.startSample;
2452  acCurrentTime = inOldStruct.currentTime;
2453  acCurrentFrame = inOldStruct.currentFrame;
2454  acCurrentFrameTime = inOldStruct.currentFrameTime;
2458  acCurrentFieldCount = inOldStruct.currentFieldCount;
2459  acCurrentLineCount = inOldStruct.currentLineCount;
2460  acCurrentReps = inOldStruct.currentReps;
2461  acCurrentUserCookie = inOldStruct.currenthUser;
2462  acRP188 = NTV2_RP188 (inOldStruct.currentRP188);
2463  if (!acTimeCodes.IsNULL() && acTimeCodes.GetByteCount () >= sizeof (NTV2_RP188))
2464  {
2465  NTV2_RP188 * pTimecodes (reinterpret_cast <NTV2_RP188 *> (acTimeCodes.GetHostPointer ()));
2466  NTV2_ASSERT (pTimecodes);
2468  pTimecodes [NTV2_TCINDEX_DEFAULT] = acRP188;
2469  }
2470  return true;
2471 }
2472 
2473 
2474 bool FRAME_STAMP::CopyTo (FRAME_STAMP_STRUCT & outOldStruct) const
2475 {
2477  outOldStruct.frameTime = acFrameTime;
2478  outOldStruct.frame = acRequestedFrame;
2485  outOldStruct.bytesRead = acTotalBytesTransferred;
2486  outOldStruct.startSample = acStartSample;
2487  outOldStruct.currentTime = acCurrentTime;
2488  outOldStruct.currentFrame = acCurrentFrame;
2489  outOldStruct.currentFrameTime = acCurrentFrameTime;
2493  outOldStruct.currentFieldCount = acCurrentFieldCount;
2494  outOldStruct.currentLineCount = acCurrentLineCount;
2495  outOldStruct.currentReps = acCurrentReps;
2496  outOldStruct.currenthUser = ULWord(acCurrentUserCookie);
2497  outOldStruct.currentRP188 = acRP188;
2498  // Ticket 3367 -- Mark Gilbert of Gallery UK reports that after updating from AJA Retail Software 10.5 to 14.0,
2499  // their QuickTime app stopped receiving timecode during capture. Turns out the QuickTime components use the new
2500  // AutoCirculate APIs, but internally still use the old FRAME_STAMP_STRUCT for frame info, including timecode...
2501  // ...and only use the "currentRP188" field for the "retail" timecode.
2502  // Sadly, this FRAME_STAMP-to-FRAME_STAMP_STRUCT function historically only set "currentRP188" from the deprecated
2503  // (and completely unused) "acRP188" field, when it really should've been using the acTimeCodes[NTV2_TCINDEX_DEFAULT]
2504  // value all along...
2505  if (!acTimeCodes.IsNULL()) // If there's an acTimeCodes buffer...
2506  if (acTimeCodes.GetByteCount() >= sizeof(NTV2_RP188)) // ...and it has at least one timecode value...
2507  {
2508  const NTV2_RP188 * pDefaultTC (reinterpret_cast<const NTV2_RP188*>(acTimeCodes.GetHostPointer()));
2509  if (pDefaultTC)
2510  outOldStruct.currentRP188 = pDefaultTC[NTV2_TCINDEX_DEFAULT]; // Stuff the "default" (retail) timecode into "currentRP188".
2511  }
2512  return true;
2513 }
2514 
2515 
2516 string FRAME_STAMP::operator [] (const unsigned inIndexNum) const
2517 {
2518  ostringstream oss;
2519  NTV2_RP188 rp188;
2520  if (GetInputTimeCode (rp188, NTV2TimecodeIndex (inIndexNum)))
2521  {
2522  if (rp188.IsValid())
2523  {
2524  CRP188 foo (rp188);
2525  oss << foo;
2526  }
2527  else
2528  oss << "---";
2529  }
2530  else if (NTV2_IS_VALID_TIMECODE_INDEX (inIndexNum))
2531  oss << "---";
2532  return oss.str();
2533 }
2534 
2535 
2537  : mHeader(NTV2_TYPE_SDISTATS, sizeof(NTV2SDIInStatistics)),
2538  mInStatistics(NTV2_MAX_NUM_CHANNELS * sizeof(NTV2SDIInputStatus))
2539 {
2540  Clear();
2542 }
2543 
2545 {
2547  if (mInStatistics.IsNULL())
2548  return;
2549  NTV2SDIInputStatus * pArray(reinterpret_cast <NTV2SDIInputStatus *> (mInStatistics.GetHostPointer()));
2550  for (int i = 0; i < NTV2_MAX_NUM_CHANNELS; i++)
2551  pArray[i].Clear();
2552 }
2553 
2554 bool NTV2SDIInStatistics::GetSDIInputStatus(NTV2SDIInputStatus & outStatus, const UWord inSDIInputIndex0)
2555 {
2557  const ULWord numElements(mInStatistics.GetByteCount() / sizeof(NTV2SDIInputStatus));
2558  const NTV2SDIInputStatus * pArray(reinterpret_cast <const NTV2SDIInputStatus *> (mInStatistics.GetHostPointer()));
2559  outStatus.Clear();
2560  if (!pArray)
2561  return false;
2562  if (numElements != 8)
2563  return false;
2564  if (inSDIInputIndex0 >= numElements)
2565  return false;
2566  outStatus = pArray[inSDIInputIndex0];
2567  return true;
2568 }
2569 
2571 {
2573  static NTV2SDIInputStatus dummy;
2574  const ULWord numElements(mInStatistics.GetByteCount() / sizeof(NTV2SDIInputStatus));
2575  NTV2SDIInputStatus * pArray(reinterpret_cast<NTV2SDIInputStatus*>(mInStatistics.GetHostPointer()));
2576  if (!pArray)
2577  return dummy;
2578  if (numElements != 8)
2579  return dummy;
2580  if (inSDIInputIndex0 >= numElements)
2581  return dummy;
2582  return pArray[inSDIInputIndex0];
2583 }
2584 
2585 std::ostream & NTV2SDIInStatistics::Print(std::ostream & inOutStream) const
2586 {
2588  inOutStream << mHeader << ", " << mInStatistics << ", " << mTrailer; return inOutStream;
2589 }
2590 
2591 
2594  acState (NTV2_AUTOCIRCULATE_DISABLED),
2595  acTransferFrame (0),
2596  acBufferLevel (0),
2597  acFramesProcessed (0),
2598  acFramesDropped (0),
2599  acFrameStamp (),
2600  acAudioTransferSize (0),
2601  acAudioStartSample (0),
2602  acAncTransferSize (0),
2603  acAncField2TransferSize (0)
2604  //acTrailer ()
2605 {
2607 }
2608 
2609 
2611  : acHeader (NTV2_TYPE_ACSTATUS, sizeof (AUTOCIRCULATE_STATUS)),
2612  acCrosspoint (inCrosspoint),
2613  acState (NTV2_AUTOCIRCULATE_DISABLED),
2614  acStartFrame (0),
2615  acEndFrame (0),
2616  acActiveFrame (0),
2617  acRDTSCStartTime (0),
2618  acAudioClockStartTime (0),
2619  acRDTSCCurrentTime (0),
2620  acAudioClockCurrentTime (0),
2621  acFramesProcessed (0),
2622  acFramesDropped (0),
2623  acBufferLevel (0),
2624  acOptionFlags (0),
2625  acAudioSystem (NTV2_AUDIOSYSTEM_INVALID)
2626 {
2628 }
2629 
2630 
2632 {
2634  outOldStruct.channelSpec = acCrosspoint;
2635  outOldStruct.state = acState;
2636  outOldStruct.startFrame = acStartFrame;
2637  outOldStruct.endFrame = acEndFrame;
2638  outOldStruct.activeFrame = acActiveFrame;
2639  outOldStruct.rdtscStartTime = acRDTSCStartTime;
2641  outOldStruct.rdtscCurrentTime = acRDTSCCurrentTime;
2643  outOldStruct.framesProcessed = acFramesProcessed;
2644  outOldStruct.framesDropped = acFramesDropped;
2645  outOldStruct.bufferLevel = acBufferLevel;
2647  outOldStruct.bWithRP188 = acOptionFlags & AUTOCIRCULATE_WITH_RP188 ? 1 : 0;
2648  outOldStruct.bFbfChange = acOptionFlags & AUTOCIRCULATE_WITH_FBFCHANGE ? 1 : 0;
2649  outOldStruct.bFboChange = acOptionFlags & AUTOCIRCULATE_WITH_FBOCHANGE ? 1 : 0;
2651  outOldStruct.bWithVidProc = acOptionFlags & AUTOCIRCULATE_WITH_VIDPROC ? 1 : 0;
2652  outOldStruct.bWithCustomAncData = acOptionFlags & AUTOCIRCULATE_WITH_ANC ? 1 : 0;
2653  return true;
2654 }
2655 
2656 
2658 {
2660  acCrosspoint = inOldStruct.channelSpec;
2661  acState = inOldStruct.state;
2662  acStartFrame = inOldStruct.startFrame;
2663  acEndFrame = inOldStruct.endFrame;
2664  acActiveFrame = inOldStruct.activeFrame;
2665  acRDTSCStartTime = inOldStruct.rdtscStartTime;
2667  acRDTSCCurrentTime = inOldStruct.rdtscCurrentTime;
2669  acFramesProcessed = inOldStruct.framesProcessed;
2670  acFramesDropped = inOldStruct.framesDropped;
2671  acBufferLevel = inOldStruct.bufferLevel;
2672  acAudioSystem = NTV2_AUDIOSYSTEM_INVALID; // NTV2_AUDIOSYSTEM_1;
2673  acOptionFlags = (inOldStruct.bWithRP188 ? AUTOCIRCULATE_WITH_RP188 : 0) |
2674  (inOldStruct.bFbfChange ? AUTOCIRCULATE_WITH_FBFCHANGE : 0) |
2675  (inOldStruct.bFboChange ? AUTOCIRCULATE_WITH_FBOCHANGE : 0) |
2677  (inOldStruct.bWithVidProc ? AUTOCIRCULATE_WITH_VIDPROC : 0) |
2678  (inOldStruct.bWithCustomAncData ? AUTOCIRCULATE_WITH_ANC : 0);
2679  return true;
2680 }
2681 
2682 
2684 {
2688  acStartFrame = 0;
2689  acEndFrame = 0;
2690  acActiveFrame = 0;
2691  acRDTSCStartTime = 0;
2693  acRDTSCCurrentTime = 0;
2695  acFramesProcessed = 0;
2696  acFramesDropped = 0;
2697  acBufferLevel = 0;
2698  acOptionFlags = 0;
2700 }
2701 
2702 
2704 {
2706 }
2707 
2708 
2709 struct ThousandsSeparator : std::numpunct <char>
2710 {
2711  virtual inline char do_thousands_sep() const {return ',';}
2712  virtual inline std::string do_grouping() const {return "\03";}
2713 };
2714 
2715 
2716 template <class T> string CommaStr (const T & inNum)
2717 {
2718  ostringstream oss;
2719  const locale loc (oss.getloc(), new ThousandsSeparator);
2720  oss.imbue (loc);
2721  oss << inNum;
2722  return oss.str();
2723 } // CommaStr
2724 
2725 
2726 string AUTOCIRCULATE_STATUS::operator [] (const unsigned inIndexNum) const
2727 {
2728  ostringstream oss;
2729  if (inIndexNum == 0)
2731  else if (!IsStopped())
2732  switch (inIndexNum)
2733  {
2734  case 1: oss << DEC(GetStartFrame()); break;
2735  case 2: oss << DEC(GetEndFrame()); break;
2736  case 3: oss << DEC(GetFrameCount()); break;
2737  case 4: oss << DEC(GetActiveFrame()); break;
2738  case 5: oss << xHEX0N(acRDTSCStartTime,16); break;
2739  case 6: oss << xHEX0N(acAudioClockStartTime,16); break;
2740  case 7: oss << DEC(acRDTSCCurrentTime); break;
2741  case 8: oss << DEC(acAudioClockCurrentTime); break;
2742  case 9: oss << CommaStr(GetProcessedFrameCount()); break;
2743  case 10: oss << CommaStr(GetDroppedFrameCount()); break;
2744  case 11: oss << DEC(GetBufferLevel()); break;
2745  case 12: oss << ::NTV2AudioSystemToString(acAudioSystem, true); break;
2746  case 13: oss << (WithRP188() ? "Yes" : "No"); break;
2747  case 14: oss << (WithLTC() ? "Yes" : "No"); break;
2748  case 15: oss << (WithFBFChange() ? "Yes" : "No"); break;
2749  case 16: oss << (WithFBOChange() ? "Yes" : "No"); break;
2750  case 17: oss << (WithColorCorrect() ? "Yes" : "No"); break;
2751  case 18: oss << (WithVidProc() ? "Yes" : "No"); break;
2752  case 19: oss << (WithCustomAnc() ? "Yes" : "No"); break;
2753  case 20: oss << (WithHDMIAuxData() ? "Yes" : "No"); break;
2754  case 21: oss << (IsFieldMode() ? "Yes" : "No"); break;
2755  default: break;
2756  }
2757  else if (inIndexNum < 22)
2758  oss << "---";
2759  return oss.str();
2760 }
2761 
2762 
2763 ostream & operator << (ostream & oss, const AUTOCIRCULATE_STATUS & inObj)
2764 {
2765  if (!inObj.IsStopped())
2766  oss << ::NTV2ChannelToString(inObj.GetChannel(), true) << ": "
2767  << (inObj.IsInput() ? "Input " : (inObj.IsOutput() ? "Output" : "*BAD* "))
2768  << setw(12) << ::NTV2AutoCirculateStateToString(inObj.acState) << " "
2769  << setw( 5) << inObj.GetStartFrame()
2770  << setw( 6) << inObj.GetEndFrame()
2771  << setw( 6) << inObj.GetActiveFrame()
2772  << setw( 8) << inObj.GetProcessedFrameCount()
2773  << setw( 8) << inObj.GetDroppedFrameCount()
2774  << setw( 7) << inObj.GetBufferLevel()
2775  << setw(10) << ::NTV2AudioSystemToString(inObj.acAudioSystem, true)
2776  << setw(10) << (inObj.WithRP188() ? "+RP188" : "-RP188")
2777  << setw(10) << (inObj.WithLTC() ? "+LTC" : "-LTC")
2778  << setw(10) << (inObj.WithFBFChange() ? "+FBFchg" : "-FBFchg")
2779  << setw(10) << (inObj.WithFBOChange() ? "+FBOchg" : "-FBOchg")
2780  << setw(10) << (inObj.WithColorCorrect() ? "+ColCor" : "-ColCor")
2781  << setw(10) << (inObj.WithVidProc() ? "+VidProc" : "-VidProc")
2782  << setw(10) << (inObj.WithCustomAnc() ? "+AncData" : "-AncData")
2783  << setw(10) << (inObj.WithHDMIAuxData() ? "+HDMIAux" : "-HDMIAux")
2784  << setw(10) << (inObj.IsFieldMode() ? "+FldMode" : "-FldMode");
2785  return oss;
2786 }
2787 
2788 
2790 {
2791  Reset ();
2792 }
2793 
2794 
2795 NTV2SegmentedDMAInfo::NTV2SegmentedDMAInfo (const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow, const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
2796 {
2797  Set (inNumSegments, inNumActiveBytesPerRow, inHostBytesPerRow, inDeviceBytesPerRow);
2798 }
2799 
2800 
2801 void NTV2SegmentedDMAInfo::Set (const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow, const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
2802 {
2803  acNumSegments = inNumSegments;
2804  if (acNumSegments > 1)
2805  {
2806  acNumActiveBytesPerRow = inNumActiveBytesPerRow;
2807  acSegmentHostPitch = inHostBytesPerRow;
2808  acSegmentDevicePitch = inDeviceBytesPerRow;
2809  }
2810  else
2811  Reset ();
2812 }
2813 
2814 
2816 {
2818 }
2819 
2820 
2822  : ccMode (NTV2_CCMODE_INVALID),
2823  ccSaturationValue (0)
2824 {
2825 }
2826 
2827 
2829 {
2830  Clear ();
2831 }
2832 
2833 
2835 {
2837  ccSaturationValue = 0;
2839 }
2840 
2841 
2842 bool NTV2ColorCorrectionData::Set (const NTV2ColorCorrectionMode inMode, const ULWord inSaturation, const void * pInTableData)
2843 {
2844  Clear();
2846  return false;
2847 
2848  if (pInTableData)
2850  return false;
2851  ccMode = inMode;
2852  ccSaturationValue = (inMode == NTV2_CCMODE_3WAY) ? inSaturation : 0;
2853  return true;
2854 }
2855 
2856 
2858  : acHeader (NTV2_TYPE_ACXFER, sizeof(AUTOCIRCULATE_TRANSFER)),
2859  acOutputTimeCodes (NTV2_MAX_NUM_TIMECODE_INDEXES * sizeof (NTV2_RP188)),
2860  acTransferStatus (),
2861  acInUserCookie (0),
2862  acInVideoDMAOffset (0),
2863  acInSegmentedDMAInfo (),
2864  acColorCorrection (),
2865  acFrameBufferFormat (NTV2_FBF_10BIT_YCBCR),
2866  acFrameBufferOrientation (NTV2_FRAMEBUFFER_ORIENTATION_TOPDOWN),
2867  acVidProcInfo (),
2868  acVideoQuarterSizeExpand (NTV2_QuarterSizeExpandOff),
2869  acPeerToPeerFlags (0),
2870  acFrameRepeatCount (1),
2871  acDesiredFrame (-1),
2872  acRP188 (),
2873  acCrosspoint (NTV2CROSSPOINT_INVALID)
2874 {
2878 }
2879 
2880 
2881 AUTOCIRCULATE_TRANSFER::AUTOCIRCULATE_TRANSFER (ULWord * pInVideoBuffer, const ULWord inVideoByteCount, ULWord * pInAudioBuffer,
2882  const ULWord inAudioByteCount, ULWord * pInANCBuffer, const ULWord inANCByteCount,
2883  ULWord * pInANCF2Buffer, const ULWord inANCF2ByteCount)
2884  : acHeader (NTV2_TYPE_ACXFER, sizeof(AUTOCIRCULATE_TRANSFER)),
2885  acVideoBuffer (pInVideoBuffer, inVideoByteCount),
2886  acAudioBuffer (pInAudioBuffer, inAudioByteCount),
2887  acANCBuffer (pInANCBuffer, inANCByteCount),
2888  acANCField2Buffer (pInANCF2Buffer, inANCF2ByteCount),
2889  acOutputTimeCodes (NTV2_MAX_NUM_TIMECODE_INDEXES * sizeof (NTV2_RP188)),
2890  acTransferStatus (),
2891  acInUserCookie (0),
2892  acInVideoDMAOffset (0),
2893  acInSegmentedDMAInfo (),
2894  acColorCorrection (),
2895  acFrameBufferFormat (NTV2_FBF_10BIT_YCBCR),
2896  acFrameBufferOrientation (NTV2_FRAMEBUFFER_ORIENTATION_TOPDOWN),
2897  acVidProcInfo (),
2898  acVideoQuarterSizeExpand (NTV2_QuarterSizeExpandOff),
2899  acPeerToPeerFlags (0),
2900  acFrameRepeatCount (1),
2901  acDesiredFrame (-1),
2902  acRP188 (),
2903  acCrosspoint (NTV2CROSSPOINT_INVALID)
2904 {
2908 }
2909 
2910 
2912 {
2913 }
2914 
2915 
2916 bool AUTOCIRCULATE_TRANSFER::SetBuffers (ULWord * pInVideoBuffer, const ULWord inVideoByteCount,
2917  ULWord * pInAudioBuffer, const ULWord inAudioByteCount,
2918  ULWord * pInANCBuffer, const ULWord inANCByteCount,
2919  ULWord * pInANCF2Buffer, const ULWord inANCF2ByteCount)
2920 {
2922  return SetVideoBuffer (pInVideoBuffer, inVideoByteCount)
2923  && SetAudioBuffer (pInAudioBuffer, inAudioByteCount)
2924  && SetAncBuffers (pInANCBuffer, inANCByteCount, pInANCF2Buffer, inANCF2ByteCount);
2925 }
2926 
2927 
2928 bool AUTOCIRCULATE_TRANSFER::SetVideoBuffer (ULWord * pInVideoBuffer, const ULWord inVideoByteCount)
2929 {
2931  acVideoBuffer.Set (pInVideoBuffer, inVideoByteCount);
2932  return true;
2933 }
2934 
2935 
2936 bool AUTOCIRCULATE_TRANSFER::SetAudioBuffer (ULWord * pInAudioBuffer, const ULWord inAudioByteCount)
2937 {
2939  acAudioBuffer.Set (pInAudioBuffer, inAudioByteCount);
2940  return true;
2941 }
2942 
2943 
2944 bool AUTOCIRCULATE_TRANSFER::SetAncBuffers (ULWord * pInANCBuffer, const ULWord inANCByteCount, ULWord * pInANCF2Buffer, const ULWord inANCF2ByteCount)
2945 {
2947  acANCBuffer.Set (pInANCBuffer, inANCByteCount);
2948  acANCField2Buffer.Set (pInANCF2Buffer, inANCF2ByteCount);
2949  return true;
2950 }
2951 
2953 
2954 
2956 {
2958  ULWord maxNumValues (acOutputTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2959  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acOutputTimeCodes.GetHostPointer()));
2960  if (!pArray)
2961  return false;
2962  if (maxNumValues > NTV2_MAX_NUM_TIMECODE_INDEXES)
2963  maxNumValues = NTV2_MAX_NUM_TIMECODE_INDEXES;
2964 
2965  for (UWord ndx (0); ndx < UWord(maxNumValues); ndx++)
2966  {
2967  const NTV2TCIndex tcIndex (static_cast<NTV2TCIndex>(ndx));
2968  NTV2TimeCodesConstIter iter (inValues.find(tcIndex));
2969  pArray[ndx] = (iter != inValues.end()) ? iter->second : INVALID_TIMECODE_VALUE;
2970  } // for each possible NTV2TCSource value
2971  return true;
2972 }
2973 
2974 
2975 bool AUTOCIRCULATE_TRANSFER::SetOutputTimeCode (const NTV2_RP188 & inTimeCode, const NTV2TCIndex inTCIndex)
2976 {
2978  ULWord maxNumValues (acOutputTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2979  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acOutputTimeCodes.GetHostPointer()));
2980  if (!pArray)
2981  return false;
2982  if (maxNumValues > NTV2_MAX_NUM_TIMECODE_INDEXES)
2983  maxNumValues = NTV2_MAX_NUM_TIMECODE_INDEXES;
2984  if (!NTV2_IS_VALID_TIMECODE_INDEX(inTCIndex))
2985  return false;
2986 
2987  pArray[inTCIndex] = inTimeCode;
2988  return true;
2989 }
2990 
2991 bool AUTOCIRCULATE_TRANSFER::SetAllOutputTimeCodes (const NTV2_RP188 & inTimeCode, const bool inIncludeF2)
2992 {
2994  ULWord maxNumValues (acOutputTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2995  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acOutputTimeCodes.GetHostPointer()));
2996  if (!pArray)
2997  return false;
2998  if (maxNumValues > NTV2_MAX_NUM_TIMECODE_INDEXES)
2999  maxNumValues = NTV2_MAX_NUM_TIMECODE_INDEXES;
3000 
3001  for (ULWord tcIndex(0); tcIndex < maxNumValues; tcIndex++)
3002  if (NTV2_IS_ATC_VITC2_TIMECODE_INDEX(tcIndex))
3003  pArray[tcIndex] = inIncludeF2 ? inTimeCode : INVALID_TIMECODE_VALUE;
3004  else
3005  pArray[tcIndex] = inTimeCode;
3006  return true;
3007 }
3008 
3009 
3011 {
3013  if (!NTV2_IS_VALID_FRAME_BUFFER_FORMAT (inNewFormat))
3014  return false;
3015  acFrameBufferFormat = inNewFormat;
3016  return true;
3017 }
3018 
3019 
3021 {
3023  SetBuffers (AJA_NULL, 0, AJA_NULL, 0, AJA_NULL, 0, AJA_NULL, 0);
3024 }
3025 
3026 
3027 bool AUTOCIRCULATE_TRANSFER::EnableSegmentedDMAs (const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow,
3028  const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
3029 {
3031  // Cannot allow segmented DMAs if video buffer was self-allocated by the SDK, since the video buffer size holds the segment size (in bytes)...
3033  return false; // Disallow
3034  acInSegmentedDMAInfo.Set (inNumSegments, inNumActiveBytesPerRow, inHostBytesPerRow, inDeviceBytesPerRow);
3035  return true;
3036 }
3037 
3038 
3040 {
3043  return true;
3044 }
3045 
3046 
3048 {
3051 }
3052 
3053 
3055 {
3057  return acTransferStatus.acFrameStamp.GetInputTimeCodes (outValues);
3058 }
3059 
3060 
3061 bool AUTOCIRCULATE_TRANSFER::GetInputTimeCode (NTV2_RP188 & outTimeCode, const NTV2TCIndex inTCIndex) const
3062 {
3064  return acTransferStatus.acFrameStamp.GetInputTimeCode (outTimeCode, inTCIndex);
3065 }
3066 
3067 
3068 bool AUTOCIRCULATE_TRANSFER::GetInputTimeCodes (NTV2TimeCodes & outTimeCodes, const NTV2Channel inSDIInput, const bool inValidOnly) const
3069 {
3071  return acTransferStatus.acFrameStamp.GetInputTimeCodes (outTimeCodes, inSDIInput, inValidOnly);
3072 }
3073 
3074 
3076  : mHeader (NTV2_TYPE_AJADEBUGLOGGING, sizeof (NTV2DebugLogging)),
3077  mSharedMemory (inEnable ? AJADebug::GetPrivateDataLoc() : AJA_NULL, inEnable ? AJADebug::GetPrivateDataLen() : 0)
3078 {
3079 }
3080 
3081 
3082 ostream & NTV2DebugLogging::Print (ostream & inOutStream) const
3083 {
3085  inOutStream << mHeader << " shMem=" << mSharedMemory << " " << mTrailer;
3086  return inOutStream;
3087 }
3088 
3089 
3090 
3092  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3093 {
3095  SetFlags(0);
3096  SetMaxLockSize(0);
3097 }
3098 
3099 NTV2BufferLock::NTV2BufferLock (const NTV2Buffer & inBuffer, const ULWord inFlags)
3100  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3101 {
3103  SetBuffer(inBuffer);
3104  SetFlags(inFlags);
3105  SetMaxLockSize(0);
3106 }
3107 
3108 NTV2BufferLock::NTV2BufferLock(const ULWord * pInBuffer, const ULWord inByteCount, const ULWord inFlags)
3109  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3110 {
3112  SetBuffer (NTV2Buffer(pInBuffer, inByteCount));
3113  SetFlags (inFlags);
3114  SetMaxLockSize(0);
3115 }
3116 
3117 NTV2BufferLock::NTV2BufferLock(const ULWord64 inMaxLockSize, const ULWord inFlags)
3118  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3119 {
3121  SetBuffer (NTV2Buffer());
3122  SetFlags (inFlags);
3123  SetMaxLockSize(inMaxLockSize);
3124 }
3125 
3126 bool NTV2BufferLock::SetBuffer (const NTV2Buffer & inBuffer)
3127 { // Just use address & length (don't deep copy)...
3129  return mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
3130 }
3131 
3132 ostream & NTV2BufferLock::Print (ostream & inOutStream) const
3133 {
3135  inOutStream << mHeader << mBuffer << " flags=" << xHEX0N(mFlags,8) << " " << mTrailer;
3136  return inOutStream;
3137 }
3138 
3139 
3141  : mHeader (NTV2_TYPE_AJABITSTREAM, sizeof(NTV2Bitstream))
3142 {
3144 }
3145 
3146 NTV2Bitstream::NTV2Bitstream (const NTV2Buffer & inBuffer, const ULWord inFlags)
3147  : mHeader (NTV2_TYPE_AJABITSTREAM, sizeof(NTV2Bitstream))
3148 {
3150  SetBuffer(inBuffer);
3151  SetFlags(inFlags);
3152 }
3153 
3154 NTV2Bitstream::NTV2Bitstream(const ULWord * pInBuffer, const ULWord inByteCount, const ULWord inFlags)
3155  : mHeader (NTV2_TYPE_AJABITSTREAM, sizeof(NTV2Bitstream))
3156 {
3158  SetBuffer (NTV2Buffer(pInBuffer, inByteCount));
3159  SetFlags (inFlags);
3160 }
3161 
3162 bool NTV2Bitstream::SetBuffer (const NTV2Buffer & inBuffer)
3163 { // Just use address & length (don't deep copy)...
3165  return mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
3166 }
3167 
3168 ostream & NTV2Bitstream::Print (ostream & inOutStream) const
3169 {
3171  inOutStream << mHeader << mBuffer << " flags=" << xHEX0N(mFlags,8) << " " << mTrailer;
3172  return inOutStream;
3173 }
3174 
3176  : mHeader (NTV2_TYPE_AJASTREAMCHANNEL, sizeof(NTV2StreamChannel))
3177 {
3179 }
3180 
3181 ostream & NTV2StreamChannel::Print (ostream & inOutStream) const
3182 {
3184  inOutStream << mHeader << mChannel << " flags=" << xHEX0N(mFlags,8) << xHEX0N(mStatus, 8) << " " << mTrailer;
3185  return inOutStream;
3186 }
3187 
3189  : mHeader (NTV2_TYPE_AJASTREAMBUFFER, sizeof(NTV2StreamBuffer))
3190 {
3192 }
3193 
3194 ostream & NTV2StreamBuffer::Print (ostream & inOutStream) const
3195 {
3197  inOutStream << mHeader << mChannel << " flags=" << xHEX0N(mFlags,8) << xHEX0N(mStatus, 8) << " " << mTrailer;
3198  return inOutStream;
3199 }
3200 
3202  : mHeader (NTV2_TYPE_AJAMAILBUFFER, sizeof(NTV2MailBuffer))
3203 {
3205 }
3206 
3207 ostream & NTV2MailBuffer::Print (ostream & inOutStream) const
3208 {
3210  inOutStream << mHeader << mChannel << " flags=" << xHEX0N(mFlags,8) << xHEX0N(mStatus, 8) << " " << mTrailer;
3211  return inOutStream;
3212 }
3213 
3215  : mHeader (NTV2_TYPE_GETREGS, sizeof(NTV2GetRegisters)),
3216  mInNumRegisters (ULWord (inRegisterNumbers.size ())),
3217  mOutNumRegisters (0)
3218 {
3220  ResetUsing (inRegisterNumbers);
3221 }
3222 
3223 
3225  : mHeader (NTV2_TYPE_GETREGS, sizeof(NTV2GetRegisters)),
3226  mInNumRegisters (ULWord (inRegReads.size ())),
3227  mOutNumRegisters (0)
3228 {
3230  ResetUsing (inRegReads);
3231 }
3232 
3233 
3234 bool NTV2GetRegisters::ResetUsing (const NTV2RegNumSet & inRegisterNumbers)
3235 {
3237  mInNumRegisters = ULWord(inRegisterNumbers.size());
3238  mOutNumRegisters = 0;
3239  bool result ( mInRegisters.Allocate(mInNumRegisters * sizeof(ULWord))
3240  && mOutGoodRegisters.Allocate(mInNumRegisters * sizeof(ULWord))
3241  && mOutValues.Allocate(mInNumRegisters * sizeof(ULWord)));
3242  if (!result)
3243  return false;
3244  mInRegisters.Fill(ULWord(0)); mOutGoodRegisters.Fill(ULWord(0)); mOutValues.Fill(ULWord(0));
3245 
3246  ULWord * pRegArray(mInRegisters);
3247  if (!pRegArray)
3248  return false;
3249 
3250  ULWord ndx(0);
3251  for (NTV2RegNumSetConstIter iter(inRegisterNumbers.begin()); iter != inRegisterNumbers.end(); ++iter)
3252  pRegArray[ndx++] = *iter;
3253  return (ndx * sizeof(ULWord)) == mInRegisters.GetByteCount();
3254 }
3255 
3257 {
3258  outRegNums.clear();
3259  if (!mInNumRegisters)
3260  return true; // None requested
3261  if (!mInRegisters)
3262  return false; // Empty/NULL reg num buffer
3263  if (mInRegisters.GetByteCount()/4 < mInNumRegisters)
3264  return false; // Sanity check failed: Reg num buffer too small
3265 
3266  const ULWord * pRegNums(mInRegisters);
3267  for (ULWord ndx(0); ndx < mInNumRegisters; ndx++)
3268  if (outRegNums.find(pRegNums[ndx]) == outRegNums.end())
3269  outRegNums.insert(pRegNums[ndx]);
3270  return true;
3271 }
3272 
3273 
3275 {
3277  outGoodRegNums.clear();
3278  if (!mOutGoodRegisters)
3279  return false; // Empty/NULL 'mOutGoodRegisters' array!
3280  if (!mOutNumRegisters)
3281  return false; // The driver says zero successfully read!
3282  if (mOutNumRegisters > mInNumRegisters)
3283  return false; // Sanity check failed: mOutNumRegisters must be less than or equal to mInNumRegisters!
3284 
3285  const ULWord * pRegArray (mOutGoodRegisters);
3286  for (ULWord ndx(0); ndx < mOutNumRegisters; ndx++)
3287  outGoodRegNums.insert(pRegArray[ndx]);
3288  return true;
3289 }
3290 
3292 {
3294  outBadRegNums.clear();
3295  NTV2RegNumSet reqRegNums, goodRegNums;
3296  if (!GetRequestedRegisterNumbers(reqRegNums))
3297  return false;
3298  if (!GetGoodRegisters(goodRegNums))
3299  return false;
3300  if (reqRegNums == goodRegNums)
3301  return true; // Requested reg nums identical to those that were read successfully
3302 
3303  // Subtract goodRegNums from reqRegNums...
3304  std::set_difference (reqRegNums.begin(), reqRegNums.end(),
3305  goodRegNums.begin(), goodRegNums.end(),
3306  std::inserter(outBadRegNums, outBadRegNums.begin()));
3307  return true;
3308 }
3309 
3310 bool NTV2GetRegisters::PatchRegister (const ULWord inRegNum, const ULWord inValue)
3311 {
3312  if (!mOutGoodRegisters)
3313  return false; // Empty/null 'mOutGoodRegisters' array!
3314  if (!mOutNumRegisters)
3315  return false; // Driver says zero successfully read!
3316  if (mOutNumRegisters > mInNumRegisters)
3317  return false; // Sanity check failed: mOutNumRegisters must be less than or equal to mInNumRegisters!
3318  if (!mOutValues)
3319  return false; // Empty/null 'mOutValues' array!
3320  if (mOutGoodRegisters.GetByteCount() != mOutValues.GetByteCount())
3321  return false; // Sanity check failed: These sizes should match
3322  const ULWord * pRegArray (mOutGoodRegisters);
3323  ULWord * pValArray (mOutValues);
3324  for (ULWord ndx(0); ndx < mOutNumRegisters; ndx++)
3325  if (pRegArray[ndx] == inRegNum)
3326  {
3327  pValArray[ndx] = inValue;
3328  return true;
3329  }
3330  return false; // Not found
3331 }
3332 
3333 
3335 {
3337  outValues.clear ();
3338  if (!mOutGoodRegisters)
3339  return false; // Empty/null 'mOutGoodRegisters' array!
3340  if (!mOutNumRegisters)
3341  return false; // Driver says zero successfully read!
3342  if (mOutNumRegisters > mInNumRegisters)
3343  return false; // Sanity check failed: mOutNumRegisters must be less than or equal to mInNumRegisters!
3344  if (!mOutValues)
3345  return false; // Empty/null 'mOutValues' array!
3346  if (mOutGoodRegisters.GetByteCount() != mOutValues.GetByteCount())
3347  return false; // Sanity check failed: These sizes should match
3348 
3349  const ULWord * pRegArray (mOutGoodRegisters);
3350  const ULWord * pValArray (mOutValues);
3351  for (ULWord ndx(0); ndx < mOutNumRegisters; ndx++)
3352  {
3353  outValues [pRegArray[ndx]] = pValArray[ndx];
3354 #if defined(NTV2_PRETEND_DEVICE)
3355  if (pRegArray[ndx] == kRegBoardID && pValArray[ndx] == NTV2_PRETEND_DEVICE_FROM)
3356  outValues [pRegArray[ndx]] = NTV2_PRETEND_DEVICE_TO;
3357 // else if (pRegArray[ndx] == kRegReserved83 || pRegArray[ndx] == kRegLPRJ45IP)
3358 // outValues [pRegArray[ndx]] = 0x0A03FAD9; // Local IPv4 10.3.250.217
3359 #endif // NTV2_PRETEND_DEVICE
3360  }
3361  return true;
3362 }
3363 
3364 
3366 {
3367  NTV2RegisterValueMap regValMap;
3368  if (!GetRegisterValues(regValMap))
3369  return false;
3370 
3371  if (outValues.empty())
3372  {
3373  for (NTV2RegValueMapConstIter it(regValMap.begin()); it != regValMap.end(); ++it)
3374  {
3375  NTV2RegInfo regInfo(/*regNum*/it->first, /*regVal*/it->second);
3376 #if defined(NTV2_PRETEND_DEVICE)
3377  if (regInfo.regNum() == kRegBoardID && regInfo.value() == NTV2_PRETEND_DEVICE_FROM)
3378  regInfo.setValue(NTV2_PRETEND_DEVICE_TO);
3379 // else if (regInfo.regNum() == kRegReserved83 || regInfo.regNum() == kRegLPRJ45IP)
3380 // regInfo.setValue(0x0A03FAD9); // Local IPv4 10.3.250.217
3381 #endif // NTV2_PRETEND_DEVICE
3382  outValues.push_back(regInfo);
3383  }
3384  return true;
3385  }
3386  else
3387  {
3388  uint32_t missingTally(0);
3389  for (NTV2RegisterReadsIter it (outValues.begin()); it != outValues.end(); ++it)
3390  {
3391  NTV2RegValueMapConstIter mapIter(regValMap.find(it->registerNumber));
3392  if (mapIter != regValMap.end())
3393  it->registerValue = mapIter->second;
3394  else
3395  missingTally++; // Missing register
3396 
3397 #if defined(NTV2_PRETEND_DEVICE) // Fake KONAIP25G from C4412G (see also CNTV2XXXXDriverInterface::ReadRegister):
3398  if (it->registerNumber == kRegBoardID && it->registerValue == NTV2_PRETEND_DEVICE_FROM)
3399  it->registerValue = NTV2_PRETEND_DEVICE_TO;
3400 // else if (it->registerNumber == kRegReserved83 || it->registerNumber == kRegLPRJ45IP)
3401 // it->registerValue = 0x0A03FAD9; // Local IPv4 10.3.250.217
3402 #endif // NTV2_PRETEND_DEVICE
3403  }
3404  return !missingTally;
3405  }
3406 }
3407 
3408 
3409 ostream & NTV2GetRegisters::Print (ostream & inOutStream) const
3410 {
3411  inOutStream << mHeader << ", numRegs=" << mInNumRegisters << ", inRegs=" << mInRegisters << ", outNumGoodRegs=" << mOutNumRegisters
3412  << ", outGoodRegs=" << mOutGoodRegisters << ", outValues=" << mOutValues << ", " << mTrailer;
3413  return inOutStream;
3414 }
3415 
3416 
3418  : mHeader (NTV2_TYPE_SETREGS, sizeof(NTV2SetRegisters)),
3419  mInNumRegisters (ULWord(inRegWrites.size())),
3420  mOutNumFailures (0)
3421 {
3422  ResetUsing(inRegWrites);
3423 }
3424 
3425 
3427 {
3429  mInNumRegisters = ULWord(inRegWrites.size());
3430  mOutNumFailures = 0;
3431  const bool result (mInRegInfos.Allocate (mInNumRegisters * sizeof(NTV2RegInfo))
3433  if (!result)
3434  return false;
3435 
3436  ULWord ndx (0);
3437  NTV2RegInfo * pRegInfoArray (mInRegInfos);
3438  UWord * pBadRegIndexes (mOutBadRegIndexes);
3439 
3440  for (NTV2RegisterWritesConstIter it(inRegWrites.begin()); it != inRegWrites.end(); ++it)
3441  {
3442  if (pBadRegIndexes)
3443  pBadRegIndexes[ndx] = 0;
3444  if (pRegInfoArray)
3445  pRegInfoArray[ndx++] = *it;
3446  }
3447  NTV2_ASSERT((ndx * sizeof(NTV2RegInfo)) == mInRegInfos.GetByteCount());
3448  NTV2_ASSERT((ndx * sizeof(UWord)) == mOutBadRegIndexes.GetByteCount());
3449  return result;
3450 }
3451 
3452 
3454 {
3456  outFailedRegWrites.clear();
3457  return true;
3458 }
3459 
3461 {
3462  outRegWrites.clear();
3463  if (!mInNumRegisters)
3464  return false;
3465  if (!mInRegInfos)
3466  return false;
3467 
3468  outRegWrites.reserve(size_t(mInNumRegisters));
3469  const NTV2RegInfo * pRegInfos(mInRegInfos);
3470  for (ULWord ndx(0); ndx < mInNumRegisters; ndx++)
3471  outRegWrites.push_back(pRegInfos[ndx]);
3472  return true;
3473 }
3474 
3475 ostream & NTV2SetRegisters::Print (ostream & oss) const
3476 {
3478  oss << mHeader << ": numRegs=" << mInNumRegisters << " inRegInfos=" << mInRegInfos << " numFailures=" << DEC(mOutNumFailures)
3479  << " outBadRegIndexes=" << mOutBadRegIndexes << ": " << mTrailer;
3480  const UWord * pBadRegIndexes (mOutBadRegIndexes);
3481  const UWord maxNumBadRegIndexes (UWord(mOutBadRegIndexes.GetByteCount() / sizeof(UWord)));
3482  const NTV2RegInfo * pRegInfoArray (mInRegInfos);
3483  const UWord maxNumRegInfos (UWord(mInRegInfos.GetByteCount() / sizeof(NTV2RegInfo)));
3484  if (pBadRegIndexes && maxNumBadRegIndexes && pRegInfoArray && maxNumRegInfos && mOutNumFailures)
3485  {
3486  oss << endl;
3487  for (UWord num(0); num < maxNumBadRegIndexes; num++)
3488  {
3489  const UWord badRegIndex (pBadRegIndexes[num]);
3490  if (badRegIndex < maxNumRegInfos)
3491  {
3492  const NTV2RegInfo & badRegInfo (pRegInfoArray[badRegIndex]);
3493  oss << "Failure " << num << ": " << badRegInfo << endl;
3494  }
3495  }
3496  }
3497  return oss;
3498 }
3499 
3500 
3501 bool NTV2RegInfo::operator < (const NTV2RegInfo & inRHS) const
3502 {
3503  typedef std::pair <ULWord, ULWord> ULWordPair;
3504  typedef std::pair <ULWordPair, ULWordPair> ULWordPairs;
3505  const ULWordPairs rhs (ULWordPair (inRHS.registerNumber, inRHS.registerValue), ULWordPair (inRHS.registerMask, inRHS.registerShift));
3506  const ULWordPairs mine(ULWordPair (registerNumber, registerValue), ULWordPair (registerMask, registerShift));
3507  return mine < rhs;
3508 }
3509 
3510 ostream & NTV2RegInfo::Print (ostream & oss, const bool inAsCode) const
3511 {
3512  if (inAsCode)
3513  return PrintCode(oss);
3515  oss << "[" << regName << "|" << DEC(registerNumber) << ": val=" << xHEX0N(registerValue,8);
3516  if (registerMask != 0xFFFFFFFF)
3517  oss << " msk=" << xHEX0N(registerMask,8);
3518  if (registerShift)
3519  oss << " shf=" << DEC(registerShift);
3520  return oss << "]";
3521 }
3522 
3523 ostream & NTV2RegInfo::PrintCode (ostream & oss, const int inRadix, const NTV2DeviceID inDeviceID, const string & sCard) const
3524 {
3526  const bool readOnly (CNTV2RegisterExpert::IsReadOnly(registerNumber));
3527  const bool badName (regName.find(' ') != string::npos);
3528  if (readOnly)
3529  oss << "//\t";
3530  oss << sCard << ".WriteRegister (";
3531  if (badName)
3532  oss << DEC(registerNumber);
3533  else
3534  oss << regName;
3535  switch (inRadix)
3536  {
3537  case 2: oss << ", " << BIN032(registerValue); break;
3538  case 8: oss << ", " << OCT(registerValue); break;
3539  case 10: oss << ", " << DEC(registerValue); break;
3540  default: oss << ", " << xHEX0N(registerValue,8); break;
3541  }
3542  if (registerMask != 0xFFFFFFFF)
3543  switch (inRadix)
3544  {
3545  case 2: oss << ", " << BIN032(registerMask); break;
3546  case 8: oss << ", " << OCT(registerMask); break;
3547  case 10: oss << ", " << DEC(registerMask); break;
3548  default: oss << ", " << xHEX0N(registerMask,8); break;
3549  }
3550  if (registerShift)
3551  oss << ", " << DEC(registerShift);
3552  oss << "); // ";
3553  if (badName)
3554  oss << regName;
3555  else
3556  oss << "Reg " << DEC(registerNumber);
3557  // Decode the reg value...
3559  if (!info.empty()) // and add to end of comment
3560  oss << " // " << aja::replace(info, "\n", ", ");
3561  return oss;
3562 }
3563 
3564 ostream & NTV2RegInfo::PrintLog (ostream & oss, const NTV2DeviceID inDeviceID) const
3565 {
3566  const string name ((regNum() < VIRTUALREG_START) || (regNum() > kVRegLast) ? "Register" : "VReg");
3567  oss << name << " Name: " << CNTV2RegisterExpert::GetDisplayName(regNum()) << endl
3568  << name << " Number: " << regNum() << endl
3569  << name << " Value: " << value() << " : " << xHEX0N(value(),8);
3570  //<< "Register Classes: " << CNTV2RegisterExpert::GetRegisterClasses(regNum()) << endl
3571  const string sVal(CNTV2RegisterExpert::GetDisplayValue (regNum(), value(), inDeviceID));
3572 // if (!sVal.empty()) // stay compatible with older supportlogs
3573  oss << endl
3574  << sVal << endl;
3575  return oss;
3576 }
3577 
3579 {
3580  ULWord received(0), rcvdRegNum(0), rcvdRegVal(0); // what was received
3581  static const string sNumber (" Number: "), sValue (" Value: "), sHexPrefix(" : 0x");
3582  for (size_t ndx(0); ndx < inLogLines.size(); ndx++)
3583  {
3584  string line (inLogLines.at(ndx));
3585  size_t posNumber (line.find(sNumber));
3586  if (posNumber != string::npos)
3587  { // e.g. "VReg Number: 10394" pos=4, then 4+9=13
3588  if (received & 0x0001)
3589  continue; // uh-oh, already received "Number:"
3590  line.erase(0, posNumber + sNumber.length()); // only decimal number should remain
3591  if (!aja::is_legal_decimal_number (line, line.length()))
3592  continue; // missing decimal register number, keep looking
3593  rcvdRegNum = aja::stoull(line); // Read the reg number
3594  received |= 0x00000001; // received register number
3595  continue;
3596  } // if " Number: " found
3597  size_t posValue(inLogLines.at(ndx).find(sValue));
3598  if (posValue != string::npos)
3599  { // e.g. "VReg Value: 13966 : 0x0000368E"
3600  if (received & 0x0002)
3601  continue; // uh-oh, already received "Value:"
3602  posValue += sValue.length();
3603  line.erase(0, posValue + sValue.length()); // remainder: "13966 : 0x0000368E"
3604  aja::strip(line); aja::lower(line); // strip any remaining whitespace, then force lower case
3605  // Check for non-hex digits...
3606  size_t numHexDigits(0);
3607  for (size_t ndx(0); ndx < line.size(); ndx++)
3608  if (aja::is_hex_digit(line.at(ndx)))
3609  numHexDigits++;
3610  if (numHexDigits != line.length())
3611  continue; // mismatch indicates bad hex digit(s), keep looking
3612  // Read the value...
3613  istringstream iss(line);
3614  iss >> std::hex >> rcvdRegVal;
3615  received |= 0x0002; // received register value
3616  continue;
3617  } // if " Value: " found
3618  } // for each line
3619  if (received == 3)
3620  setRegNum(rcvdRegNum).setValue(rcvdRegVal).setMask(0xFFFFFFFF).setShift(0);
3621  return received == 3; // success if we got both " Number: " and " Value: "
3622 } // ImportFromLog
3623 
3624 
3625 ostream & NTV2PrintULWordVector (const NTV2ULWordVector & inObj, ostream & inOutStream)
3626 {
3627  for (NTV2ULWordVector::const_iterator it(inObj.begin()); it != inObj.end(); ++it)
3628  inOutStream << " " << HEX0N(*it,8);
3629  return inOutStream;
3630 }
3631 
3632 
3633 ostream & NTV2PrintChannelList (const NTV2ChannelList & inObj, const bool inCompact, ostream & inOutStream)
3634 {
3635  inOutStream << (inCompact ? "Ch[" : "[");
3636  for (NTV2ChannelListConstIter it(inObj.begin()); it != inObj.end(); )
3637  {
3638  if (inCompact)
3639  inOutStream << DEC(*it+1);
3640  else
3641  inOutStream << ::NTV2ChannelToString(*it);
3642  if (++it != inObj.end())
3643  inOutStream << (inCompact ? "|" : ",");
3644  }
3645  return inOutStream << "]";
3646 }
3647 
3648 string NTV2ChannelListToStr (const NTV2ChannelList & inObj, const bool inCompact)
3649 { ostringstream oss;
3650  ::NTV2PrintChannelList (inObj, inCompact, oss);
3651  return oss.str();
3652 }
3653 
3654 ostream & NTV2PrintChannelSet (const NTV2ChannelSet & inObj, const bool inCompact, ostream & inOutStream)
3655 {
3656  inOutStream << (inCompact ? "Ch{" : "{");
3657  for (NTV2ChannelSetConstIter it(inObj.begin()); it != inObj.end(); )
3658  {
3659  if (inCompact)
3660  inOutStream << DEC(*it+1);
3661  else
3662  inOutStream << ::NTV2ChannelToString(*it);
3663  if (++it != inObj.end())
3664  inOutStream << (inCompact ? "|" : ",");
3665  }
3666  return inOutStream << "}";
3667 }
3668 
3669 string NTV2ChannelSetToStr (const NTV2ChannelSet & inObj, const bool inCompact)
3670 { ostringstream oss;
3671  ::NTV2PrintChannelSet (inObj, inCompact, oss);
3672  return oss.str();
3673 }
3674 
3675 NTV2ChannelSet NTV2MakeChannelSet (const NTV2Channel inFirstChannel, const UWord inNumChannels)
3676 {
3677  NTV2ChannelSet result;
3678  for (NTV2Channel ch(inFirstChannel); ch < NTV2Channel(inFirstChannel+inNumChannels); ch = NTV2Channel(ch+1))
3679  if (NTV2_IS_VALID_CHANNEL(ch))
3680  result.insert(ch);
3681  return result;
3682 }
3683 
3685 {
3686  NTV2ChannelSet result;
3687  for (NTV2ChannelListConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
3688  result.insert(*it);
3689  return result;
3690 }
3691 
3692 NTV2ChannelList NTV2MakeChannelList (const NTV2Channel inFirstChannel, const UWord inNumChannels)
3693 {
3694  NTV2ChannelList result;
3695  for (NTV2Channel ch(inFirstChannel); ch < NTV2Channel(inFirstChannel+inNumChannels); ch = NTV2Channel(ch+1))
3696  if (NTV2_IS_VALID_CHANNEL(ch))
3697  result.push_back(ch);
3698  return result;
3699 }
3700 
3702 {
3703  NTV2ChannelList result;
3704  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
3705  result.push_back(*it);
3706  return result;
3707 }
3708 
3709 ostream & NTV2PrintAudioSystemSet (const NTV2AudioSystemSet & inObj, const bool inCompact, std::ostream & inOutStream)
3710 {
3711  inOutStream << (inCompact ? "AudSys{" : "{");
3712  for (NTV2AudioSystemSetConstIter it(inObj.begin()); it != inObj.end(); )
3713  {
3714  if (inCompact)
3715  inOutStream << DEC(*it+1);
3716  else
3717  inOutStream << ::NTV2AudioSystemToString(*it);
3718  if (++it != inObj.end())
3719  inOutStream << (inCompact ? "|" : ",");
3720  }
3721  return inOutStream << "}";
3722 }
3723 
3724 string NTV2AudioSystemSetToStr (const NTV2AudioSystemSet & inObj, const bool inCompact)
3725 { ostringstream oss;
3726  ::NTV2PrintAudioSystemSet (inObj, inCompact, oss);
3727  return oss.str();
3728 }
3729 
3730 NTV2AudioSystemSet NTV2MakeAudioSystemSet (const NTV2AudioSystem inFirstAudioSystem, const UWord inCount)
3731 {
3732  NTV2AudioSystemSet result;
3733  for (NTV2AudioSystem audSys(inFirstAudioSystem); audSys < NTV2AudioSystem(inFirstAudioSystem+inCount); audSys = NTV2AudioSystem(audSys+1))
3734  if (NTV2_IS_VALID_AUDIO_SYSTEM(audSys))
3735  result.insert(audSys);
3736  return result;
3737 }
3738 
3740 {
3741  NTV2RegNumSet result;
3742  for (NTV2RegisterReadsConstIter it(inRegInfos.begin()); it != inRegInfos.end(); ++it)
3743  if (result.find(it->registerNumber) == result.end())
3744  result.insert(it->registerNumber);
3745  return result;
3746 }
3747 
3749 {
3750  for (NTV2RegisterReadsConstIter iter(inRegInfos.begin()); iter != inRegInfos.end(); ++iter) // Ugh -- linear search
3751  if (iter->registerNumber == inRegNum)
3752  return iter;
3753  return inRegInfos.end();
3754 }
3755 
3756 
3757 ostream & operator << (std::ostream & inOutStream, const NTV2RegInfo & inObj)
3758 {
3759  return inObj.Print(inOutStream);
3760 }
3761 
3762 
3763 ostream & operator << (ostream & inOutStream, const NTV2RegisterWrites & inObj)
3764 {
3765  inOutStream << inObj.size () << " regs:" << endl;
3766  for (NTV2RegisterWritesConstIter iter (inObj.begin ()); iter != inObj.end (); ++iter)
3767  inOutStream << *iter << endl;
3768  return inOutStream;
3769 }
3770 
3771 
3772 NTV2BankSelGetSetRegs::NTV2BankSelGetSetRegs (const NTV2RegInfo & inBankSelect, const NTV2RegInfo & inOutRegInfo, const bool inDoWrite)
3773  : mHeader (NTV2_TYPE_BANKGETSET, sizeof (NTV2BankSelGetSetRegs)),
3774  mIsWriting (inDoWrite), // Default to reading
3775  mInBankInfos (sizeof(NTV2RegInfo)), // Room for one bank select
3776  mInRegInfos (sizeof(NTV2RegInfo)) // Room for one register read or write
3777 {
3778  NTV2RegInfo * pRegInfo (mInBankInfos);
3779  if (pRegInfo)
3780  *pRegInfo = inBankSelect; // Store bank select regInfo
3781  pRegInfo = mInRegInfos;
3782  if (pRegInfo)
3783  *pRegInfo = inOutRegInfo; // Store regInfo
3785 }
3786 
3787 
3789 {
3791  NTV2RegInfo result;
3792  if (mInRegInfos)
3793  {
3794  const NTV2RegInfo * pRegInfos (mInRegInfos);
3795  const ULWord maxNum (mInRegInfos.GetByteCount() / ULWord(sizeof(NTV2RegInfo)));
3796  if (ULWord(inIndex0) < maxNum)
3797  result = pRegInfos[inIndex0];
3798  }
3799  return result;
3800 }
3801 
3802 
3803 ostream & NTV2BankSelGetSetRegs::Print (ostream & oss) const
3804 {
3806  const NTV2RegInfo * pBankRegInfo (mInBankInfos);
3807  const NTV2RegInfo * pRegInfo (mInRegInfos);
3808  oss << mHeader << (mIsWriting ? " WRIT" : " READ") << " bankReg=";
3809  if (mInBankInfos) oss << *pBankRegInfo; else oss << "-";
3810  oss << " regInfos=";
3811  if (mInRegInfos) oss << *pRegInfo; else oss << "-";
3812  return oss;
3813 }
3814 
3815 
3816 NTV2VirtualData::NTV2VirtualData (const ULWord inTag, const void* inVirtualData, const size_t inVirtualDataSize, const bool inDoWrite)
3817  : mHeader (NTV2_TYPE_VIRTUAL_DATA_RW, sizeof (NTV2VirtualData)),
3818  mTag (inTag), // setup tag
3819  mIsWriting (inDoWrite), // setup write/read
3820  mVirtualData (inVirtualData, inVirtualDataSize) // setup virtual data
3821 {
3823 }
3824 
3825 
3826 ostream & NTV2VirtualData::Print (ostream & inOutStream) const
3827 {
3829  inOutStream << mHeader << ", mTag=" << mTag << ", mIsWriting=" << mIsWriting;
3830  return inOutStream;
3831 }
3832 
3833 using namespace ntv2nub;
3834 
3835  /*********************************************************************************************************************
3836  RPC ENCODE/DECODE FUNCTIONS
3837  *********************************************************************************************************************/
3838  #define AsU8Ref(_x_) reinterpret_cast<uint8_t&>(_x_)
3839  #define AsU16Ref(_x_) reinterpret_cast<uint16_t&>(_x_)
3840  #define AsU32Ref(_x_) reinterpret_cast<uint32_t&>(_x_)
3841  #define AsU64Ref(_x_) reinterpret_cast<uint64_t&>(_x_)
3842 
3844  {
3845  PUSHU32(fHeaderTag, outBlob); // ULWord fHeaderTag
3846  PUSHU32(fType, outBlob); // ULWord fType
3847  PUSHU32(fHeaderVersion, outBlob); // ULWord fHeaderVersion
3848  PUSHU32(fVersion, outBlob); // ULWord fVersion
3849  PUSHU32(fSizeInBytes, outBlob); // ULWord fSizeInBytes
3850  PUSHU32(fPointerSize, outBlob); // ULWord fPointerSize
3851  PUSHU32(fOperation, outBlob); // ULWord fOperation
3852  PUSHU32(fResultStatus, outBlob); // ULWord fResultStatus
3853  return true;
3854  }
3855 
3856  bool NTV2_HEADER::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
3857  { uint32_t v32(0);
3858  POPU32(fHeaderTag, inBlob, inOutIndex); // ULWord fHeaderTag
3859  POPU32(fType, inBlob, inOutIndex); // ULWord fType
3860  POPU32(fHeaderVersion, inBlob, inOutIndex); // ULWord fHeaderVersion
3861  POPU32(fVersion, inBlob, inOutIndex); // ULWord fVersion
3862  // Do not decode fSizeInBytes, use native size because size can vary based on OS specific struct padding
3863  POPU32(v32, inBlob, inOutIndex); // ULWord fSizeInBytes - dummy read
3864  POPU32(fPointerSize, inBlob, inOutIndex); // ULWord fPointerSize
3865  POPU32(fOperation, inBlob, inOutIndex); // ULWord fOperation
3866  POPU32(fResultStatus, inBlob, inOutIndex); // ULWord fResultStatus
3867  return true;
3868  }
3869 
3871  {
3872  PUSHU32(fTrailerVersion, outBlob); // ULWord fTrailerVersion
3873  PUSHU32(fTrailerTag, outBlob); // ULWord fTrailerTag
3874  return true;
3875  }
3876 
3877  bool NTV2_TRAILER::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
3878  {
3879  POPU32(fTrailerVersion, inBlob, inOutIndex); // ULWord fTrailerVersion
3880  POPU32(fTrailerTag, inBlob, inOutIndex); // ULWord fTrailerTag
3881  return true;
3882  }
3883 
3884 
3885  bool NTV2Buffer::RPCEncode (UByteSequence & outBlob, bool fillBuffer)
3886  {
3887  PUSHU32(fByteCount, outBlob); // ULWord fByteCount
3888  PUSHU32(fFlags, outBlob); // ULWord fFlags
3889  if (!IsNULL() && fillBuffer)
3890  AppendU8s(outBlob); // NOTE: My buffer content should already have been made BigEndian, if necessary
3891  return true;
3892  }
3893 
3894  bool NTV2Buffer::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex, bool fillBuffer)
3895  {
3896  ULWord byteCount(0), flags(0);
3897  POPU32(byteCount, inBlob, inOutIndex); // ULWord fByteCount
3898  POPU32(flags, inBlob, inOutIndex); // ULWord fFlags
3899  if (!Allocate(byteCount, flags & NTV2Buffer_PAGE_ALIGNED))
3900  return false;
3901  if (fillBuffer)
3902  {
3903  if ((inOutIndex + byteCount) > inBlob.size())
3904  return false; // past end of inBlob
3905  ::memcpy(GetHostPointer(), inBlob.data() + inOutIndex, byteCount); // Caller is responsible for byte-swapping if needed
3906  inOutIndex += byteCount;
3907  }
3908  return true;
3909  }
3910 
3911  // Created for DMATransfer, removed Allocate().
3912  bool NTV2Buffer::RPCDecodeNoAllocate (const UByteSequence & inBlob, size_t & inOutIndex)
3913  {
3914  ULWord byteCount(0), flags(0);
3915  POPU32(byteCount, inBlob, inOutIndex); // ULWord fByteCount
3916  POPU32(flags, inBlob, inOutIndex); // ULWord fFlags
3917  if ((inOutIndex + byteCount) > inBlob.size())
3918  return false; // past end of inBlob
3919 
3920  ::memcpy(GetHostPointer(), inBlob.data() + inOutIndex, byteCount); // Caller is responsible for byte-swapping if needed
3921  inOutIndex += byteCount;
3922  return true;
3923  }
3924 
3926  {
3927  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
3928  + mInRegisters.GetByteCount() + mOutGoodRegisters.GetByteCount() + mOutValues.GetByteCount()); // NTV2Buffer fields
3929  if (outBlob.capacity() < totBytes)
3930  outBlob.reserve(totBytes);
3931  if (!NTV2HostIsBigEndian)
3932  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
3933  mInRegisters.ByteSwap32();
3934  }
3935  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
3936  PUSHU32(mInNumRegisters, outBlob); // ULWord mInNumRegisters
3937  ok &= mInRegisters.RPCEncode(outBlob, /*fillbuffer=*/true); // NTV2Buffer mInRegisters
3938  PUSHU32(mOutNumRegisters, outBlob); // ULWord mOutNumRegisters
3939  ok &= mOutGoodRegisters.RPCEncode(outBlob, /*fillbuffer=*/false) // NTV2Buffer mOutGoodRegisters
3940  && mOutValues.RPCEncode(outBlob, /*fillbuffer=*/false) // NTV2Buffer mOutValues
3941  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
3942  if (!NTV2HostIsBigEndian && !ok)
3943  { // FAILED: Un-byteswap NTV2Buffer data...
3944  mInRegisters.ByteSwap32();
3945  }
3946  return ok;
3947  }
3948 
3949  bool NTV2GetRegisters::RPCDecodeServer (const UByteSequence & inBlob, size_t & inOutIndex)
3950  {
3951  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
3952  if (!ok) return false;
3953  POPU32(mInNumRegisters, inBlob, inOutIndex); // ULWord mInNumRegisters
3954  ok &= mInRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/true); // NTV2Buffer mInRegisters
3955  POPU32(mOutNumRegisters, inBlob, inOutIndex); // ULWord mOutNumRegisters
3956  ok &= mOutGoodRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/false); // NTV2Buffer mOutGoodRegisters
3957  ok &= mOutValues.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/false); // NTV2Buffer mOutValues
3958  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
3959  if (!NTV2HostIsBigEndian)
3960  { // Re-byteswap NTV2Buffer data after decoding...
3961  mInRegisters.ByteSwap32();
3962  }
3963  return ok;
3964  }
3965 
3967  {
3968  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
3969  + mInRegisters.GetByteCount() + mOutGoodRegisters.GetByteCount() + mOutValues.GetByteCount()); // NTV2Buffer fields
3970  if (outBlob.capacity() < totBytes)
3971  outBlob.reserve(totBytes);
3972  if (!NTV2HostIsBigEndian)
3973  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
3974  mOutGoodRegisters.ByteSwap32();
3975  mOutValues.ByteSwap32();
3976  }
3977  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
3978  PUSHU32(mInNumRegisters, outBlob); // ULWord mInNumRegisters
3979  ok &= mInRegisters.RPCEncode(outBlob, /*fillbuffer=*/false); // NTV2Buffer mInRegisters
3980  PUSHU32(mOutNumRegisters, outBlob); // ULWord mOutNumRegisters
3981  ok &= mOutGoodRegisters.RPCEncode(outBlob, /*fillbuffer=*/true) // NTV2Buffer mOutGoodRegisters
3982  && mOutValues.RPCEncode(outBlob, /*fillbuffer=*/true) // NTV2Buffer mOutValues
3983  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
3984  if (!NTV2HostIsBigEndian && !ok)
3985  { // FAILED: Un-byteswap NTV2Buffer data...
3986  mOutGoodRegisters.ByteSwap32();
3987  mOutValues.ByteSwap32();
3988  }
3989  return ok;
3990  }
3991 
3992  bool NTV2GetRegisters::RPCDecodeClient (const UByteSequence & inBlob, size_t & inOutIndex)
3993  {
3994  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
3995  if (!ok) return false;
3996  POPU32(mInNumRegisters, inBlob, inOutIndex); // ULWord mInNumRegisters
3997  ok &= mInRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/false); // NTV2Buffer mInRegisters
3998  POPU32(mOutNumRegisters, inBlob, inOutIndex); // ULWord mOutNumRegisters
3999  ok &= mOutGoodRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/true); // NTV2Buffer mOutGoodRegisters
4000  ok &= mOutValues.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/true); // NTV2Buffer mOutValues
4001  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4002  if (!NTV2HostIsBigEndian)
4003  { // Re-byteswap NTV2Buffer data after decoding...
4004  mOutGoodRegisters.ByteSwap32();
4005  mOutValues.ByteSwap32();
4006  }
4007  return ok;
4008  }
4009 
4011  {
4012  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
4013  + mInRegInfos.GetByteCount() + mOutBadRegIndexes.GetByteCount()); // NTV2Buffer fields
4014  if (outBlob.capacity() < totBytes)
4015  outBlob.reserve(totBytes);
4016  if (!NTV2HostIsBigEndian)
4017  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
4018  mInRegInfos.ByteSwap32();
4019  mOutBadRegIndexes.ByteSwap32();
4020  }
4021  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4022  PUSHU32(mInNumRegisters, outBlob); // ULWord mInNumRegisters
4023  ok &= mInRegInfos.RPCEncode(outBlob); // NTV2Buffer mInRegInfos
4024  PUSHU32(mOutNumFailures, outBlob); // ULWord mOutNumFailures
4025  ok &= mOutBadRegIndexes.RPCEncode(outBlob) // NTV2Buffer mOutBadRegIndexes
4026  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4027  if (!NTV2HostIsBigEndian && !ok)
4028  { // FAILED: Un-byteswap NTV2Buffer data...
4029  mInRegInfos.ByteSwap32();
4030  mOutBadRegIndexes.ByteSwap16();
4031  }
4032  return ok;
4033  }
4034 
4035  bool NTV2SetRegisters::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4036  {
4037  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
4038  POPU32(mInNumRegisters, inBlob, inOutIndex); // ULWord mInNumRegisters
4039  ok &= mInRegInfos.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mInRegInfos
4040  POPU32(mOutNumFailures, inBlob, inOutIndex); // ULWord mOutNumFailures
4041  ok &= mOutBadRegIndexes.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mOutBadRegIndexes
4042  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4043  if (!NTV2HostIsBigEndian)
4044  { // Re-byteswap NTV2Buffer data after decoding...
4045  mInRegInfos.ByteSwap32();
4046  mOutBadRegIndexes.ByteSwap16();
4047  }
4048  return ok;
4049  }
4050 
4052  {
4053  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
4054  + mInBankInfos.GetByteCount() + mInRegInfos.GetByteCount()); // NTV2Buffer fields
4055  if (outBlob.capacity() < totBytes)
4056  outBlob.reserve(totBytes);
4057  if (!NTV2HostIsBigEndian)
4058  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
4059  mInBankInfos.ByteSwap32();
4060  mInRegInfos.ByteSwap32();
4061  }
4062  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4063  PUSHU32(mIsWriting, outBlob); // ULWord mIsWriting
4064  ok &= mInBankInfos.RPCEncode(outBlob); // NTV2Buffer mInBankInfos
4065  ok &= mInRegInfos.RPCEncode(outBlob) // NTV2Buffer mInRegInfos
4066  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4067  if (!NTV2HostIsBigEndian && !ok)
4068  { // FAILED: Un-byteswap NTV2Buffer data...
4069  mInBankInfos.ByteSwap32();
4070  mInRegInfos.ByteSwap32();
4071  }
4072  return ok;
4073  }
4074 
4075  bool NTV2BankSelGetSetRegs::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4076  {
4077  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
4078  POPU32(mIsWriting, inBlob, inOutIndex); // ULWord mIsWriting
4079  ok &= mInBankInfos.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mInBankInfos
4080  ok &= mInRegInfos.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mInRegInfos
4081  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4082  if (!NTV2HostIsBigEndian)
4083  { // Re-byteswap NTV2Buffer data after decoding...
4084  mInBankInfos.ByteSwap32();
4085  mInRegInfos.ByteSwap32();
4086  }
4087  return ok;
4088  }
4089 
4091  {
4092  const size_t totBytes (acHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4093  if (outBlob.capacity() < totBytes)
4094  outBlob.reserve(totBytes);
4095  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4096  PUSHU16(UWord(acCrosspoint), outBlob); // NTV2Crosspoint acCrosspoint
4097  PUSHU16(UWord(acState), outBlob); // NTV2AutoCirculateState acState
4098  PUSHU32(ULWord(acStartFrame), outBlob); // LWord acStartFrame
4099  PUSHU32(ULWord(acEndFrame), outBlob); // LWord acEndFrame
4100  PUSHU32(ULWord(acActiveFrame), outBlob); // LWord acActiveFrame
4101  PUSHU64(acRDTSCStartTime, outBlob); // ULWord64 acRDTSCStartTime
4102  PUSHU64(acAudioClockStartTime, outBlob); // ULWord64 acAudioClockStartTime
4103  PUSHU64(acRDTSCCurrentTime, outBlob); // ULWord64 acRDTSCCurrentTime
4104  PUSHU64(acAudioClockCurrentTime, outBlob); // ULWord64 acAudioClockCurrentTime
4105  PUSHU32(acFramesProcessed, outBlob); // ULWord acFramesProcessed
4106  PUSHU32(acFramesDropped, outBlob); // ULWord acFramesDeopped
4107  PUSHU32(acBufferLevel, outBlob); // ULWord acBufferLevel
4108  PUSHU32(acOptionFlags, outBlob); // ULWord acOptionFlags
4109  PUSHU16(UWord(acAudioSystem), outBlob); // NTV2AudioSystem acAudioSystem
4110  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4111  return ok;
4112  }
4113 
4114  bool AUTOCIRCULATE_STATUS::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4115  { uint16_t v16(0); uint32_t v32(0);
4116  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4117  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint acCrosspoint
4118  acCrosspoint = NTV2Crosspoint(v16);
4119  POPU16(v16, inBlob, inOutIndex); // NTV2AutoCirculateState acState
4120  acState = NTV2AutoCirculateState(v16);
4121  POPU32(v32, inBlob, inOutIndex); // LWord acStartFrame
4122  acStartFrame = LWord(v32);
4123  POPU32(v32, inBlob, inOutIndex); // LWord acEndFrame
4124  acEndFrame = LWord(v32);
4125  POPU32(v32, inBlob, inOutIndex); // LWord acActiveFrame
4126  acActiveFrame = LWord(v32);
4127  POPU64(acRDTSCStartTime, inBlob, inOutIndex); // ULWord64 acRDTSCStartTime
4128  POPU64(acAudioClockStartTime, inBlob, inOutIndex); // ULWord64 acAudioClockStartTime
4129  POPU64(acRDTSCCurrentTime, inBlob, inOutIndex); // ULWord64 acRDTSCCurrentTime
4130  POPU64(acAudioClockCurrentTime, inBlob, inOutIndex); // ULWord64 acAudioClockCurrentTime
4131  POPU32(acFramesProcessed, inBlob, inOutIndex); // ULWord acFramesProcessed
4132  POPU32(acFramesDropped, inBlob, inOutIndex); // ULWord acFramesDropped
4133  POPU32(acBufferLevel, inBlob, inOutIndex); // ULWord acBufferLevel
4134  POPU32(acOptionFlags, inBlob, inOutIndex); // ULWord acOptionFlags
4135  POPU16(v16, inBlob, inOutIndex); // NTV2AudioSystem acAudioSystem
4136  acAudioSystem = NTV2AudioSystem(v16);
4137  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4138  return ok;
4139  }
4140 
4142  {
4143  const size_t totBytes (acHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4144  if (outBlob.capacity() < totBytes)
4145  outBlob.reserve(totBytes);
4146  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4147  PUSHU64(ULWord64(acFrameTime), outBlob); // LWord64 acFrameTime
4148  PUSHU32(acRequestedFrame, outBlob); // ULWord acRequestedFrame
4149  PUSHU64(acAudioClockTimeStamp, outBlob); // ULWord64 acAudioClockTimeStamp
4150  PUSHU32(acAudioExpectedAddress, outBlob); // ULWord acAudioExpectedAddress
4151  PUSHU32(acAudioInStartAddress, outBlob); // ULWord acAudioInStartAddress
4152  PUSHU32(acAudioInStopAddress, outBlob); // ULWord acAudioInStopAddress
4153  PUSHU32(acAudioOutStopAddress, outBlob); // ULWord acAudioOutStopAddress
4154  PUSHU32(acAudioOutStartAddress, outBlob); // ULWord acAudioOutStartAddress
4155  PUSHU32(acTotalBytesTransferred, outBlob); // ULWord acTotalBytesTransferred
4156  PUSHU32(acStartSample, outBlob); // ULWord acStartSample
4157 
4158  ok &= acTimeCodes.RPCEncode(outBlob); // NTV2Buffer acTimeCodes
4159  PUSHU64(ULWord64(acCurrentTime), outBlob); // LWord64 acCurrentTime
4160  PUSHU32(acCurrentFrame, outBlob); // ULWord acCurrentFrame
4161  PUSHU64(ULWord64(acCurrentFrameTime), outBlob); // LWord64 acCurrentFrameTime
4162  PUSHU64(acAudioClockCurrentTime, outBlob); // ULWord64 acAudioClockCurrentTime
4163  PUSHU32(acCurrentAudioExpectedAddress, outBlob); // ULWord acCurrentAudioExpectedAddress
4164  PUSHU32(acCurrentAudioStartAddress, outBlob); // ULWord acCurrentAudioStartAddress
4165  PUSHU32(acCurrentFieldCount, outBlob); // ULWord acCurrentFieldCount
4166  PUSHU32(acCurrentLineCount, outBlob); // ULWord acCurrentLineCount
4167  PUSHU32(acCurrentReps, outBlob); // ULWord acCurrentReps
4168  PUSHU64(acCurrentUserCookie, outBlob); // ULWord64 acCurrentUserCookie
4169  PUSHU32(acFrame, outBlob); // ULWord acFrame
4170  PUSHU32(acRP188.fDBB, outBlob); // ULWord acRP188.fDBB
4171  PUSHU32(acRP188.fLo, outBlob); // ULWord acRP188.fLo
4172  PUSHU32(acRP188.fHi, outBlob); // ULWord acRP188.fHi
4173  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4174  return ok;
4175  }
4176 
4177  bool FRAME_STAMP::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4178  { uint64_t v64(0);
4179  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4180  POPU64(v64, inBlob, inOutIndex); // LWord64 acFrameTime
4181  acFrameTime = LWord64(v64);
4182  POPU32(acRequestedFrame, inBlob, inOutIndex); // ULWord acRequestedFrame
4183  POPU64(acAudioClockTimeStamp, inBlob, inOutIndex); // ULWord64 acAudioClockTimeStamp
4184  POPU32(acAudioExpectedAddress, inBlob, inOutIndex); // ULWord acAudioExpectedAddress
4185  POPU32(acAudioInStartAddress, inBlob, inOutIndex); // ULWord acAudioInStartAddress
4186  POPU32(acAudioInStopAddress, inBlob, inOutIndex); // ULWord acAudioInStopAddress
4187  POPU32(acAudioOutStopAddress, inBlob, inOutIndex); // ULWord acAudioOutStopAddress
4188  POPU32(acAudioOutStartAddress, inBlob, inOutIndex); // ULWord acAudioOutStartAddress
4189  POPU32(acTotalBytesTransferred, inBlob, inOutIndex); // ULWord acTotalBytesTransferred
4190  POPU32(acStartSample, inBlob, inOutIndex); // ULWord acStartSample
4191 
4192  ok &= acTimeCodes.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acTimeCodes
4193  POPU64(v64, inBlob, inOutIndex); // LWord64 acCurrentTime
4194  acCurrentTime = LWord64(v64);
4195  POPU32(acCurrentFrame, inBlob, inOutIndex); // ULWord acCurrentFrame
4196  POPU64(v64, inBlob, inOutIndex); // LWord64 acCurrentFrameTime
4197  acCurrentFrameTime = LWord64(v64);
4198  POPU64(acAudioClockCurrentTime, inBlob, inOutIndex); // ULWord64 acAudioClockCurrentTime
4199  POPU32(acCurrentAudioExpectedAddress, inBlob, inOutIndex); // ULWord acCurrentAudioExpectedAddress
4200  POPU32(acCurrentAudioStartAddress, inBlob, inOutIndex); // ULWord acCurrentAudioStartAddress
4201  POPU32(acCurrentFieldCount, inBlob, inOutIndex); // ULWord acCurrentFieldCount
4202  POPU32(acCurrentLineCount, inBlob, inOutIndex); // ULWord acCurrentLineCount
4203  POPU32(acCurrentReps, inBlob, inOutIndex); // ULWord acCurrentReps
4204  POPU64(acCurrentUserCookie, inBlob, inOutIndex); // ULWord64 acCurrentUserCookie
4205  POPU32(acFrame, inBlob, inOutIndex); // ULWord acFrame
4206  POPU32(acRP188.fDBB, inBlob, inOutIndex); // ULWord acRP188.fDBB
4207  POPU32(acRP188.fLo, inBlob, inOutIndex); // ULWord acRP188.fLo
4208  POPU32(acRP188.fHi, inBlob, inOutIndex); // ULWord acRP188.fHi
4209  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4210  return ok;
4211  }
4212 
4214  {
4215  const size_t totBytes (acHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4216  if (outBlob.capacity() < totBytes)
4217  outBlob.reserve(totBytes);
4218  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4219  PUSHU16(acState, outBlob); // UWord acState
4220  PUSHU32(ULWord(acTransferFrame), outBlob); // LWord acTransferFrame
4221  PUSHU32(acBufferLevel, outBlob); // ULWord acBufferLevel
4222  PUSHU32(acFramesProcessed, outBlob); // ULWord acFramesProcessed
4223  PUSHU32(acFramesDropped, outBlob); // ULWord acFramesDropped
4224  ok &= acFrameStamp.RPCEncode(outBlob); // FRAME_STAMP acFrameStamp
4225  PUSHU32(acAudioTransferSize, outBlob); // ULWord acAudioTransferSize
4226  PUSHU32(acAudioStartSample, outBlob); // ULWord acAudioStartSample
4227  PUSHU32(acAncTransferSize, outBlob); // ULWord acAncTransferSize
4228  PUSHU32(acAncField2TransferSize, outBlob); // ULWord acAncField2TransferSize
4229  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4230  return ok;
4231  }
4232 
4233  bool AUTOCIRCULATE_TRANSFER_STATUS::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4234  { uint16_t v16(0); uint32_t v32(0);
4235  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4236  POPU16(v16, inBlob, inOutIndex); // NTV2AutoCirculateState acState
4237  acState = NTV2AutoCirculateState(v16);
4238  POPU32(v32, inBlob, inOutIndex); // LWord acTransferFrame
4239  acTransferFrame = LWord(v32);
4240  POPU32(acBufferLevel, inBlob, inOutIndex); // ULWord acBufferLevel
4241  POPU32(acFramesProcessed, inBlob, inOutIndex); // ULWord acFramesProcessed
4242  POPU32(acFramesDropped, inBlob, inOutIndex); // ULWord acFramesDropped
4243  ok &= acFrameStamp.RPCDecode(inBlob, inOutIndex); // FRAME_STAMP acFrameStamp
4244  POPU32(acAudioTransferSize, inBlob, inOutIndex); // ULWord acAudioTransferSize
4245  POPU32(acAudioStartSample, inBlob, inOutIndex); // ULWord acAudioStartSample
4246  POPU32(acAncTransferSize, inBlob, inOutIndex); // ULWord acAncTransferSize
4247  POPU32(acAncField2TransferSize, inBlob, inOutIndex); // ULWord acAncField2TransferSize
4248  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4249  return ok;
4250  }
4251 
4253  {
4254  PUSHU32(acNumSegments, outBlob); // ULWord acNumSegments
4255  PUSHU32(acNumActiveBytesPerRow, outBlob); // ULWord acNumActiveBytesPerRow
4256  PUSHU32(acSegmentHostPitch, outBlob); // ULWord acSegmentHostPitch
4257  PUSHU32(acSegmentDevicePitch, outBlob); // ULWord acSegmentDevicePitch
4258  return true;
4259  }
4260 
4261  bool NTV2SegmentedDMAInfo::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4262  {
4263  POPU32(acNumSegments, inBlob, inOutIndex); // ULWord acNumSegments
4264  POPU32(acNumActiveBytesPerRow, inBlob, inOutIndex); // ULWord acNumActiveBytesPerRow
4265  POPU32(acSegmentHostPitch, inBlob, inOutIndex); // ULWord acSegmentHostPitch
4266  POPU32(acSegmentDevicePitch, inBlob, inOutIndex); // ULWord acSegmentDevicePitch
4267  return true;
4268  }
4269 
4271  {
4272  PUSHU16(ccMode, outBlob); // NTV2ColorCorrectionMode ccMode
4273  PUSHU32(ccSaturationValue, outBlob); // ULWord ccSaturationValue
4274  return ccLookupTables.RPCEncode(outBlob); // NTV2Buffer ccLookupTables
4275  }
4276 
4277  bool NTV2ColorCorrectionData::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4278  { uint16_t u16(0);
4279  POPU16(u16, inBlob, inOutIndex); // NTV2ColorCorrectionMode ccMode
4280  ccMode = NTV2ColorCorrectionMode(u16);
4281  POPU32(ccSaturationValue, inBlob, inOutIndex); // ULWord ccSaturationValue
4282  return ccLookupTables.RPCDecode(inBlob, inOutIndex); // NTV2Buffer ccLookupTables
4283  }
4284 
4286  {
4287  PUSHU16(mode, outBlob); // AutoCircVidProcMode mode
4288  PUSHU16(foregroundVideoCrosspoint, outBlob); // NTV2Crosspoint foregroundVideoCrosspoint
4289  PUSHU16(backgroundVideoCrosspoint, outBlob); // NTV2Crosspoint backgroundVideoCrosspoint
4290  PUSHU16(foregroundKeyCrosspoint, outBlob); // NTV2Crosspoint foregroundKeyCrosspoint
4291  PUSHU16(backgroundKeyCrosspoint, outBlob); // NTV2Crosspoint backgroundKeyCrosspoint
4292  PUSHU32(ULWord(transitionCoefficient), outBlob); // Fixed_ transitionCoefficient
4293  PUSHU32(ULWord(transitionSoftness), outBlob); // Fixed_ transitionSoftness
4294  return true;
4295  }
4296 
4297  bool AutoCircVidProcInfo::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4298  { uint16_t v16(0); uint32_t v32(0);
4299  POPU16(v16, inBlob, inOutIndex); // AutoCircVidProcMode mode
4300  mode = AutoCircVidProcMode(v16);
4301  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint foregroundVideoCrosspoint
4302  foregroundVideoCrosspoint = NTV2Crosspoint(v16);
4303  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint backgroundVideoCrosspoint
4304  backgroundVideoCrosspoint = NTV2Crosspoint(v16);
4305  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint foregroundKeyCrosspoint
4306  foregroundKeyCrosspoint = NTV2Crosspoint(v16);
4307  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint backgroundKeyCrosspoint
4308  backgroundKeyCrosspoint = NTV2Crosspoint(v16);
4309  POPU32(v32, inBlob, inOutIndex); // Fixed_ transitionCoefficient
4310  transitionCoefficient = Fixed_(v32);
4311  POPU32(v32, inBlob, inOutIndex); // Fixed_ transitionSoftness
4312  transitionSoftness = Fixed_(v32);
4313  return true;
4314  }
4315 
4317  {
4318  PUSHU32(fDBB, outBlob); // ULWord fDBB
4319  PUSHU32(fLo, outBlob); // ULWord fLo
4320  PUSHU32(fHi, outBlob); // ULWord fHi
4321  return true;
4322  }
4323 
4324  bool NTV2_RP188::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4325  {
4326  POPU32(fDBB, inBlob, inOutIndex); // ULWord fDBB
4327  POPU32(fLo, inBlob, inOutIndex); // ULWord fLo
4328  POPU32(fHi, inBlob, inOutIndex); // ULWord fHi
4329  return true;
4330  }
4331 
4333  {
4335  const size_t totBytes (acHeader.GetSizeInBytes() + acVideoBuffer.GetByteCount() + acAudioBuffer.GetByteCount()
4336  + acANCBuffer.GetByteCount() + acANCField2Buffer.GetByteCount() + acOutputTimeCodes.GetByteCount()
4337  + acHDMIAuxData.GetByteCount() + 64); // Header + natural size of all structs/fields inbetween + Trailer
4338  if (outBlob.capacity() < totBytes)
4339  outBlob.reserve(totBytes);
4340  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4341  ok &= acVideoBuffer.RPCEncode(outBlob); // NTV2Buffer acVideoBuffer
4342  ok &= acAudioBuffer.RPCEncode(outBlob); // NTV2Buffer acAudioBuffer
4343  ok &= acANCBuffer.RPCEncode(outBlob); // NTV2Buffer acANCBuffer
4344  ok &= acANCField2Buffer.RPCEncode(outBlob); // NTV2Buffer acANCField2Buffer
4345  ok &= acOutputTimeCodes.RPCEncode(outBlob); // NTV2Buffer acOutputTimeCodes
4346  ok &= acTransferStatus.RPCEncode(outBlob); // AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
4347  PUSHU64(acInUserCookie, outBlob); // ULWord64 acInUserCookie
4348  PUSHU32(acInVideoDMAOffset, outBlob); // ULWord acInVideoDMAOffset
4349  ok &= acInSegmentedDMAInfo.RPCEncode(outBlob); // NTV2SegmentedDMAInfo acInSegmentedDMAInfo
4350  ok &= acColorCorrection.RPCEncode(outBlob); // NTV2ColorCorrectionData acColorCorrection
4351  PUSHU16(acFrameBufferFormat, outBlob); // NTV2PixelFormat acFrameBufferFormat
4352  PUSHU16(acFrameBufferOrientation, outBlob); // NTV2FBOrientation acFrameBufferOrientation
4353  ok &= acVidProcInfo.RPCEncode(outBlob); // AutoCircVidProcInfo acVidProcInfo
4354  PUSHU16(acVideoQuarterSizeExpand, outBlob); // NTV2QtrSizeExpandMode acVideoQuarterSizeExpand
4355  ok &= acHDMIAuxData.RPCEncode(outBlob); // NTV2Buffer acHDMIAuxData
4356  PUSHU32(acPeerToPeerFlags, outBlob); // ULWord acPeerToPeerFlags
4357  PUSHU32(acFrameRepeatCount, outBlob); // ULWord acFrameRepeatCount
4358  PUSHU32(ULWord(acDesiredFrame), outBlob); // LWord acDesiredFrame
4359  ok &= acRP188.RPCEncode(outBlob); // NTV2_RP188 acRP188
4360  PUSHU16(acCrosspoint, outBlob); // NTV2Crosspoint acCrosspoint
4361  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4363  return ok;
4364  }
4365 
4366  bool AUTOCIRCULATE_TRANSFER::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4367  { uint16_t v16(0); uint32_t v32(0);
4369  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4370  ok &= acVideoBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acVideoBuffer
4371  ok &= acAudioBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acAudioBuffer
4372  ok &= acANCBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acANCBuffer
4373  ok &= acANCField2Buffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acANCField2Buffer
4374  ok &= acOutputTimeCodes.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acOutputTimeCodes
4375  ok &= acTransferStatus.RPCDecode(inBlob, inOutIndex); // AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
4376  POPU64(acInUserCookie, inBlob, inOutIndex); // ULWord64 acInUserCookie
4377  POPU32(acInVideoDMAOffset, inBlob, inOutIndex); // ULWord acInVideoDMAOffset
4378  ok &= acInSegmentedDMAInfo.RPCDecode(inBlob, inOutIndex);// NTV2Buffer acInSegmentedDMAInfo
4379  ok &= acColorCorrection.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acColorCorrection
4380  POPU16(v16, inBlob, inOutIndex); // NTV2PixelFormat acFrameBufferFormat
4381  acFrameBufferFormat = NTV2FrameBufferFormat(v16);
4382  POPU16(v16, inBlob, inOutIndex); // NTV2FBOrientation acFrameBufferOrientation
4383  acFrameBufferOrientation = NTV2FBOrientation(v16);
4384  ok &= acVidProcInfo.RPCDecode(inBlob, inOutIndex); // AutoCircVidProcInfo acVidProcInfo
4385  POPU16(v16, inBlob, inOutIndex); // NTV2QtrSizeExpandMode acVideoQuarterSizeExpand
4386  acVideoQuarterSizeExpand = NTV2QtrSizeExpandMode(v16);
4387  ok &= acHDMIAuxData.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acHDMIAuxData
4388  POPU32(acPeerToPeerFlags, inBlob, inOutIndex); // ULWord acPeerToPeerFlags
4389  POPU32(acFrameRepeatCount, inBlob, inOutIndex); // ULWord acFrameRepeatCount
4390  POPU32(v32, inBlob, inOutIndex); // LWord acDesiredFrame
4391  acDesiredFrame = LWord(v32);
4392  ok &= acRP188.RPCDecode(inBlob, inOutIndex); // NTV2_RP188 acRP188
4393  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint acCrosspoint
4394  acCrosspoint = NTV2Crosspoint(v16);
4395  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4397  return ok;
4398  }
4399 
4401  {
4402  NTV2Buffer buff;
4403  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4404 // PUSHU64(ULWord64(videoBuffer), outBlob) // ULWord * videoBuffer
4405  PUSHU32(videoBufferSize, outBlob); // ULWord videoBufferSize
4406  if (videoBuffer && videoBufferSize)
4407  { buff.Set(videoBuffer, videoBufferSize);
4408  buff.AppendU8s(outBlob);
4409  }
4410  PUSHU32(videoDmaOffset, outBlob); // ULWord videoDmaOffset
4411 // PUSHU64(ULWord64(audioBuffer), outBlob) // ULWord * audioBuffer
4412  PUSHU32(audioBufferSize, outBlob); // ULWord audioBufferSize
4413  if (audioBuffer && audioBufferSize)
4414  { buff.Set(audioBuffer, audioBufferSize);
4415  buff.AppendU8s(outBlob);
4416  }
4417  PUSHU32(audioStartSample, outBlob); // ULWord audioStartSample
4418  PUSHU32(audioNumChannels, outBlob); // ULWord audioNumChannels
4419  PUSHU32(frameRepeatCount, outBlob); // ULWord frameRepeatCount
4420  rp188.RPCEncode(outBlob); // RP188_STRUCT rp188
4421  PUSHU32(ULWord(desiredFrame), outBlob); // LWord desiredFrame
4422  PUSHU32(hUser, outBlob); // ULWord hUser
4423  PUSHU32(transferFlags, outBlob); // ULWord transferFlags
4424  PUSHU8(bDisableExtraAudioInfo, outBlob); // BOOL_ bDisableExtraAudioInfo
4425  PUSHU16(UWord(frameBufferFormat), outBlob); // NTV2PixelFormat frameBufferFormat
4426  PUSHU16(UWord(frameBufferOrientation), outBlob); // NTV2FBOrientation frameBufferOrientation
4427  // Skip color correction for now // NTV2ColorCorrectionInfo colorCorrectionInfo
4428  vidProcInfo.RPCEncode(outBlob); // AutoCircVidProcInfo vidProcInfo
4429  PUSHU32(customAncInfo.Group1, outBlob); // CUSTOM_ANC_STRUCT customAncInfo
4430  PUSHU32(customAncInfo.Group2, outBlob);
4431  PUSHU32(customAncInfo.Group3, outBlob);
4432  PUSHU32(customAncInfo.Group4, outBlob);
4433  PUSHU32(videoNumSegments, outBlob); // ULWord videoNumSegments
4434  PUSHU32(videoSegmentHostPitch, outBlob); // ULWord videoSegmentHostPitch
4435  PUSHU32(videoSegmentCardPitch, outBlob); // ULWord videoSegmentCardPitch
4436  PUSHU16(UWord(videoQuarterSizeExpand), outBlob); // NTV2QtrSizeExpandMode videoQuarterSizeExpand
4437  return true;
4438  }
4439 
4440  bool AUTOCIRCULATE_TRANSFER_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4441  { UWord v16(0); ULWord v32(0);
4442  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4443  channelSpec = NTV2Crosspoint(v16);
4444 // POPU64(u64, inBlob, inOutIndex); // ULWord * videoBuffer
4445 // videoBuffer = reinterpret_cast<ULWord*>(u64);
4446  POPU32(videoBufferSize, inBlob, inOutIndex); // ULWord videoBufferSize
4447  if (videoBufferSize && !videoBuffer)
4448  {
4449  videoBuffer = reinterpret_cast<ULWord*>(AJAMemory::AllocateAligned(videoBufferSize, NTV2Buffer::DefaultPageSize()));
4450  if (!videoBuffer)
4451  return false;
4452  if ((inOutIndex + videoBufferSize) >= inBlob.size())
4453  return false; // past end of inBlob
4454  UByte* pBuffer = reinterpret_cast<UByte*>(videoBuffer);
4455  for (ULWord cnt(0); cnt < videoBufferSize; cnt++)
4456  pBuffer[cnt] = inBlob.at(inOutIndex++); // Caller is responsible for byte-swapping if needed
4457  }
4458  POPU32(videoDmaOffset, inBlob, inOutIndex); // ULWord videoDmaOffset
4459 // POPU64(u64, inBlob, inOutIndex); // ULWord * audioBuffer
4460 // audioBuffer = reinterpret_cast<ULWord*>(u64);
4461  POPU32(audioBufferSize, inBlob, inOutIndex); // ULWord audioBufferSize
4462  if (audioBufferSize && !audioBuffer)
4463  {
4464  audioBuffer = reinterpret_cast<ULWord*>(AJAMemory::AllocateAligned(audioBufferSize, NTV2Buffer::DefaultPageSize()));
4465  if (!audioBuffer)
4466  return false;
4467  if ((inOutIndex + audioBufferSize) >= inBlob.size())
4468  return false; // past end of inBlob
4469  UByte* pBuffer = reinterpret_cast<UByte*>(audioBuffer);
4470  for (ULWord cnt(0); cnt < audioBufferSize; cnt++)
4471  pBuffer[cnt] = inBlob.at(inOutIndex++); // Caller is responsible for byte-swapping if needed
4472  }
4473  POPU32(audioStartSample, inBlob, inOutIndex); // ULWord audioStartSample
4474  POPU32(audioNumChannels, inBlob, inOutIndex); // ULWord audioNumChannels
4475  POPU32(frameRepeatCount, inBlob, inOutIndex); // ULWord frameRepeatCount
4476  rp188.RPCDecode(inBlob, inOutIndex); // RP188_STRUCT rp188
4477  POPU32(v32, inBlob, inOutIndex); // LWord desiredFrame
4478  desiredFrame = LWord(v32);
4479  POPU32(hUser, inBlob, inOutIndex); // ULWord hUser
4480  POPU32(transferFlags, inBlob, inOutIndex); // ULWord transferFlags
4481  POPU8(AsU8Ref(bDisableExtraAudioInfo), inBlob, inOutIndex); // BOOL_ bDisableExtraAudioInfo
4482  POPU16(v16, inBlob, inOutIndex); // NTV2PixelFormat frameBufferFormat
4483  frameBufferFormat = NTV2PixelFormat(v16);
4484  POPU16(v16, inBlob, inOutIndex); // NTV2FBOrientation frameBufferOrientation
4485  frameBufferOrientation = NTV2FBOrientation(v16);
4486  // Skip color correction for now // NTV2ColorCorrectionInfo colorCorrectionInfo
4487  vidProcInfo.RPCDecode(inBlob, inOutIndex); // AutoCircVidProcInfo vidProcInfo
4488  POPU32(customAncInfo.Group1, inBlob, inOutIndex); // CUSTOM_ANC_STRUCT customAncInfo
4489  POPU32(customAncInfo.Group2, inBlob, inOutIndex);
4490  POPU32(customAncInfo.Group3, inBlob, inOutIndex);
4491  POPU32(customAncInfo.Group4, inBlob, inOutIndex);
4492  POPU32(videoNumSegments, inBlob, inOutIndex); // ULWord videoNumSegments
4493  POPU32(videoSegmentHostPitch, inBlob, inOutIndex); // ULWord videoSegmentHostPitch
4494  POPU32(videoSegmentCardPitch, inBlob, inOutIndex); // ULWord videoSegmentCardPitch
4495  POPU16(v16, inBlob, inOutIndex); // NTV2QtrSizeExpandMode videoQuarterSizeExpand
4496  videoQuarterSizeExpand = NTV2QtrSizeExpandMode(v16);
4497  return true;
4498  }
4499 
4501  {
4502  const size_t totBytes (mHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4503  if (outBlob.capacity() < totBytes)
4504  outBlob.reserve(totBytes);
4505  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4506  ok &= mBuffer.RPCEncode(outBlob); // NTV2Buffer mBuffer
4507  PUSHU32(mFlags, outBlob); // ULWord mFlags
4508  PUSHU32(mStatus, outBlob); // ULWord mStatus
4509  for (size_t ndx(0); ndx < 16; ndx++)
4510  PUSHU32(mRegisters[ndx], outBlob); // ULWord mRegisters[16]
4511  for (size_t ndx(0); ndx < 32; ndx++)
4512  PUSHU32(mReserved[ndx], outBlob); // ULWord mReserved[32]
4513  ok &= mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4514  return ok;
4515  }
4516 
4517  bool NTV2Bitstream::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4518  {
4519  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4520  ok &= mBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mBuffer
4521  POPU32(mFlags, inBlob, inOutIndex); // ULWord mFlags
4522  POPU32(mStatus, inBlob, inOutIndex); // ULWord mStatus
4523  for (size_t ndx(0); ndx < 16; ndx++)
4524  POPU32(mRegisters[ndx], inBlob, inOutIndex); // ULWord mRegisters[16]
4525  for (size_t ndx(0); ndx < 16; ndx++)
4526  POPU32(mReserved[ndx], inBlob, inOutIndex); // ULWord mReserved[16]
4527  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4528  return ok;
4529  }
4530 
4532  {
4533  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4534  PUSHU16(UWord(state), outBlob); // NTV2AutoCirculateState state
4535  PUSHU32(ULWord(startFrame), outBlob); // LWord startFrame
4536  PUSHU32(ULWord(endFrame), outBlob); // LWord endFrame
4537  PUSHU32(ULWord(activeFrame), outBlob); // LWord activeFrame
4538  PUSHU64(rdtscStartTime, outBlob); // ULWord64 rdtscStartTime
4539  PUSHU64(audioClockStartTime, outBlob); // ULWord64 audioClockStartTime
4540  PUSHU64(rdtscCurrentTime, outBlob); // ULWord64 rdtscCurrentTime
4541  PUSHU64(audioClockCurrentTime, outBlob); // ULWord64 audioClockCurrentTime
4542  PUSHU32(framesProcessed, outBlob); // ULWord framesProcessed
4543  PUSHU32(framesDropped, outBlob); // ULWord framesDropped
4544  PUSHU32(bufferLevel, outBlob); // ULWord bufferLevel
4545  PUSHU8(bWithAudio, outBlob); // BOOL_ bWithAudio
4546  PUSHU8(bWithRP188, outBlob); // BOOL_ bWithRP188
4547  PUSHU8(bFbfChange, outBlob); // BOOL_ bFbfChange
4548  PUSHU8(bFboChange, outBlob); // BOOL_ bFboChange
4549  PUSHU8(bWithColorCorrection, outBlob); // BOOL_ bWithColorCorrection
4550  PUSHU8(bWithVidProc, outBlob); // BOOL_ bWithVidProc
4551  PUSHU8(bWithCustomAncData, outBlob); // BOOL_ bWithCustomAncData
4552  return true;
4553  }
4554 
4555  bool AUTOCIRCULATE_STATUS_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4556  { uint16_t v16(0); uint32_t v32(0);
4557  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4558  channelSpec = NTV2Crosspoint(v16);
4559  POPU16(v16, inBlob, inOutIndex); // NTV2AutoCirculateState state
4560  state = NTV2AutoCirculateState(v16);
4561  POPU32(v32, inBlob, inOutIndex); // LWord startFrame
4562  startFrame = LWord(v32);
4563  POPU32(v32, inBlob, inOutIndex); // LWord endFrame
4564  endFrame = LWord(v32);
4565  POPU32(v32, inBlob, inOutIndex); // LWord activeFrame
4566  activeFrame = LWord(v32);
4567  POPU64(rdtscStartTime, inBlob, inOutIndex); // ULWord64 rdtscStartTime
4568  POPU64(audioClockStartTime, inBlob, inOutIndex); // ULWord64 audioClockStartTime
4569  POPU64(rdtscCurrentTime, inBlob, inOutIndex); // ULWord64 rdtscCurrentTime
4570  POPU64(audioClockCurrentTime, inBlob, inOutIndex); // ULWord64 audioClockCurrentTime
4571  POPU32(framesProcessed, inBlob, inOutIndex); // ULWord framesProcessed
4572  POPU32(framesDropped, inBlob, inOutIndex); // ULWord framesDropped
4573  POPU32(bufferLevel, inBlob, inOutIndex); // ULWord bufferLevel
4574  POPU8(AsU8Ref(bWithAudio), inBlob, inOutIndex); // BOOL_ bWithAudio
4575  POPU8(AsU8Ref(bWithRP188), inBlob, inOutIndex); // BOOL_ bWithRP188
4576  POPU8(AsU8Ref(bFbfChange), inBlob, inOutIndex); // BOOL_ bFbfChange
4577  POPU8(AsU8Ref(bFboChange), inBlob, inOutIndex); // BOOL_ bFboChange
4578  POPU8(AsU8Ref(bWithColorCorrection), inBlob, inOutIndex);// BOOL_ bWithColorCorrection
4579  POPU8(AsU8Ref(bWithVidProc), inBlob, inOutIndex); // BOOL_ bWithVidProc
4580  POPU8(AsU8Ref(bWithCustomAncData), inBlob, inOutIndex); // BOOL_ bWithCustomAncData
4581  return true;
4582  }
4583 
4585  {
4586  PUSHU32(DBB, outBlob); // ULWord DBB
4587  PUSHU32(Low, outBlob); // ULWord Low
4588  PUSHU32(High, outBlob); // ULWord High
4589  return true;
4590  }
4591 
4592  bool RP188_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4593  {
4594  POPU32(DBB, inBlob, inOutIndex); // ULWord DBB
4595  POPU32(Low, inBlob, inOutIndex); // ULWord Low
4596  POPU32(High, inBlob, inOutIndex); // ULWord High
4597  return true;
4598  }
4599 
4600 
4602  {
4603  PUSHU32(taskVersion, outBlob); // ULWord taskVersion
4604  PUSHU32(taskSize, outBlob); // ULWord taskSize
4605  PUSHU32(numTasks, outBlob); // ULWord numTasks
4606  PUSHU32(maxTasks, outBlob); // ULWord maxTasks
4607  PUSHU64(ULWord64(taskArray), outBlob); // ULWord taskArray
4608  if (taskArray && numTasks)
4609  for (ULWord num(0); num < numTasks; num++)
4610  {
4611  const AutoCircGenericTask & task (taskArray[num]);
4612  PUSHU32(task.taskType, outBlob); // AutoCircTaskType taskType
4613  const ULWord * pULWords = reinterpret_cast<const ULWord*>(&task.u);
4614  ULWord numWords(0);
4615  if (NTV2_IS_REGISTER_TASK(task.taskType))
4616  numWords = sizeof(AutoCircRegisterTask)/sizeof(ULWord);
4617  else if (NTV2_IS_TIMECODE_TASK(task.taskType))
4618  numWords = sizeof(AutoCircTimeCodeTask)/sizeof(ULWord);
4619  for (ULWord word(0); word < numWords; word++)
4620  PUSHU32(pULWords[word], outBlob);
4621  }
4622  return true;
4623  }
4624 
4625  bool AUTOCIRCULATE_TASK_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4626  { ULWord u32(0); ULWord64 u64(0);
4627  POPU32(taskVersion, inBlob, inOutIndex); // ULWord taskVersion
4628  POPU32(taskSize, inBlob, inOutIndex); // ULWord taskSize
4629  POPU32(numTasks, inBlob, inOutIndex); // ULWord numTasks
4630  POPU32(maxTasks, inBlob, inOutIndex); // ULWord maxTasks
4631  POPU64(u64, inBlob, inOutIndex); // ULWord taskArray
4632  taskArray = reinterpret_cast<AutoCircGenericTask*>(u64);
4633  if (taskArray && numTasks)
4634  for (ULWord num(0); num < numTasks; num++)
4635  {
4636  AutoCircGenericTask & task (taskArray[num]);
4637  POPU32(u32, inBlob, inOutIndex); // AutoCircTaskType taskType
4638  task.taskType = AutoCircTaskType(u32);
4639  ULWord * pULWords = reinterpret_cast<ULWord*>(&task.u);
4640  ULWord numWords(0);
4641  if (NTV2_IS_REGISTER_TASK(task.taskType))
4642  numWords = sizeof(AutoCircRegisterTask)/sizeof(ULWord);
4643  else if (NTV2_IS_TIMECODE_TASK(task.taskType))
4644  numWords = sizeof(AutoCircTimeCodeTask)/sizeof(ULWord);
4645  for (ULWord word(0); word < numWords; word++)
4646  POPU32(pULWords[word], inBlob, inOutIndex);
4647  }
4648  return true;
4649  }
4650 
4652  {
4653  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4654  PUSHU64(ULWord64(frameTime), outBlob); // LWord64 frameTime
4655  PUSHU32(frame, outBlob); // ULWord frame
4656  PUSHU64(audioClockTimeStamp, outBlob); // ULWord64 audioClockTimeStamp
4657  PUSHU32(audioExpectedAddress, outBlob); // ULWord audioExpectedAddress
4658  PUSHU32(audioInStartAddress, outBlob); // ULWord audioInStartAddress
4659  PUSHU32(audioInStopAddress, outBlob); // ULWord audioInStopAddress
4660  PUSHU32(audioOutStopAddress, outBlob); // ULWord audioOutStopAddress
4661  PUSHU32(audioOutStartAddress, outBlob); // ULWord audioOutStartAddress
4662  PUSHU32(bytesRead, outBlob); // ULWord bytesRead
4663  PUSHU32(startSample, outBlob); // ULWord startSample
4664  PUSHU64(ULWord64(currentTime), outBlob); // LWord64 currentTime
4665  PUSHU32(currentFrame, outBlob); // ULWord currentFrame
4666  currentRP188.RPCEncode(outBlob); // RP188_STRUCT currentRP188
4667  PUSHU64(ULWord64(currentFrameTime), outBlob); // LWord64 currentFrameTime
4668  PUSHU64(audioClockCurrentTime, outBlob); // ULWord64 audioClockCurrentTime
4669  PUSHU32(currentAudioExpectedAddress, outBlob); // ULWord currentAudioExpectedAddress
4670  PUSHU32(currentAudioStartAddress, outBlob); // ULWord currentAudioStartAddress
4671  PUSHU32(currentFieldCount, outBlob); // ULWord currentFieldCount
4672  PUSHU32(currentLineCount, outBlob); // ULWord currentLineCount
4673  PUSHU32(currentReps, outBlob); // ULWord currentReps
4674  PUSHU32(currenthUser, outBlob); // ULWord currenthUser
4675  return true;
4676  }
4677 
4678  bool FRAME_STAMP_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4679  { uint16_t v16(0); uint64_t v64(0);
4680  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4681  channelSpec = NTV2Crosspoint(v16);
4682  POPU64(v64, inBlob, inOutIndex); // LWord64 frameTime
4683  frameTime = LWord64(v64);
4684  POPU32(frame, inBlob, inOutIndex); // ULWord frame
4685  POPU64(audioClockTimeStamp, inBlob, inOutIndex); // ULWord64 audioClockTimeStamp
4686  POPU32(audioExpectedAddress, inBlob, inOutIndex); // ULWord audioExpectedAddress
4687  POPU32(audioInStartAddress, inBlob, inOutIndex); // ULWord audioInStartAddress
4688  POPU32(audioInStopAddress, inBlob, inOutIndex); // ULWord audioInStopAddress
4689  POPU32(audioOutStopAddress, inBlob, inOutIndex); // ULWord audioOutStopAddress
4690  POPU32(audioOutStartAddress, inBlob, inOutIndex); // ULWord audioOutStartAddress
4691  POPU32(bytesRead, inBlob, inOutIndex); // ULWord bytesRead
4692  POPU32(startSample, inBlob, inOutIndex); // ULWord startSample
4693  POPU64(v64, inBlob, inOutIndex); // LWord64 currentTime
4694  currentTime = LWord64(v64);
4695  POPU32(currentFrame, inBlob, inOutIndex); // ULWord currentFrame
4696  currentRP188.RPCDecode(inBlob, inOutIndex); // RP188_STRUCT currentRP188
4697  POPU64(v64, inBlob, inOutIndex); // LWord64 currentFrameTime
4698  currentFrameTime = LWord64(v64);
4699  POPU64(audioClockCurrentTime, inBlob, inOutIndex); // ULWord64 audioClockCurrentTime
4700  POPU32(currentAudioExpectedAddress, inBlob, inOutIndex);// ULWord currentAudioExpectedAddress
4701  POPU32(currentAudioStartAddress, inBlob, inOutIndex); // ULWord currentAudioStartAddress
4702  POPU32(currentFieldCount, inBlob, inOutIndex); // ULWord currentFieldCount
4703  POPU32(currentLineCount, inBlob, inOutIndex); // ULWord currentLineCount
4704  POPU32(currentReps, inBlob, inOutIndex); // ULWord currentReps
4705  POPU32(currenthUser, inBlob, inOutIndex); // ULWord currenthUser
4706  return true;
4707  }
4708 
4710  {
4711  PUSHU16(UWord(eCommand), outBlob); // AUTO_CIRC_COMMAND eCommand
4712  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4713  PUSHU32(ULWord(lVal1), outBlob); // LWord lVal1
4714  PUSHU32(ULWord(lVal2), outBlob); // LWord lVal2
4715  PUSHU32(ULWord(lVal3), outBlob); // LWord lVal3
4716  PUSHU32(ULWord(lVal4), outBlob); // LWord lVal4
4717  PUSHU32(ULWord(lVal5), outBlob); // LWord lVal5
4718  PUSHU32(ULWord(lVal6), outBlob); // LWord lVal6
4719  PUSHU8(bVal1, outBlob); // BOOL_ bVal1
4720  PUSHU8(bVal2, outBlob); // BOOL_ bVal2
4721  PUSHU8(bVal3, outBlob); // BOOL_ bVal3
4722  PUSHU8(bVal4, outBlob); // BOOL_ bVal4
4723  PUSHU8(bVal5, outBlob); // BOOL_ bVal5
4724  PUSHU8(bVal6, outBlob); // BOOL_ bVal6
4725  PUSHU8(bVal7, outBlob); // BOOL_ bVal7
4726  PUSHU8(bVal8, outBlob); // BOOL_ bVal8
4727  PUSHU64(ULWord64(pvVal1), outBlob); // void* pvVal1
4728  PUSHU64(ULWord64(pvVal2), outBlob); // void* pvVal2
4729  PUSHU64(ULWord64(pvVal3), outBlob); // void* pvVal3
4730  PUSHU64(ULWord64(pvVal4), outBlob); // void* pvVal4
4731  if (eCommand == eGetAutoCirc && pvVal1)
4732  reinterpret_cast<AUTOCIRCULATE_STATUS_STRUCT*>(pvVal1)->RPCEncode(outBlob);
4733  if ((eCommand == eGetFrameStamp || eCommand == eGetFrameStampEx2) && pvVal1)
4734  reinterpret_cast<FRAME_STAMP_STRUCT*>(pvVal1)->RPCEncode(outBlob);
4735  if (eCommand == eGetFrameStampEx2 && pvVal2)
4736  reinterpret_cast<AUTOCIRCULATE_TASK_STRUCT*>(pvVal2)->RPCEncode(outBlob);
4737  if (eCommand == eTransferAutoCirculate && pvVal1)
4738  reinterpret_cast<AUTOCIRCULATE_TRANSFER_STRUCT*>(pvVal1)->RPCEncode(outBlob);
4739  return true;
4740  }
4741 
4742  bool AUTOCIRCULATE_DATA::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4743  {
4744 #if defined(AJA_LINUX)
4745  #pragma GCC diagnostic push
4746  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
4747 #endif
4748  uint16_t v16(0); uint32_t v32(0);
4749  POPU16(v16, inBlob, inOutIndex); // AUTO_CIRC_COMMAND eCommand
4750  eCommand = AUTO_CIRC_COMMAND(v16);
4751  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4752  channelSpec = NTV2Crosspoint(v16);
4753  POPU32(v32, inBlob, inOutIndex); lVal1 = LWord(v32); // LWord lVal1
4754  POPU32(v32, inBlob, inOutIndex); lVal2 = LWord(v32); // LWord lVal2
4755  POPU32(v32, inBlob, inOutIndex); lVal3 = LWord(v32); // LWord lVal3
4756  POPU32(v32, inBlob, inOutIndex); lVal4 = LWord(v32); // LWord lVal4
4757  POPU32(v32, inBlob, inOutIndex); lVal5 = LWord(v32); // LWord lVal5
4758  POPU32(v32, inBlob, inOutIndex); lVal6 = LWord(v32); // LWord lVal6
4759  POPU8(AsU8Ref(bVal1), inBlob, inOutIndex); // BOOL_ bVal1
4760  POPU8(AsU8Ref(bVal2), inBlob, inOutIndex); // BOOL_ bVal2
4761  POPU8(AsU8Ref(bVal3), inBlob, inOutIndex); // BOOL_ bVal3
4762  POPU8(AsU8Ref(bVal4), inBlob, inOutIndex); // BOOL_ bVal4
4763  POPU8(AsU8Ref(bVal5), inBlob, inOutIndex); // BOOL_ bVal5
4764  POPU8(AsU8Ref(bVal6), inBlob, inOutIndex); // BOOL_ bVal6
4765  POPU8(AsU8Ref(bVal7), inBlob, inOutIndex); // BOOL_ bVal7
4766  POPU8(AsU8Ref(bVal8), inBlob, inOutIndex); // BOOL_ bVal8
4767  POPU64(AsU64Ref(pvVal1), inBlob, inOutIndex); // void* pvVal1
4768  POPU64(AsU64Ref(pvVal2), inBlob, inOutIndex); // void* pvVal2
4769  POPU64(AsU64Ref(pvVal3), inBlob, inOutIndex); // void* pvVal3
4770  POPU64(AsU64Ref(pvVal4), inBlob, inOutIndex); // void* pvVal4
4771 #if defined(AJA_LINUX)
4772  #pragma GCC diagnostic pop
4773 #endif
4774  if (eCommand == eGetAutoCirc && pvVal1)
4775  reinterpret_cast<AUTOCIRCULATE_STATUS_STRUCT*>(pvVal1)->RPCDecode(inBlob, inOutIndex);
4776  if ((eCommand == eGetFrameStamp || eCommand == eGetFrameStampEx2) && pvVal1)
4777  reinterpret_cast<FRAME_STAMP_STRUCT*>(pvVal1)->RPCDecode(inBlob, inOutIndex);
4778  if (eCommand == eGetFrameStampEx2 && pvVal2)
4779  reinterpret_cast<AUTOCIRCULATE_TASK_STRUCT*>(pvVal2)->RPCDecode(inBlob, inOutIndex);
4780  if (eCommand == eTransferAutoCirculate && pvVal1)
4781  reinterpret_cast<AUTOCIRCULATE_TRANSFER_STRUCT*>(pvVal1)->RPCDecode(inBlob, inOutIndex);
4782  return true;
4783  }
NTV2_RP188 acRP188
Will be deprecated – use AUTOCIRCULATE_TRANSFER::SetOutputTimeCode instead.
bool AppendU8s(UByteSequence &outU8s) const
Appends my contents to an existing UByteSequence.
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
NTV2Channel mChannel
Stream channel.
bool SetOutputTimeCodes(const NTV2TimeCodes &inValues)
Intended for playout, replaces the contents of my acOutputTimeCodes member.
std::set< NTV2VideoFormat > NTV2VideoFormatSet
A set of distinct NTV2VideoFormat values.
NTV2SegmentedXferInfo & setSourceDirection(const bool inTopDown)
Sets the scan direction for the source.
NTV2AutoCirculateState state
ULWord acCurrentAudioStartAddress
As set by play.
static std::string FourCCToString(const ULWord in4CC)
NTV2Buffer acOutputTimeCodes
Intended for playout, this is an ordered sequence of NTV2_RP188 values to send to the device...
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3630
bool GetBadRegisters(NTV2RegNumSet &outBadRegNums) const
Returns the set of register numbers that were not read successfully.
NTV2StandardSet::const_iterator NTV2StandardSetConstIter
A handy const iterator for iterating over an NTV2StandardSet.
#define NTV2_TYPE_AJABITSTREAM
Identifies NTV2Bitstream struct.
ULWord mFlags
Action flags.
ULWord audioInStopAddress
For record - end position (exclusive) in buffer of audio (includes base offset)
std::string NTV2FrameGeometryToString(const NTV2FrameGeometry inValue, const bool inForRetailDisplay=false)
defined(NTV2_DEPRECATE_17_6)
Definition: ntv2utils.cpp:7318
bool GetRequestedRegisterNumbers(NTV2RegNumSet &outRegNums) const
Answers with the set of register numbers that were requested.
std::string NTV2AudioSystemToString(const NTV2AudioSystem inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:5747
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
ULWord frame
The frame requested or -1 if not available.
#define NTV2EndianSwap64(__val__)
Definition: ntv2endian.h:25
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
std::string NTV2HDMIBitDepthToString(const NTV2HDMIBitDepth inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6647
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
std::string operator[](const unsigned inIndexNum) const
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3898
#define AJA_NTV2_SDK_BUILD_NUMBER
The SDK build number, an unsigned decimal integer.
Definition: ntv2version.h:16
#define NTV2_HEADER_TAG
Identifies the struct header.
ULWord acCurrentFrame
Last vertical blank frame for this autocirculate channel (when CNTV2Card::AutoCirculateGetFrameStamp ...
void POPU16(uint16_t &outVal, const RPCBlob &inArr, std::size_t &inOutNdx, const bool dontSwap=false)
Definition: ntv2nubtypes.h:61
NTV2OutputDestinations::const_iterator NTV2OutputDestinationsConstIter
A handy const iterator for iterating over an NTV2OutputDestinations.
bool CopyTo(FRAME_STAMP_STRUCT &outOldStruct) const
Copies my fields into the given FRAME_STAMP_STRUCT.
YCbCr color space.
Definition: ntv2enums.h:3612
For devices that support it (see NTV2DeviceCanDoSDIErrorChecks ), this struct reports SDI input error...
bool PutU16s(const UWordSequence &inU16s, const size_t inU16Offset=0, const bool inByteSwap=false)
Copies a vector of unsigned 16-bit values into me.
void PUSHU16(const uint16_t inVal, RPCBlob &inArr, const bool dontSwap=false)
Definition: ntv2nubtypes.h:31
Specifies SDI input/output kinds.
Definition: ntv2enums.h:1294
std::set< NTV2TCIndex > NTV2TCIndexes
ULWord currentAudioStartAddress
As found by isr.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
FRAME_STAMP()
Constructs a default FRAME_STAMP structure.
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
ULWord64 acInUserCookie
Intended for playout, an optional app-specific cookie value that tags this frame, such that if this s...
void SetFlags(const ULWord inFlags)
Sets the action flags for use in a subsequent call to CNTV2Card::LoadBitstream.
#define NTV2HostIsBigEndian
Definition: ntv2endian.h:58
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
bool GetSDIInputStatus(NTV2SDIInputStatus &outStatus, const UWord inSDIInputIndex0=0) const
Answers with the NTV2SDIInputStatus for the given SDI input spigot.
bool is_legal_decimal_number(const std::string &inStr, const size_t inMaxLength)
Definition: common.cpp:526
NTV2Buffer & operator=(const NTV2Buffer &inRHS)
Assigns me from another NTV2Buffer instance.
LWord64 currentTime
Current processor time ... on Windows, this is derived from KeQueryPerformanceCounter.
NTV2SetRegisters(const NTV2RegWrites &inRegWrites=NTV2RegWrites())
Constructs an NTV2SetRegisters struct from the given NTV2RegisterWrites collection.
Declares the AJAMemory class.
std::set< NTV2FrameRate > NTV2FrameRateSet
A set of distinct NTV2FrameRate values. New in SDK 17.0.
NTV2StreamBuffer()
Constructs a default NTV2StreamBuffer struct.
NTV2Crosspoint
Logically, these are an NTV2Channel combined with an NTV2Mode.
Definition: ntv2enums.h:1703
mVideoBuffer Allocate(mFormatDesc.GetTotalRasterBytes())
std::ostream & Print(std::ostream &inStrm, const bool inDumpSegments=false) const
Writes a human-readable description of me into a given output stream.
bool CopyTo(AUTOCIRCULATE_STATUS_STRUCT &outOldStruct)
Copies my data into the given AUTOCIRCULATE_STATUS_STRUCT.
unsigned long long stoull(const std::string &str, std::size_t *idx, int base)
Definition: common.cpp:154
ULWord registerMask
My register mask value to use in a ReadRegister or WriteRegister call.
bool SetFrameBufferFormat(const NTV2FrameBufferFormat inNewFormat)
Sets my acFrameBufferFormat value to the given new value (if valid and circulating with AUTOCIRCULATE...
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds=NTV2_DEVICEKIND_ALL)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7733
std::vector< double > NTV2DoubleArray
An array of double-precision floating-point values.
NTV2HDMIColorSpace
Indicates or specifies HDMI Color Space.
Definition: ntv2enums.h:3608
#define NTV2_IS_TIMECODE_TASK(_x_)
void Clear(void)
Resets the struct to its initialized state, with timecode capture disabled, freeing all buffers that ...
bool WithCustomAnc(void) const
bool IsNULL(void) const
NTV2Buffer mSharedMemory
Virtual address of AJADebug shared memory in calling process&#39; context,.
ULWord audioOutStartAddress
For play - end position (exclusive) in buffer of audio.
NTV2RegNumSet GetRegisterNumbers(const NTV2RegReads &inRegInfos)
std::ostream & Print(std::ostream &outputStream, const bool inAsCode=false) const
Renders me to the given output stream in a human-readable format.
#define DEC0N(__x__, __n__)
ULWord getElementLength(void) const
NTV2RegInfo & setMask(const ULWord val)
string NTV2ChannelSetToStr(const NTV2ChannelSet &inObj, const bool inCompact)
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:361
ULWord mFlags
Action flags.
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:221
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
bool EnableSegmentedDMAs(const ULWord inNumSegments, const ULWord inNumActiveBytesPerLine, const ULWord inHostBytesPerLine, const ULWord inDeviceBytesPerLine)
Enables segmented DMAs given a segment count, a host pitch, and device pitch value.
NTV2ChannelSet::const_iterator NTV2ChannelSetConstIter
A handy const iterator into an NTV2ChannelSet.
ULWord getTotalBytes(void) const
bool SetBuffers(ULWord *pInVideoBuffer, const ULWord inVideoByteCount, ULWord *pInAudioBuffer, const ULWord inAudioByteCount, ULWord *pInANCBuffer, const ULWord inANCByteCount, ULWord *pInANCF2Buffer=NULL, const ULWord inANCF2ByteCount=0)
Sets my buffers for use in a subsequent call to CNTV2Card::AutoCirculateTransfer. ...
NTV2_HEADER acHeader
The common message header – ALWAYS FIRST!
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
#define NTV2_IS_VALID_TRAILER_TAG(_x_)
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
NTV2StringSet::const_iterator NTV2StringSetConstIter
~AUTOCIRCULATE_TRANSFER()
My default destructor, which frees all allocatable fields that I own.
Declares the AJADebug class.
bool CopyFrom(const void *pInSrcBuffer, const ULWord inByteCount)
Replaces my contents from the given memory buffer, resizing me to the new byte count.
720x576, for PAL 625i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:360
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:224
#define GetTCIndexesForSDIInput
Definition: ntv2utils.h:593
bool Set(const NTV2ColorCorrectionMode inMode, const ULWord inSaturation, const void *pInTableData)
Sets this struct from the given mode, saturation and table data, replacing any existing mode...
static ULWord FGWidth(const NTV2FrameGeometry fg)
std::set< NTV2InputSource > NTV2InputSourceSet
A set of distinct NTV2InputSource values.
ULWord acCurrentReps
Contains validCount (Playout: on repeated frames, number of reps remaining; Record: drops on frame) ...
bool NTV2GetUnsupportedStandards(NTV2StandardSet &outStandards)
Returns a set of NTV2Standard values not suported by any NTV2 device.
ULWord acAudioInStopAddress
(input/ingest/capture only) Ending audio record head position (exclusive) AFTER this frame was stampe...
1280x720, for 720p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:354
std::string NTV2OutputDestinationToString(const NTV2OutputDestination inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7402
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
int Fixed_
Definition: ajatypes.h:302
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
size_t GetByteCount(void) const
static bool SetDefaultPageSize(const size_t inNewSize)
Changes the default page size for use in future page-aligned allocations.
bool ByteSwap32(void)
Byte-swaps my contents 32-bits at a time.
ULWord GetBufferLevel(void) const
NTV2StringList::const_iterator NTV2StringListConstIter
enum NTV2VideoFrameBufferOrientation NTV2FBOrientation
bool WithFBOChange(void) const
bool IsContentEqual(const NTV2Buffer &inBuffer, const ULWord inByteOffset=0, const ULWord inByteCount=0xFFFFFFFF) const
AutoCircVidProcInfo acVidProcInfo
Specifies the mixer/keyer transition to make. Ignored if AUTOCIRCULATE_WITH_VIDPROC option is not set...
bool isSourceTopDown(void) const
NTV2SDIInStatistics()
Constructs an NTV2GetSDIStatistics struct and initializes it to its default state.
void SetMaxLockSize(const ULWord64 inNumBytes)
Sets the maximum lock size for use in a subsequent call to CNTV2Card::DMABufferLock.
bool ResetUsing(const NTV2RegNumSet &inRegisterNumbers)
Resets me, starting over, now using the given NTV2RegisterNumberSet.
void PUSHU8(const uint8_t inVal, RPCBlob &inArr)
Definition: ntv2nubtypes.h:26
NTV2TimeCodeList::const_iterator NTV2TimeCodeListConstIter
A handy const interator for iterating over an NTV2TimeCodeList.
AutoCircTaskType
These are the available AutoCirculate task types.
uint32_t U32(const int inIndex) const
ULWord acAudioStartSample
Starting audio sample (valid for capture only).
AutoCircVidProcMode
ULWordSequence::const_iterator ULWordSequenceConstIter
A handy const iterator for iterating over a ULWordSequence.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
AUTOCIRCULATE_TRANSFER_STATUS()
Constructs a default AUTOCIRCULATE_TRANSFER_STATUS structure.
ULWord bytesRead
Total audio and video bytes transfered.
bool IsValid(void) const
Answers true if I&#39;m valid, or false if I&#39;m not valid.
NTV2_TRAILER acTrailer
The common structure trailer – ALWAYS LAST!
#define NTV2_TYPE_AJAMAILBUFFER
Identifies NTV2MailBuffer struct.
ULWord audioExpectedAddress
The address that was used to transfer.
NTV2RegWrites::const_iterator NTV2RegisterWritesConstIter
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex, bool fillBuffer=true)
LWord acStartFrame
First frame to circulate. FIXFIXFIX Why is this signed? CHANGE TO ULWord??
#define NTV2SDKVersionDecode_Minor
std::map< ULWord, ULWord > NTV2RegisterValueMap
A mapping of distinct NTV2RegisterNumbers to their corresponding ULWord values.
ULWord getDestPitch(void) const
std::string NTV2RegisterNumberToString(const NTV2RegisterNumber inValue)
Definition: ntv2utils.cpp:7901
ULWordSetConstIter NTV2RegNumSetConstIter
A const iterator that iterates over a set of distinct NTV2RegisterNumbers.
bool PutU64s(const ULWord64Sequence &inU64s, const size_t inU64Offset=0, const bool inByteSwap=false)
Copies a vector of unsigned 64-bit values into me.
NTV2SegmentedDMAInfo()
Constructs a disabled NTV2SegmentedDMAInfo struct.
int32_t LWord
Definition: ajatypes.h:235
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
NTV2Buffer acVideoBuffer
The host video buffer. This field is owned by the client application, and thus is responsible for all...
#define AUTOCIRCULATE_WITH_FBFCHANGE
Use this to AutoCirculate with the possibility of frame buffer format changes.
ULWord mIsWriting
If non-zero, virtual data will be written; otherwise, virtual data will be read.
Specifies HDMI input/output kinds.
Definition: ntv2enums.h:1295
LWord64 acFrameTime
(input/ingest/capture only) The absolute timestamp at the VBI when the frame started recording into d...
NTV2AudioSystemSet NTV2MakeAudioSystemSet(const NTV2AudioSystem inFirstAudioSystem, const UWord inCount)
NTV2ChannelSet NTV2MakeChannelSet(const NTV2Channel inFirstChannel, const UWord inNumChannels)
ULWord ccSaturationValue
My saturation value, used only in 3-way color correction mode.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
if(!(riid==IID_IUnknown) &&!(riid==IID_IClassFactory))
Definition: dllentry.cpp:196
FRAME_STAMP acFrameStamp
Frame stamp for the transferred frame.
AUTOCIRCULATE_DATA(const AUTO_CIRC_COMMAND inCommand=AUTO_CIRC_COMMAND_INVALID, const NTV2Crosspoint inCrosspoint=NTV2CROSSPOINT_INVALID)
void POPU8(uint8_t &outVal, const RPCBlob &inArr, std::size_t &inOutNdx)
Definition: ntv2nubtypes.h:56
NTV2RegisterReadsConstIter FindFirstMatchingRegisterNumber(const uint32_t inRegNum, const NTV2RegisterReads &inRegInfos)
Returns a const iterator to the first entry in the NTV2RegInfo collection with a matching register nu...
std::string NTV2ColorCorrectionModeToString(const NTV2ColorCorrectionMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:7921
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
NTV2AudioChannelQuads::const_iterator NTV2AudioChannelQuadsConstIter
Handy const iterator to iterate over a set of distinct NTV2AudioChannelQuad values.
bool containsElementAtOffset(const ULWord inElementOffset) const
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
bool DisableSegmentedDMAs(void)
Disables segmented DMAs, performing a Reset on my acInSegmentedDMAInfo.
LWord64 acCurrentTime
The absolute timestamp at the moment the CNTV2Card::AutoCirculateTransfer or CNTV2Card::AutoCirculate...
Defines a number of handy byte-swapping macros.
bool GetGoodRegisters(NTV2RegNumSet &outGoodRegNums) const
Returns an NTV2RegNumSet built from my mOutGoodRegisters field.
The "default" timecode (mostly used by the AJA "Retail" service and Control Panel) ...
Definition: ntv2enums.h:3956
bool SetOutputTimeCode(const NTV2_RP188 &inTimecode, const NTV2TCIndex inTCIndex=NTV2_TCINDEX_SDI1)
Intended for playout, sets one element of my acOutputTimeCodes member.
ULWord value(void) const
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
bool NTV2DeviceCanDoFrameBufferFormat(const NTV2DeviceID inDeviceID, const NTV2FrameBufferFormat inFBFormat)
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
NTV2FrameBufferFormatSet NTV2PixelFormats
#define NTV2_IS_VALID_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3987
ULWord currentFrame
Last vertical blank frame for this channel&#39;s auto-circulate. (at the time of the IOCTL_NTV2_GET_FRAME...
static string print_address_offset(const size_t inRadix, const ULWord64 inOffset)
2048x1080, for 2Kx1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:366
Definition: json.hpp:5362
FGSizesMap::const_iterator FGSizesMapCI
NTV2HDMIAudioChannels
Indicates or specifies the HDMI audio channel count.
Definition: ntv2enums.h:3670
NTV2FBOrientation acFrameBufferOrientation
Specifies the frame buffer orientation to change to. Ignored if AUTOCIRCULATE_WITH_FBOCHANGE option i...
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me into the given output stream.
std::set< NTV2OutputDestination > NTV2OutputDestinations
A set of distinct NTV2OutputDestination values.
bool isSourceBottomUp(void) const
ULWord acInVideoDMAOffset
Optional byte offset into the device frame buffer. Defaults to zero. If non-zero, should be a multipl...
#define NTV2_TYPE_GETREGS
Identifies NTV2GetRegisters struct.
#define NTV2_COLORCORRECTOR_TABLESIZE
#define false
ULWord mTag
Tag for virtual data. This value is used to recal saved data by tag.
LWord acActiveFrame
Current frame actually being captured/played when CNTV2Card::AutoCirculateGetStatus called...
bool GetFailedRegisterWrites(NTV2RegWrites &outFailedRegWrites) const
Returns an NTV2RegisterWrites built from my mOutBadRegInfos field.
#define NTV2_TYPE_ACSTATUS
Identifies AUTOCIRCULATE_STATUS struct.
#define AJA_NTV2_SDK_VERSION_POINT
The SDK "point" release version, an unsigned decimal integer.
Definition: ntv2version.h:15
NTV2HDMIRange
Indicates or specifies the HDMI RGB range.
Definition: ntv2enums.h:3638
uint32_t ULWord
Definition: ajatypes.h:236
NTV2SegmentedXferInfo & setElementLength(const ULWord inBytesPerElement)
Sets my element length.
NTV2AudioFormat
Definition: ntv2enums.h:1954
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1359
bool toHexString(std::string &outStr, const size_t inLineBreakInterval=0) const
Converts my contents into a hex-encoded string.
std::string NTV2AudioFormatToString(const NTV2AudioFormat inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6704
Describes a segmented data transfer (copy or move) from a source memory location to a destination loc...
#define NTV2_TYPE_BANKGETSET
Identifies NTV2BankSelGetSetRegs struct.
std::vector< NTV2RegInfo > NTV2RegWrites
An ordered sequence of zero or more NTV2RegInfo structs intended for WriteRegister.
virtual char do_thousands_sep() const
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
Specifies devices that internally use NTV2.
Definition: ntv2enums.h:1400
NTV2FrameRateSet::const_iterator NTV2FrameRateSetConstIter
A handy const iterator for iterating over an NTV2FrameRateSet.
NTV2FrameGeometry GetGeometryFromFrameDimensions(const NTV2FrameSize &inFD)
Definition: ntv2utils.cpp:3957
std::set< NTV2AudioChannelPair > NTV2AudioChannelPairs
A set of distinct NTV2AudioChannelPair values.
NTV2SegmentedXferInfo & swapSourceAndDestination(void)
Swaps my source and destination offsets, pitches and scan directions.
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
#define NTV2_TYPE_ACXFER
Identifies AUTOCIRCULATE_TRANSFER struct.
std::set< NTV2AudioChannelQuad > NTV2AudioChannelQuads
A set of distinct NTV2AudioChannelQuad values.
#define NTV2_OUTPUT_DEST_IS_HDMI(_dest_)
Definition: ntv2enums.h:1346
string NTV2ChannelListToStr(const NTV2ChannelList &inObj, const bool inCompact)
std::set< NTV2Standard > NTV2StandardSet
A set of distinct NTV2Standard values.
NTV2Crosspoint acCrosspoint
Will be deprecated – used internally by the SDK. Will be removed when the driver changes to use NTV2...
bool CopyFrom(const AUTOCIRCULATE_STATUS_STRUCT &inOldStruct)
Copies the given AUTOCIRCULATE_STATUS_STRUCT into me.
#define BIN08(__x__)
ULWord GetProcessedFrameCount(void) const
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:489
std::string AsString(UWord inDumpMaxBytes=0) const
ULWord mFlags
Action flags (lock, unlock, etc)
bool GetInputTimeCodes(NTV2TimeCodeList &outValues) const
Returns all RP188 timecodes associated with the frame in NTV2TCIndex order.
Represents an unknown or invalid frame rate.
Definition: ntv2enums.h:416
std::string operator[](const unsigned inIndexNum) const
std::vector< uint8_t > UByteSequence
An ordered sequence of UByte (uint8_t) values.
NTV2AutoCirculateState acState
Current AutoCirculate state after the transfer.
static AJAStatus StatTimerStop(const uint32_t inKey)
Definition: debug.cpp:1155
bool NTV2DeviceGetSupportedStandards(const NTV2DeviceID inDeviceID, NTV2StandardSet &outStandards)
Returns a set of distinct NTV2Standard values supported on the given device.
NTV2RegWritesConstIter NTV2RegisterReadsConstIter
bool Truncate(const size_t inByteCount)
Truncates me to the given length. No reallocation takes place.
This struct replaces the old RP188_STRUCT.
NTV2GeometrySet::const_iterator NTV2GeometrySetConstIter
A handy const iterator for iterating over an NTV2GeometrySet.
NTV2FrameBufferFormat NTV2PixelFormat
An alias for NTV2FrameBufferFormat.
Definition: ntv2enums.h:262
NTV2_HEADER acHeader
The common structure header – ALWAYS FIRST!
NTV2ColorCorrectionMode ccMode
My mode (off, RGB, YCbCr, or 3-way)
Last virtual register slot.
NTV2_TRAILER acTrailer
The common message trailer – ALWAYS LAST!
NTV2BankSelGetSetRegs(const NTV2RegInfo &inBankSelect, const NTV2RegInfo &inRegInfo, const bool inDoWrite=false)
Constructs an NTV2BankSelGetSetRegs struct for atomically reading or writing the given bank-selected ...
ULWord regNum(void) const
unsigned long stoul(const std::string &str, std::size_t *idx, int base)
Definition: common.cpp:143
NTV2RegInfo & setRegNum(const ULWord val)
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:364
NTV2TCIndex
These enum values are indexes into the capture/playout AutoCirculate timecode arrays.
Definition: ntv2enums.h:3954
bool Fill(const T &inValue)
Fills me with the given scalar value.
bool Find(const T &inValue, int &inOutIndex) const
Searches me for the given scalar value of type T starting at a given index position.
bool GetString(std::string &outString, const size_t inU8Offset=0, const size_t inMaxSize=128) const
Answers with my contents as a character string.
bool GetRegisterValues(NTV2RegisterValueMap &outValues) const
Returns an NTV2RegisterValueMap built from my mOutGoodRegisters and mOutValues fields.
std::string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7379
bool Deallocate(void)
Deallocates my user-space storage (if I own it – i.e. from a prior call to Allocate).
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
void Clear(void)
Resets me to an invalid state.
void POPU64(uint64_t &outVal, const RPCBlob &inArr, std::size_t &inOutNdx, const bool dontSwap=false)
Definition: ntv2nubtypes.h:78
ULWord currentReps
At Call Line# currently being OUTPUT (at the time of the IOCTL_NTV2_GET_FRAMESTAMP) ...
NTV2Channel NTV2OutputDestinationToChannel(const NTV2OutputDestination inOutputDest)
Converts a given NTV2OutputDestination to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5157
std::string AutoCircVidProcModeToString(const AutoCircVidProcMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:7907
UWord NTV2DeviceGetNumHDMIVideoOutputs(const NTV2DeviceID inDeviceID)
ULWord mInNumRegisters
The number of NTV2RegInfo&#39;s to be set.
static bool IsReadOnly(const uint32_t inRegNum)
AutoCircVidProcMode mode
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:414
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
NTV2FrameBufferFormat acFrameBufferFormat
Specifies the frame buffer format to change to. Ignored if AUTOCIRCULATE_WITH_FBFCHANGE option is not...
std::string NTV2StandardToString(const NTV2Standard inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6912
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
#define NTV2_TYPE_SDISTATS
Identifies NTV2SDIStatus struct.
std::string NTV2AudioChannelQuadToString(const NTV2Audio4ChannelSelect inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6445
2048x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:358
#define BIN032(__x__)
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:167
#define NTV2_TYPE_VIRTUAL_DATA_RW
Identifies NTV2VirtualData struct.
NTV2ColorCorrectionData acColorCorrection
Color correction data. This field is ignored if AUTOCIRCULATE_WITH_COLORCORRECT option is not set...
ULWord registerValue
My register value to use in a ReadRegister or WriteRegister call.
bool IsAllocatedBySDK(void) const
ULWord acOptionFlags
AutoCirculate options used when CNTV2Card::AutoCirculateInitForInput or CNTV2Card::AutoCirculateInitF...
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
ULWord registerNumber
My register number to use in a ReadRegister or WriteRegister call.
NTV2Buffer mBuffer
Virtual address of a buffer to prelock, and its length.
bool NTV2DeviceCanDoVideoFormat(const NTV2DeviceID inDeviceID, const NTV2VideoFormat inVideoFormat)
bool NTV2DeviceGetSupportedOutputDests(const NTV2DeviceID inDeviceID, NTV2OutputDestinations &outOutputDests, const NTV2IOKinds inKinds)
Returns a set of distinct NTV2OutputDest values supported on the given device.
ULWord acAncTransferSize
Total ancillary data bytes for field 1 transferred (capture only).
#define YesNo(__x__)
This is used to perform virtual data reads or writes.
enum NTV2QuarterSizeExpandMode NTV2QtrSizeExpandMode
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:352
ULWord mStatus
Action status.
bool PatchRegister(const ULWord inRegNum, const ULWord inValue)
Patches the given register value.
ULWord64 acRDTSCCurrentTime
Timestamp when CNTV2Card::AutoCirculateGetStatus called, using the host OS system clock...
#define NTV2_IS_ATC_VITC2_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3994
#define NTV2_TYPE_ACXFERSTATUS
Identifies AUTOCIRCULATE_TRANSFER_STATUS struct.
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
else
Definition: ntv2vcam.cpp:789
#define AJA_NTV2_SDK_VERSION_MAJOR
The SDK major version number, an unsigned decimal integer.
Definition: ntv2version.h:13
bool WithHDMIAuxData(void) const
NTV2DeviceIDSet::const_iterator NTV2DeviceIDSetConstIter
A convenient const iterator for NTV2DeviceIDSet.
Definition: ntv2utils.h:1046
std::set< std::string > NTV2StringSet
#define NTV2_TYPE_AJABUFFERLOCK
Identifies NTV2BufferLock struct.
std::ostream & Print(std::ostream &inOutStream) const
RGB color space.
Definition: ntv2enums.h:3611
#define NTV2_INPUT_SOURCE_IS_HDMI(_inpSrc_)
Definition: ntv2enums.h:1283
#define AsU8Ref(_x_)
NTV2VideoFormatSet::const_iterator NTV2VideoFormatSetConstIter
A handy const iterator for iterating over an NTV2VideoFormatSet.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
Specifies analog input/output kinds.
Definition: ntv2enums.h:1296
NTV2Buffer & Segment(NTV2Buffer &outPtr, const ULWord inByteOffset, const ULWord inByteCount) const
Resets an NTV2Buffer instance to reference a contiguous segment (portion) of my memory buffer...
void SetFlags(const ULWord inFlags)
Sets the action flags for use in a subsequent call to CNTV2Card::DMABufferLock.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
#define NTV2SDKVersionEncode
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
1280x720, for 720p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:362
NTV2Channel mChannel
Stream channel.
NTV2MailBuffer()
Constructs a default NTV2MailBuffer struct.
#define AJA_NULL
Definition: ajatypes.h:180
#define NTV2_IS_VALID_IOKINDS(_k_)
Definition: ntv2enums.h:1314
NTV2ChannelList NTV2MakeChannelList(const NTV2Channel inFirstChannel, const UWord inNumChannels)
Declares the CRP188 class. See SMPTE RP188 standard for details.
NTV2TimeCodes::const_iterator NTV2TimeCodesConstIter
A handy const interator for iterating over NTV2TCIndex/NTV2TimeCodeList pairs.
NTV2AutoCirculateState acState
Current AutoCirculate state.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
std::vector< ULWord > NTV2ULWordVector
An ordered sequence of ULWords.
std::string NTV2HDMIProtocolToString(const NTV2HDMIProtocol inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6670
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
bool SetBuffer(const NTV2Buffer &inBuffer)
Sets the buffer to lock for use in a subsequent call to CNTV2Card::LoadBitstream. ...
Defines for the NTV2 SDK version number, used by ajantv2/includes/ntv2enums.h. See the ajantv2/includ...
ULWord64 acAudioClockCurrentTime
The absolute timestamp at the moment the CNTV2Card::AutoCirculateTransfer or CNTV2Card::AutoCirculate...
bool SetFrom(const NTV2Buffer &inBuffer)
Replaces my contents from the given memory buffer without resizing me.
NTV2ColorCorrectionMode
Definition: ntv2enums.h:2082
ULWord fTrailerVersion
Trailer version, set when created. Before SDK 15.1: always zero; 15.1 or later: set to calling SDK ve...
bool IsStopped(void) const
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
This is used to atomically perform bank-selected register reads or writes.
ULWord64 acRDTSCStartTime
Timestamp of the first VBI received after CNTV2Card::AutoCirculateStart called, using host OS system ...
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
ULWord acRequestedFrame
On entry for NTV2_TYPE_ACFRAMESTAMP message, the requested frame. Upon exit, 0xFFFFFFFF means "not ...
ULWord acFramesDropped
Total number of frames dropped since AutoCirculateStart.
bool ImportFromLog(const NTV2StringList &inLogLines)
Resets me using the given "Number:" and "Value:" lines from the support log.
Specifies any/all devices.
Definition: ntv2enums.h:1382
ULWord acAudioTransferSize
Number of bytes captured into the audio buffer.
#define NTV2_TYPE_AJADEBUGLOGGING
Identifies NTV2DebugLogging struct.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
bool RPCDecodeServer(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
int64_t LWord64
Definition: ajatypes.h:238
All new NTV2 structs start with this common header.
std::ostream & PrintLog(std::ostream &outputStream, const NTV2DeviceID inDeviceID=DEVICE_ID_INVALID) const
Renders me to the given output stream in "supportlog" format.
static size_t DefaultPageSize(void)
NTV2RegWrites NTV2RegisterReads
ULWord registerShift
My register shift value to use in a ReadRegister or WriteRegister call.
ULWord acSegmentDevicePitch
Offset, in bytes, between the start of one device segment and the start of the next device segment (i...
bool operator<(const NTV2RegInfo &inRHS) const
bool SetFromHexString(const std::string &inStr)
Replaces my contents from the given hex-encoded string, resizing me if necessary. ...
std::vector< uint16_t > UWordSequence
An ordered sequence of UWord (uint16_t) values.
NTV2Buffer mInRegInfos
NTV2RegInfo array of registers be read/written. The SDK owns this memory.
std::set< NTV2FrameGeometry > NTV2GeometrySet
A set of distinct NTV2FrameGeometry values.
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
ULWord acAncField2TransferSize
Total ancillary data bytes for field 2 transferred (capture only).
AUTOCIRCULATE_STATUS(const NTV2Crosspoint inCrosspoint=NTV2CROSSPOINT_CHANNEL1)
Constructs a default AUTOCIRCULATE_STATUS struct for the given NTV2Crosspoint.
string NTV2AudioSystemSetToStr(const NTV2AudioSystemSet &inObj, const bool inCompact)
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
ULWord64 acAudioClockCurrentTime
Timestamp when CNTV2Card::AutoCirculateGetStatus called, using "64-bit clean" value of the device&#39;s 4...
UWordSequence::const_iterator UWordSequenceConstIter
A handy const iterator for iterating over a UWordSequence.
std::string NTV2HDMIAudioChannelsToString(const NTV2HDMIAudioChannels inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6659
std::set< NTV2AudioSystem > NTV2AudioSystemSet
A set of distinct NTV2AudioSystem values. New in SDK 16.2.
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Definition: ntv2utils.cpp:6748
~NTV2ColorCorrectionData()
My destructor, which frees my private color correction table buffer.
NTV2HDMIProtocol
Indicates or specifies the HDMI protocol.
Definition: ntv2enums.h:3624
The AutoCirculate channel is starting, waiting for the start time specified in the call to CNTV2Card:...
bool NTV2GetUnsupportedPixelFormats(NTV2PixelFormats &outFormats)
Returns a set of NTV2PixelFormat values not suported by any NTV2 device.
#define NTV2_IS_VALID_STANDARD(__s__)
Definition: ntv2enums.h:190
#define NTV2_TYPE_ACFRAMESTAMP
Identifies FRAME_STAMP struct.
ULWord acFrameRepeatCount
Intended for playout. The number of times to repeat the frame being transferred.
ULWord GetDroppedFrameCount(void) const
Declares data types and structures used in NTV2 "nub" packets.
UWord NTV2DeviceGetNumAnalogVideoOutputs(const NTV2DeviceID inDeviceID)
LWord acTransferFrame
Frame buffer number the frame was transferred to/from. (-1 if failed)
std::string getSourceCode(const bool inInclDecl=true) const
bool SwapWith(NTV2Buffer &inBuffer)
Swaps my underlying buffer with another&#39;s.
bool RPCEncodeServer(NTV2_RPC_BLOB_TYPE &inBlob)
ULWord64 audioClockCurrentTime
48kHz clock in reg 28 extended to 64 bits
ULWord acCurrentFieldCount
As found by ISR at Call Field0 or Field1 currently being OUTPUT (when CNTV2Card::AutoCirculateGetFram...
#define oOCT(__x__)
The AutoCirculate channel is stopped.
ULWord64 acAudioClockStartTime
Timestamp of the first VBI received after CNTV2Card::AutoCirculateStart called, using "64-bit clean" ...
bool WithRP188(void) const
#define AUTOCIRCULATE_WITH_ANC
Use this to AutoCirculate with ancillary data.
LWord acEndFrame
Last frame to circulate. FIXFIXFIX Why is this signed? CHANGE TO ULWord??
uint64_t ULWord64
Definition: ajatypes.h:239
std::string NTV2TCIndexToString(const NTV2TCIndex inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6396
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
void Clear(void)
Constructs a default NTV2SDIInputStatus.
NTV2DIDSet::const_iterator NTV2DIDSetConstIter
Handy const iterator to iterate over an NTV2DIDSet.
LWord GetActiveFrame(void) const
std::string NTV2AudioChannelOctetToString(const NTV2Audio8ChannelSelect inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6457
ostream & NTV2PrintChannelSet(const NTV2ChannelSet &inObj, const bool inCompact, ostream &inOutStream)
ULWord getDestOffset(void) const
bool NTV2DeviceGetSupportedVideoFormats(const NTV2DeviceID inDeviceID, NTV2VideoFormatSet &outFormats)
Returns a set of distinct NTV2VideoFormat values supported on the given device.
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
#define NTV2_IS_VALID_STRUCT_TYPE(_x_)
uint8_t UByte
Definition: ajatypes.h:231
NTV2Crosspoint channelSpec
bool IsPageAligned(void) const
This is used by the CNTV2Card::ReadRegisters function.
NTV2Buffer(const void *pInUserPointer, const size_t inByteCount)
Constructs me from a client-supplied address and size.
bool RPCDecodeClient(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
1920x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:357
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
#define NTV2_OUTPUT_DEST_IS_ANALOG(_dest_)
Definition: ntv2enums.h:1347
720x486, for NTSC 525i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:359
std::string NTV2AudioChannelPairToString(const NTV2AudioChannelPair inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6433
ULWord64 acCurrentUserCookie
The frame&#39;s AUTOCIRCULATE_TRANSFER::acInUserCookie value that was set when CNTV2Card::AutoCirculateTr...
ULWord acCurrentLineCount
At Call Line# currently being OUTPUT (at the time of the IOCTL_NTV2_GET_FRAMESTAMP) ...
NTV2Crosspoint backgroundVideoCrosspoint
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
#define NTV2_CURRENT_HEADER_VERSION
Current version of NTV2_HEADER struct, originally 0.
std::ostream & PrintCode(std::ostream &outputStream, const int inRadix=16, const NTV2DeviceID inDeviceID=DEVICE_ID_INVALID, const std::string &sCard="card") const
Renders me to the given output stream as source code using a "WriteRegister" function call...
ostream & operator<<(ostream &inOutStream, const NTV2StringList &inData)
void Clear(void)
Clears my data.
LWord acDesiredFrame
Used to specify a different frame in the circulate ring to transfer to/from.
bool NTV2GetSupportedPixelFormats(NTV2PixelFormats &outFormats)
Returns a set of all NTV2PixelFormat values supported (used) by any/all supported NTV2 devices...
void Set(const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow, const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
Sets the NTV2SegmentedDMAInfo struct members.
This is used to prelock a video/audio/anc buffer used as the source or target of DMA transfers...
bool NTV2DeviceCanDoInputSource(const NTV2DeviceID inDeviceID, const NTV2InputSource inInputSource)
bool ByteSwap16(void)
Byte-swaps my contents 16-bits at a time.
#define NTV2_OUTPUT_DEST_IS_SDI(_dest_)
Definition: ntv2enums.h:1348
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me into the given output stream.
NTV2AutoCirculateState
Describes the state of an AutoCirculate channel. See AUTOCIRCULATE_STATUS.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
#define VIRTUALREG_START
ULWord getTotalElements(void) const
std::ostream & Print(std::ostream &oss) const
#define NTV2_IS_VALID_CHANNEL(__x__)
Definition: ntv2enums.h:1373
This is used for bitstream maintainance. (New in SDK 16.0)
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
ULWord audioInStartAddress
For record - first position in buffer of audio (includes base offset)
ostream & NTV2PrintULWordVector(const NTV2ULWordVector &inObj, ostream &inOutStream)
NTV2BufferLock()
Constructs a default NTV2BufferLock struct.
std::map< NTV2TCIndex, NTV2_RP188 > NTV2TimeCodes
A mapping of NTV2TCIndex enum values to NTV2_RP188 structures.
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
Identifies SMPTE HD 1080i or 1080psf.
Definition: ntv2enums.h:169
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
std::string NTV2HDMIRangeToString(const NTV2HDMIRange inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6681
bool NTV2DeviceGetSupportedPixelFormats(const NTV2DeviceID inDeviceID, NTV2PixelFormats &outFormats)
Returns a set of distinct NTV2FrameBufferFormat values supported on the given device.
static AJAStatus StatTimerStart(const uint32_t inKey)
Definition: debug.cpp:1135
static size_t gDefaultPageSize(AJA_PAGE_SIZE)
uint16_t GetEndFrame(void) const
ULWord acAudioExpectedAddress
Audio transfer address.
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1264
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob, bool fillBuffer=true)
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
NTV2InputSourceSet::const_iterator NTV2InputSourceSetConstIter
A handy const iterator for iterating over an NTV2InputSourceSet.
ULWord acCurrentAudioExpectedAddress
bool PutU32s(const ULWordSequence &inU32s, const size_t inU32Offset=0, const bool inByteSwap=false)
Copies a vector of unsigned 32-bit values into me.
bool GetU8s(UByteSequence &outU8s, const size_t inU8Offset=0, const size_t inMaxSize=128) const
Answers with my contents as a vector of unsigned 8-bit values.
#define AUTOCIRCULATE_WITH_FBOCHANGE
Use this to AutoCirculate with the possibility of frame buffer orientation changes.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
bool RPCDecodeNoAllocate(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
#define NTV2_IS_VALID_HEADER_TAG(_x_)
bool RPCEncodeClient(NTV2_RPC_BLOB_TYPE &inBlob)
ostream & NTV2PrintAudioSystemSet(const NTV2AudioSystemSet &inObj, const bool inCompact, std::ostream &inOutStream)
Streams a human-readable dump of the given NTV2AudioSystemSet into the specified output stream...
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
std::string & strip(std::string &str, const std::string &ws)
Definition: common.cpp:461
bool GetSDIInputStatus(NTV2SDIInputStatus &outStatus, const UWord inSDIInputIndex0=0)
Answers with the NTV2SDIInputStatus for the given SDI input spigot.
union AutoCircGenericTask::@39 u
2048x1080, for 2Kx1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:363
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
ULWord acFramesProcessed
Total number of frames successfully processed since AutoCirculateStart.
ULWord acStartSample
The actual audio start sample when this frame was started at the VBI, which may be used to check sync...
bool is_hex_digit(const char inChr)
Definition: common.cpp:511
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
void Clear(void)
Resets the struct to its initialized state.
static std::string GetDisplayValue(const uint32_t inRegNum, const uint32_t inRegValue, const NTV2DeviceID inDeviceID=DEVICE_ID_NOTFOUND)
static size_t HostPageSize(void)
#define DEC(__x__)
NTV2RegisterNumber
#define NTV2SDKVersionDecode_Point
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
void PUSHU32(const uint32_t inVal, RPCBlob &inArr, const bool dontSwap=false)
Definition: ntv2nubtypes.h:38
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:350
720x576, for PAL 625i, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:356
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
User cookie at last vblank.
NTV2Buffer acANCField2Buffer
The host "Field 2" ancillary data buffer. This field is owned by the client application, and thus is responsible for allocating and/or freeing it. If the pointer is NULL or the size is zero, no "Field 2" ancillary data will be transferred. Use the AUTOCIRCULATE_TRANSFER::SetAncBuffers method to set or reset this field.
FRAME_STAMP & operator=(const FRAME_STAMP &inRHS)
std::set< NTV2Channel > NTV2ChannelSet
A set of distinct NTV2Channel values.
NTV2AudioChannelOctets::const_iterator NTV2AudioChannelOctetsConstIter
Handy const iterator to iterate over a set of distinct NTV2AudioChannelOctet values.
std::string NTV2HDMIColorSpaceToString(const NTV2HDMIColorSpace inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6692
ULWord mFlags
Action flags (lock, unlock, etc)
NTV2_TRAILER()
Constructs a default NTV2_TRAILER having the proper version and tag.
void PUSHU64(const uint64_t inVal, RPCBlob &inArr, const bool dontSwap=false)
Definition: ntv2nubtypes.h:46
#define NTV2_TYPE_AJASTREAMBUFFER
Identifies NTV2StreamBuffer struct.
void Set(const ULWord inDBB=0xFFFFFFFF, const ULWord inLow=0xFFFFFFFF, const ULWord inHigh=0xFFFFFFFF)
Sets my fields from the given DBB, low and high ULWord components.
Declares numerous NTV2 utility functions.
bool GetU16s(UWordSequence &outU16s, const size_t inU16Offset=0, const size_t inMaxSize=64, const bool inByteSwap=false) const
Answers with my contents as a vector of unsigned 16-bit values.
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me into the given output stream.
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
NTV2Buffer mOutBadRegIndexes
Array of UWords containing index numbers of the register writes that failed. The SDK owns this memory...
#define NTV2Buffer_TO_ULWORD64(__p__)
bool NTV2DeviceGetSupportedGeometries(const NTV2DeviceID inDeviceID, NTV2GeometrySet &outGeometries)
Returns a set of distinct NTV2FrameGeometry values supported on the given device. ...
NTV2Crosspoint foregroundKeyCrosspoint
void swap(nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass > &j1, nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass > &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass > >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass > >::value)
exchanges the values of two JSON objects
Definition: json.hpp:24538
std::string NTV2CrosspointToString(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:5807
bool Set(const void *pInUserPointer, const size_t inByteCount)
Sets (or resets) me from a client-supplied address and size.
ULWord acBufferLevel
Number of buffered frames in driver ready to capture or play.
std::vector< uint64_t > ULWord64Sequence
An ordered sequence of ULWord64 (uint64_t) values.
#define NTV2Buffer_PAGE_ALIGNED
Allocated page-aligned?
NTV2GetRegisters(const NTV2RegNumSet &inRegisterNumbers=NTV2RegNumSet())
Constructs an NTV2GetRegisters struct from the given set of register numbers.
#define AsU64Ref(_x_)
bool operator!=(const NTV2SegmentedXferInfo &inRHS) const
bool NTV2GetSupportedStandards(NTV2StandardSet &outStandards)
Returns a set of all NTV2Standard values supported (used) by any/all supported NTV2 devices...
std::string AsCode(const size_t inBytesPerWord=4, const std::string &inVarName="", const bool inUseSTL=false, const bool inByteSwap=false) const
string NTV2AutoCirculateStateToString(const NTV2AutoCirculateState inState)
NTV2RegInfo GetRegInfo(const UWord inIndex0=0) const
AUTO_CIRC_COMMAND eCommand
NTV2SDIInputStatus & operator[](const size_t inSDIInputIndex0)
This struct is used to augment the default full-frame AutoCirculate DMA transfer to accommodate multi...
bool GetInputTimeCodes(NTV2TimeCodeList &outValues) const
Intended for capture, answers with the timecodes captured in my acTransferStatus member&#39;s acFrameStam...
bool SetInputTimecode(const NTV2TCIndex inTCNdx, const NTV2_RP188 &inTimecode)
Sets one of my input timecodes.
ULWord acAudioOutStartAddress
(output/playback only) Audio play head position (exclusive) AFTER this frame was stamped.
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:355
ULWord GetFrameCount(void) const
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
NTV2SegmentedXferInfo & reset(void)
Resets me to an invalid (all zero) state.
ULWord mFlags
Action flags.
bool NextDifference(const NTV2Buffer &inBuffer, ULWord &byteOffset) const
Iterates over each byte that differs between myself and the given buffer.
#define AUTOCIRCULATE_WITH_COLORCORRECT
Use this to AutoCirculate with color correction.
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
std::vector< NTV2_RP188 > NTV2TimeCodeList
An ordered sequence of zero or more NTV2_RP188 structures. An NTV2TCIndex enum value can be used as a...
virtual std::string do_grouping() const
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
NTV2VirtualData(const ULWord inTag, const void *inVirtualData, const size_t inVirtualDataSize, const bool inDoWrite=false)
Constructs an NTV2VirtualData struct for reading or writing virtual data.
std::string NTV2AudioRateToString(const NTV2AudioRate inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5758
NTV2RegisterValueMap::const_iterator NTV2RegValueMapConstIter
A const iterator that iterates over NTV2RegisterValueMap entries.
ULWord acAudioOutStopAddress
(output/playback only) Audio play head position when this frame was stamped.
void Clear(void)
Frees my private color correction table buffer and resets my mode to "invalid".
LWord64 acCurrentFrameTime
The VBI timestamp of the current/active frame currently being ingested on the device (capture)...
uint16_t UWord
Definition: ajatypes.h:234
bool SetAndFill(const void *pInUserPointer, const size_t inByteCount, const UByte inValue)
Sets (or resets) me from a client-supplied address and size.
uint16_t U16(const int inIndex) const
NTV2DoubleArray::const_iterator NTV2DoubleArrayConstIter
Handy const iterator to iterate over an NTV2DoubleArray.
std::ostream & Dump(std::ostream &inOutputStream=std::cout, const size_t inStartByteOffset=0, const size_t inByteCount=0, const size_t inRadix=16, const size_t inBytesPerGroup=4, const size_t inGroupsPerLine=8, const size_t inAddressRadix=0, const bool inShowAscii=false, const size_t inAddrOffset=0) const
Dumps me in hex/octal/decimal, with/without Ascii, to the given output stream.
#define OCT(__x__)
ULWord acFramesDropped
Total number of frames dropped since CNTV2Card::AutoCirculateStart called.
NTV2TCIndexes & operator+=(NTV2TCIndexes &inOutSet, const NTV2TCIndexes &inSet)
Appends the given NTV2TCIndexes contents into the given set.
static void FreeAligned(void *pMemory)
Definition: memory.cpp:145
NTV2Buffer acTimeCodes
Intended for capture, this is a sequence of NTV2_RP188 values received from the device (in NTV2TCInde...
std::ostream & Print(std::ostream &inOutStream) const
AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
Contains status information that&#39;s valid after CNTV2Card::AutoCirculateTransfer returns, including the driver buffer level, number of frames processed or dropped, audio and anc transfer byte counts, and a complete FRAME_STAMP that has even more detailed clocking information.
NTV2_HEADER(const ULWord inStructureType, const ULWord inSizeInBytes)
Constructs a default NTV2_HEADER having the proper tag, version, and the given type and size...
enum _AutoCircCommand_ AUTO_CIRC_COMMAND
NTV2Channel GetChannel(void) const
#define NTV2_ASSERT_STRUCT_VALID
NTV2Buffer mBuffer
Virtual address of a bitstream buffer and its length.
#define xHEX0N(__x__, __n__)
AUTOCIRCULATE_TRANSFER()
Constructs a default AUTOCIRCULATE_TRANSFER struct.
~NTV2Buffer()
My destructor. If I&#39;m responsible for the memory, I free it here.
static std::string GetDisplayName(const uint32_t inRegNum)
~FRAME_STAMP()
My destructor.
#define NTV2_IS_VALID_AUDIO_SYSTEM(__x__)
Definition: ntv2enums.h:3917
ULWord currenthUser
Contains validCount (Play - reps remaining, Record - drops on frame)
bool SetAncBuffers(ULWord *pInANCBuffer, const ULWord inANCByteCount, ULWord *pInANCF2Buffer=NULL, const ULWord inANCF2ByteCount=0)
Sets my ancillary data buffers for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
std::string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6938
ULWord getSourcePitch(void) const
NTV2_RP188 acRP188
Deprecated – call FRAME_STAMP::GetInputTimeCode instead.
NTV2GeometrySet GetRelatedGeometries(const NTV2FrameGeometry inFrameGeometry)
Definition: ntv2utils.cpp:4002
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1284
NTV2RegWritesIter NTV2RegisterReadsIter
NTV2RegInfo & setValue(const ULWord val)
bool GetInputTimeCode(NTV2_RP188 &outTimeCode, const NTV2TCIndex inTCIndex=NTV2_TCINDEX_SDI1) const
Intended for capture, answers with a specific timecode captured in my acTransferStatus member&#39;s acFra...
ULWord mIsWriting
If non-zero, register(s) will be written; otherwise, register(s) will be read.
NTV2AudioSystemSet::const_iterator NTV2AudioSystemSetConstIter
A handy const iterator into an NTV2AudioSystemSet. New in SDK 16.2.
NTV2Buffer mInBankInfos
Bank select NTV2RegInfo. The SDK owns this memory.
#define NTV2_TYPE_AJASTREAMCHANNEL
Identifies NTV2StreamChannel struct.
This object is embedded in the AUTOCIRCULATE_TRANSFER struct that&#39;s returned from the CNTV2Card::Auto...
bool SetFromRegValue(const ULWord inData)
Sets my fields from the given status register value.
NTV2_TRAILER mTrailer
The common structure trailer – ALWAYS LAST!
bool ResetUsing(const NTV2RegWrites &inRegWrites)
Resets me, starting over, now using the given NTV2RegisterNumberSet.
ULWord acBufferLevel
The number of frames ready to record/play after the transfer.
ULWord mStatus
Action status.
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me into the given output stream.
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
enum NTV2OutputDestination NTV2OutputDest
bool RPCDecode(const NTV2_RPC_BLOB_TYPE &inBlob, size_t &inOutIndex)
#define AUTOCIRCULATE_STRUCT_VERSION
Version number of AutoCirculate structures, originally 0.
ULWord getSegmentLength(void) const
UWord NTV2DeviceGetNumVideoOutputs(const NTV2DeviceID inDeviceID)
NTV2QuarterSizeExpandMode acVideoQuarterSizeExpand
Turns on the "quarter-size expand" (2x H + 2x V) hardware. Defaults to off (1:1). ...
bool GetRequestedRegisterWrites(NTV2RegWrites &outRegWrites) const
bool isDestBottomUp(void) const
ULWord currentAudioExpectedAddress
As set by play.
Identifies the first analog video input.
Definition: ntv2enums.h:1266
Private include file for all ajabase sources.
This class/object reports information about the current and/or requested AutoCirculate frame...
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2375
std::map< NTV2FrameGeometry, ULWord > FGSizesMap
ULWord getSourceOffset(void) const
NTV2ChannelList::const_iterator NTV2ChannelListConstIter
A handy const iterator into an NTV2ChannelList.
NTV2AudioRate
Definition: ntv2enums.h:1931
std::vector< uint32_t > ULWordSequence
An ordered sequence of ULWord (uint32_t) values.
RP188_STRUCT currentRP188
Last vertical blank timecode (RP-188)
static void * AllocateAligned(size_t size, size_t alignment)
Definition: memory.cpp:115
ULWord acAudioInStartAddress
(input/ingest/capture only) Starting audio record head position when this frame was stamped...
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:727
std::vector< NTV2Channel > NTV2ChannelList
An ordered sequence of NTV2Channel values.
std::string & upper(std::string &str)
Definition: common.cpp:442
void POPU32(uint32_t &outVal, const RPCBlob &inArr, std::size_t &inOutNdx, const bool dontSwap=false)
Definition: ntv2nubtypes.h:69
#define AUTOCIRCULATE_WITH_VIDPROC
Use this to AutoCirculate with video processing.
NTV2_HEADER acHeader
The common structure header – ALWAYS FIRST!
#define NTV2_TYPE_SETREGS
Identifies NTV2SetRegisters struct.
bool GetU32s(ULWordSequence &outU32s, const size_t inU32Offset=0, const size_t inMaxSize=32, const bool inByteSwap=false) const
Answers with my contents as a vector of unsigned 32-bit values.
ULWord64Sequence::const_iterator ULWord64SequenceConstIter
A handy const iterator for iterating over a ULWord64Sequence.
static ULWord FGHeight(const NTV2FrameGeometry fg)
ULWord acSegmentHostPitch
Offset, in bytes, between the start of one host segment and the start of the next host segment (i...
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1044
uint64_t U64(const int inIndex) const
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
void * GetHostPointer(void) const
NTV2ColorCorrectionData()
Constructs a default NTV2ColorCorrectionData struct.
bool WithColorCorrect(void) const
NTV2SegmentedXferInfo & setDestDirection(const bool inTopDown)
Sets the scan direction for the destination.
NTV2Bitstream()
Constructs a default NTV2Bitstream struct.
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
Definition: ntv2enums.h:265
void Reset(void)
Resets the NTV2SegmentedDMAInfo struct members to their default values (normal, non-segmented AutoCir...
bool GetRingChangedByteRange(const NTV2Buffer &inBuffer, ULWord &outByteOffsetFirst, ULWord &outByteOffsetLast) const
Assuming my contents and the contents of the given buffer comprise ring buffers that periodically get...
ULWord64 acAudioClockTimeStamp
(input/ingest/capture only) The absolute timestamp at the VBI when the frame started recording into d...
This is used by the CNTV2Card::ReadSDIStatistics function.
string CommaStr(const T &inNum)
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:365
NTV2Buffer acAudioBuffer
The host audio buffer. This field is owned by the client application, and thus is responsible for all...
static const NTV2_RP188 INVALID_TIMECODE_VALUE
NTV2TCIndexes::const_iterator NTV2TCIndexesConstIter
Color correction data used with AUTOCIRCULATE_WITH_COLORCORRECT option.
static const string sSegXferUnits[]
std::vector< std::string > NTV2StringList
bool SetFrom(const FRAME_STAMP_STRUCT &inOldStruct)
Sets my fields from the given FRAME_STAMP_STRUCT.
std::set< NTV2AudioChannelOctet > NTV2AudioChannelOctets
A set of distinct NTV2AudioChannelOctet values.
bool GetInputTimeCode(NTV2_RP188 &outTimeCode, const NTV2TCIndex inTCIndex=NTV2_TCINDEX_SDI1) const
Answers with a specific timecode captured in my acTimeCodes member.
#define HEX0N(__x__, __n__)
Definition: debug.cpp:1175
#define NTV2Buffer_ALLOCATED
Allocated using Allocate function?
std::ostream & Print(std::ostream &inOutStream) const
bool GetU64s(ULWord64Sequence &outU64s, const size_t inU64Offset=0, const size_t inMaxSize=16, const bool inByteSwap=false) const
Answers with my contents as a vector of unsigned 16-bit values.
#define NTV2_IS_VALID_COLOR_CORRECTION_MODE(__x__)
Definition: ntv2enums.h:2092
#define NTV2SDKVersionDecode_Build
uint8_t U8(const int inIndex) const
ULWord audioOutStopAddress
For play - first position in buffer of audio.
std::vector< NTV2RegInfo > NTV2RegisterWrites
#define OCT0N(__x__, __n__)
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
LWord64 currentFrameTime
Vertical blank start of current frame.
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5729
bool ByteSwap64(void)
Byte-swaps my contents 64-bits at a time.
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1285
std::string & lower(std::string &str)
Definition: common.cpp:436
NTV2StreamChannel()
Constructs a default NTV2StreamChannel struct.
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
NTV2RegWrites NTV2RegReads
An ordered sequence of zero or more NTV2RegInfo structs intended for ReadRegister.
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
ULWord acNumSegments
Number of segments of size ::AUTOCIRCULATE_TRANSFER::acVideoBuffer.fByteCount to transfer. Zero or 1 means normal (unsegmented) transfer.
NTV2AudioChannelPairs::const_iterator NTV2AudioChannelPairsConstIter
Handy const iterator to iterate over a set of distinct NTV2AudioChannelPair values.
#define NTV2EndianSwap16(__val__)
Definition: ntv2endian.h:15
bool NTV2DeviceGetSupportedFrameRates(const NTV2DeviceID inDeviceID, NTV2FrameRateSet &outRates)
Returns a set of distinct NTV2FrameRate values supported on the given device.
NTV2Channel mChannel
Mail buffer channel.
ostream & NTV2PrintChannelList(const NTV2ChannelList &inObj, const bool inCompact, ostream &inOutStream)
720x576, for PAL 625i, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:368
Declares enums and structs used by all platform drivers and the SDK.
NTV2Crosspoint backgroundKeyCrosspoint
NTV2AudioSystem acAudioSystem
The audio system being used for this channel (NTV2_AUDIOSYSTEM_INVALID if none)
#define NTV2SDKVersionDecode_Major
NTV2Buffer acANCBuffer
The host ancillary data buffer. This field is owned by the client application, and thus is responsibl...
#define DECN(__x__, __n__)
AutoCircTaskType taskType
#define AUTOCIRCULATE_WITH_FIELDS
Use this to AutoCirculate with fields as frames for interlaced formats.
NTV2Buffer mInRegInfos
Read-only array of NTV2RegInfo structs to be set. The SDK owns this memory.
NTV2Buffer ccLookupTables
RGB lookup tables pre-formatted for AJA hardware as a contiguous block of NTV2_COLORCORRECTOR_TABLESI...
ULWord mStatus
Action status.
bool NTV2DeviceGetSupportedInputSources(const NTV2DeviceID inDeviceID, NTV2InputSourceSet &outInputSources, const NTV2IOKinds inKinds)
Returns a set of distinct NTV2InputSource values supported on the given device.
bool SetAllOutputTimeCodes(const NTV2_RP188 &inTimecode, const bool inIncludeF2=true)
Intended for playout, replaces all elements of my acOutputTimeCodes member with the given timecode va...
std::string & replace(std::string &str, const std::string &from, const std::string &to)
Definition: common.cpp:110
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
#define AUTOCIRCULATE_WITH_HDMIAUX
Use this to AutoCirculate with HDMI auxiliary data.
bool IsFieldMode(void) const
#define NTV2_TRAILER_TAG
Identifies the struct trailer.
bool WithFBFChange(void) const
#define NTV2_IS_VALID_NTV2FrameGeometry(__s__)
Definition: ntv2enums.h:382
NTV2Crosspoint acCrosspoint
The crosspoint (channel number with direction)
ULWord fTrailerTag
A special FourCC to identify the tail end of an NTV2 structure.
NTV2SDIInputStatus()
Constructs a default NTV2SDIInputStatus.
This is used to enable or disable AJADebug logging in the driver.
ULWord mOutNumFailures
The number of registers unsuccessfully written.
NTV2Crosspoint foregroundVideoCrosspoint
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
bool PutU8s(const UByteSequence &inU8s, const size_t inU8Offset=0)
Copies a vector of unsigned 8-bit values into me.
NTV2HDMIBitDepth
Indicates or specifies the HDMI video bit depth.
Definition: ntv2enums.h:3695
#define NTV2_IS_REGISTER_TASK(_x_)
#define NTV2EndianSwap32(__val__)
Definition: ntv2endian.h:19
ULWord acNumActiveBytesPerRow
Number of active bytes in a row of video.
NTV2RegInfo & setShift(const ULWord val)
bool SetBuffer(const NTV2Buffer &inBuffer)
Sets the buffer to lock for use in a subsequent call to CNTV2Card::DMABufferLock. ...
#define AJA_NTV2_SDK_VERSION_MINOR
The SDK minor version number, an unsigned decimal integer.
Definition: ntv2version.h:14
uint16_t GetStartFrame(void) const
Declares device capability functions.
#define NTV2_IS_VALID_NTV2FrameRate(__r__)
Definition: ntv2enums.h:446
bool WithVidProc(void) const
NTV2Channel NTV2CrosspointToNTV2Channel(const NTV2Crosspoint inCrosspointChannel)
Definition: ntv2utils.cpp:4710
ULWord acFramesProcessed
Total number of frames successfully processed since CNTV2Card::AutoCirculateStart called...
ULWord getSegmentCount(void) const
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
ULWord64 GetRawHostPointer(void) const
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:367
std::set< UByte > NTV2DIDSet
A set of distinct NTV2DID values.
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
NTV2DebugLogging(const bool inEnable=false)
Constructs an NTV2DebugLogging struct.
This is used by the CNTV2Card::WriteRegisters function.
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
std::string NTV2FrameRateToString(const NTV2FrameRate inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7348
ULWord64 audioClockTimeStamp
48kHz clock (in reg 28, extended to 64 bits) at time of play or record.
bool SegmentedDMAsEnabled(void) const
enum NTV2TCIndex NTV2TimecodeIndex
ULWord acTotalBytesTransferred
Total audio and video bytes transferred.
NTV2FrameBufferFormatSetConstIter NTV2PixelFormatsConstIter
ULWord NTV2IOKinds
Definition: ntv2enums.h:1312
bool RPCEncode(NTV2_RPC_BLOB_TYPE &outBlob)
Declares the CNTV2RegisterExpert class.
bool isDestTopDown(void) const
All new NTV2 structs end with this common trailer.
NTV2_TRAILER acTrailer
The common structure trailer – ALWAYS LAST!
ULWord acFrame
(input/ingest/capture only) Current/active frame number.
NTV2FrameGeometry GetNTV2FrameGeometryFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2644
ULWord currentFieldCount
At Call Field0 or Field1 currently being OUTPUT (at the time of the IOCTL_NTV2_GET_FRAMESTAMP) ...
NTV2SegmentedDMAInfo acInSegmentedDMAInfo
Optional segmented DMA info, for use with specialized data transfers.