AJA NTV2 SDK  18.1.0.2262
NTV2 SDK 18.1.0.2262
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 
363 string NTV2_HEADER::FourCCToString (const ULWord in4CC, char nonPrintable)
364 {
365  const char * pU32 (reinterpret_cast<const char *>(&in4CC));
366  ostringstream result, fourCC;
367  size_t badTally(0);
368  if (nonPrintable && !::isprint(nonPrintable))
369  nonPrintable = 0; // specified non-printable character to use is itself non-printable: don't use it
370  for (size_t charPos(0); charPos < 4; charPos++)
371  {
372  #if AJATargetBigEndian
373  const char ch (pU32[charPos]);
374  #else // little-endian:
375  const char ch (pU32[3 - charPos]);
376  #endif
377  if (::isprint(ch))
378  fourCC << ch;
379  else
380  {
381  if (nonPrintable)
382  fourCC << nonPrintable;
383  badTally++; // not printable
384  }
385  }
386  if (badTally == 4)
387  result << xHEX0N(in4CC,8); // nothing printable, just show hex value
388  else if (badTally)
389  result << "'" << fourCC.str() << "' (" << xHEX0N(in4CC,8) << ")"; // at least one printable, show 4CC & hex value
390  else
391  result << "'" << fourCC.str() << "'"; // all printable, show 4CC exclusively (no hex value)
392  return result.str();
393 }
394 
395 
396 ostream & operator << (ostream & inOutStream, const NTV2_TRAILER & inObj)
397 {
398  inOutStream << "[";
400  inOutStream << NTV2_4CC_AS_STRING(inObj.fTrailerTag);
401  else
402  inOutStream << "BAD-" << HEX0N(inObj.fTrailerTag,8);
403  return inOutStream << " rawVers=" << xHEX0N(inObj.fTrailerVersion,8) << " clientSDK="
407  << "." << DEC(NTV2SDKVersionDecode_Build(inObj.fTrailerVersion)) << "]";
408 }
409 
410 
411 ostream & operator << (ostream & inOutStream, const NTV2Buffer & inObj)
412 {
413  return inObj.Print (inOutStream);
414 }
415 
416 
417 ostream & NTV2Buffer::Print (ostream & inOutStream) const
418 {
419  inOutStream << (IsAllocatedBySDK() ? "0X" : "0x") << HEX0N(GetRawHostPointer(),16) << "/" << DECN(GetByteCount(),10);
420  return inOutStream;
421 }
422 
423 
424 string NTV2Buffer::AsString (UWord inDumpMaxBytes) const
425 {
426  ostringstream oss;
427  oss << xHEX0N(GetRawHostPointer(),16) << ":" << DEC(GetByteCount()) << " bytes";
428  if (inDumpMaxBytes && GetHostPointer())
429  {
430  oss << ":";
431  if (inDumpMaxBytes > 256)
432  inDumpMaxBytes = 256;
433  if (ULWord(inDumpMaxBytes) > GetByteCount())
434  inDumpMaxBytes = UWord(GetByteCount());
435  const UByte * pBytes (reinterpret_cast<const UByte *>(GetHostPointer()));
436  for (UWord ndx(0); ndx < inDumpMaxBytes; ndx++)
437  oss << HEX0N(uint16_t(pBytes[ndx]),2);
438  }
439  return oss.str();
440 }
441 
442 string NTV2Buffer::AsCode (const size_t inBytesPerWord, const std::string & inVarName, const bool inUseSTL, const bool inByteSwap) const
443 {
444  ostringstream oss;
445  if (inBytesPerWord != 1 && inBytesPerWord != 2 && inBytesPerWord != 4 && inBytesPerWord != 8) return string();
446  NTV2Buffer tmp;
447  if (inBytesPerWord > 1)
448  { // Use a copy for U16s, U32s, or U64s...
449  tmp = *this;
450  if (!tmp)
451  return string();
452  }
453  const string cType (inBytesPerWord == 1 ? "uint8_t" : (inBytesPerWord == 2 ? "uint16_t" : (inBytesPerWord == 4 ? "uint32_t" : "uint64_t")));
454  const size_t numWords (GetByteCount() / inBytesPerWord);
455  const string vecType = "std::vector<" + cType + ">";
456  const string varName (inVarName.empty() ? (inUseSTL ? "tmpVector" : "tmpArray") : inVarName);
457  oss << "const " << (inUseSTL ? vecType : cType) << " " << varName << (inUseSTL ? "" : "[]") << " = {" << endl;
458  if (inByteSwap && inBytesPerWord > 1)
459  switch (inBytesPerWord)
460  {
461  case 2: tmp.ByteSwap16(); break;
462  case 4: tmp.ByteSwap32(); break;
463  case 8: tmp.ByteSwap64(); break;
464  }
465  for (size_t ndx(0); ndx < numWords; )
466  {
467  switch (inBytesPerWord)
468  {
469  case 1: oss << xHEX0N(UWord(U8(int(ndx))),2); break;
470  case 2: oss << xHEX0N(tmp.U16(int(ndx)),4); break;
471  case 4: oss << xHEX0N(tmp.U32(int(ndx)),8); break;
472  case 8: oss << xHEX0N(tmp.U64(int(ndx)),16); break;
473  }
474  if (++ndx < numWords)
475  oss << ",";
476  if (ndx % 128 == 0)
477  oss << endl;
478  }
479  oss << "};" << endl;
480  return oss.str();
481 }
482 
483 bool NTV2Buffer::toHexString (std::string & outStr, const size_t inLineBreakInterval) const
484 {
485  outStr.clear();
486  ostringstream oss;
487  if (GetHostPointer() && GetByteCount())
488  for (int ndx(0); ndx < int(GetByteCount()); )
489  {
490  oss << HEX0N(uint16_t(U8(ndx++)),2);
491  if (inLineBreakInterval && ndx < int(GetByteCount()) && ((size_t(ndx) % inLineBreakInterval) == 0))
492  oss << endl;
493  }
494  outStr = oss.str();
495  return !outStr.empty();
496 }
497 
498 static string print_address_offset (const size_t inRadix, const ULWord64 inOffset)
499 {
500  const streamsize maxAddrWidth (sizeof(ULWord64) * 2);
501  ostringstream oss;
502  if (inRadix == 8)
503  oss << OCT0N(inOffset,maxAddrWidth) << ": ";
504  else if (inRadix == 10)
505  oss << DEC0N(inOffset,maxAddrWidth) << ": ";
506  else
507  oss << xHEX0N(inOffset,maxAddrWidth) << ": ";
508  return oss.str();
509 }
510 
511 ostream & NTV2Buffer::Dump (ostream & inOStream,
512  const size_t inStartOffset,
513  const size_t inByteCount,
514  const size_t inRadix,
515  const size_t inBytesPerGroup,
516  const size_t inGroupsPerRow,
517  const size_t inAddressRadix,
518  const bool inShowAscii,
519  const size_t inAddrOffset) const
520 {
521  if (IsNULL())
522  return inOStream;
523  if (inRadix != 8 && inRadix != 10 && inRadix != 16 && inRadix != 2)
524  return inOStream;
525  if (inAddressRadix != 0 && inAddressRadix != 8 && inAddressRadix != 10 && inAddressRadix != 16)
526  return inOStream;
527  if (inBytesPerGroup == 0) // || inGroupsPerRow == 0)
528  return inOStream;
529 
530  {
531  const void * pInStartAddress (GetHostAddress(ULWord(inStartOffset)));
532  size_t bytesRemaining (inByteCount ? inByteCount : GetByteCount());
533  size_t bytesInThisGroup (0);
534  size_t groupsInThisRow (0);
535  const unsigned maxByteWidth (inRadix == 8 ? 4 : (inRadix == 10 ? 3 : (inRadix == 2 ? 8 : 2)));
536  const UByte * pBuffer (reinterpret_cast <const UByte *> (pInStartAddress));
537  const size_t asciiBufferSize (inShowAscii && inGroupsPerRow ? (inBytesPerGroup * inGroupsPerRow + 1) * sizeof (UByte) : 0); // Size in bytes, not chars
538 
539  if (!pInStartAddress)
540  return inOStream;
541 
542  UByte * pAsciiBuffer (asciiBufferSize ? new UByte[asciiBufferSize / sizeof(UByte)] : AJA_NULL);
543  if (pAsciiBuffer)
544  ::memset (pAsciiBuffer, 0, asciiBufferSize);
545 
546  if (inGroupsPerRow && inAddressRadix)
547  inOStream << print_address_offset (inAddressRadix, ULWord64(pBuffer) - ULWord64(pInStartAddress) + ULWord64(inAddrOffset));
548  while (bytesRemaining)
549  {
550  if (inRadix == 2)
551  inOStream << BIN08(*pBuffer);
552  else if (inRadix == 8)
553  inOStream << oOCT(uint16_t(*pBuffer));
554  else if (inRadix == 10)
555  inOStream << DEC0N(uint16_t(*pBuffer),maxByteWidth);
556  else if (inRadix == 16)
557  inOStream << HEX0N(uint16_t(*pBuffer),2);
558 
559  if (pAsciiBuffer)
560  pAsciiBuffer[groupsInThisRow * inBytesPerGroup + bytesInThisGroup] = isprint(*pBuffer) ? *pBuffer : '.';
561  pBuffer++;
562  bytesRemaining--;
563 
564  bytesInThisGroup++;
565  if (bytesInThisGroup >= inBytesPerGroup)
566  {
567  groupsInThisRow++;
568  if (inGroupsPerRow && groupsInThisRow >= inGroupsPerRow)
569  {
570  if (pAsciiBuffer)
571  {
572  inOStream << " " << pAsciiBuffer;
573  ::memset (pAsciiBuffer, 0, asciiBufferSize);
574  }
575  inOStream << endl;
576  if (inAddressRadix && bytesRemaining)
577  inOStream << print_address_offset (inAddressRadix, reinterpret_cast <ULWord64> (pBuffer) - reinterpret_cast <ULWord64> (pInStartAddress) + ULWord64 (inAddrOffset));
578  groupsInThisRow = 0;
579  } // if time for new row
580  else
581  inOStream << " ";
582  bytesInThisGroup = 0;
583  } // if time for new group
584  } // loop til no bytes remaining
585 
586  if (bytesInThisGroup && bytesInThisGroup < inBytesPerGroup && pAsciiBuffer)
587  {
588  groupsInThisRow++;
589  inOStream << string ((inBytesPerGroup - bytesInThisGroup) * maxByteWidth + 1, ' ');
590  }
591 
592  if (groupsInThisRow)
593  {
594  if (groupsInThisRow < inGroupsPerRow && pAsciiBuffer)
595  inOStream << string (((inGroupsPerRow - groupsInThisRow) * inBytesPerGroup * maxByteWidth + (inGroupsPerRow - groupsInThisRow)), ' ');
596  if (pAsciiBuffer)
597  inOStream << pAsciiBuffer;
598  inOStream << endl;
599  }
600  else if (bytesInThisGroup && bytesInThisGroup < inBytesPerGroup)
601  inOStream << endl;
602 
603  if (pAsciiBuffer)
604  delete [] pAsciiBuffer;
605  } // else radix is 16, 10, 8 or 2
606 
607  return inOStream;
608 } // Dump
609 
610 string & NTV2Buffer::Dump ( string & inOutputString,
611  const size_t inStartOffset,
612  const size_t inByteCount,
613  const size_t inRadix,
614  const size_t inBytesPerGroup,
615  const size_t inGroupsPerRow,
616  const size_t inAddressRadix,
617  const bool inShowAscii,
618  const size_t inAddrOffset) const
619 {
620  ostringstream oss;
621  Dump (oss, inStartOffset, inByteCount, inRadix, inBytesPerGroup, inGroupsPerRow, inAddressRadix, inShowAscii, inAddrOffset);
622  inOutputString = oss.str();
623  return inOutputString;
624 }
625 
626 NTV2Buffer & NTV2Buffer::Segment (NTV2Buffer & outPtr, const ULWord inByteOffset, const ULWord inByteCount) const
627 {
628  outPtr.Set(AJA_NULL, 0); // Make invalid
629  if (inByteOffset >= GetByteCount())
630  return outPtr; // Offset past end
631  if (inByteOffset+inByteCount > GetByteCount())
632  return outPtr; // Segment too long
633  outPtr.Set(GetHostAddress(inByteOffset), inByteCount);
634  return outPtr;
635 }
636 
637 
638 bool NTV2Buffer::GetU64s (ULWord64Sequence & outUint64s, const size_t inU64Offset, const size_t inMaxSize, const bool inByteSwap) const
639 {
640  outUint64s.clear();
641  if (IsNULL())
642  return false;
643 
644  size_t maxSize (size_t(GetByteCount()) / sizeof(uint64_t));
645  if (maxSize < inU64Offset)
646  return false; // Past end
647  maxSize -= inU64Offset; // Remove starting offset
648 
649  const uint64_t * pU64 (reinterpret_cast <const uint64_t *> (GetHostAddress(ULWord(inU64Offset * sizeof(uint64_t)))));
650  if (!pU64)
651  return false; // Past end
652 
653  if (inMaxSize && inMaxSize < maxSize)
654  maxSize = inMaxSize;
655 
656  try
657  {
658  outUint64s.reserve(maxSize);
659  for (size_t ndx(0); ndx < maxSize; ndx++)
660  {
661  const uint64_t u64 (*pU64++);
662  outUint64s.push_back(inByteSwap ? NTV2EndianSwap64(u64) : u64);
663  }
664  }
665  catch (...)
666  {
667  outUint64s.clear();
668  outUint64s.reserve(0);
669  return false;
670  }
671  return true;
672 }
673 
674 
675 bool NTV2Buffer::GetU32s (ULWordSequence & outUint32s, const size_t inU32Offset, const size_t inMaxSize, const bool inByteSwap) const
676 {
677  outUint32s.clear();
678  if (IsNULL())
679  return false;
680 
681  size_t maxNumU32s (size_t(GetByteCount()) / sizeof(uint32_t));
682  if (maxNumU32s < inU32Offset)
683  return false; // Past end
684  maxNumU32s -= inU32Offset; // Remove starting offset
685 
686  const uint32_t * pU32 (reinterpret_cast<const uint32_t*>(GetHostAddress(ULWord(inU32Offset * sizeof(uint32_t)))));
687  if (!pU32)
688  return false; // Past end
689 
690  if (inMaxSize && inMaxSize < maxNumU32s)
691  maxNumU32s = inMaxSize;
692 
693  try
694  {
695  outUint32s.reserve(maxNumU32s);
696  for (size_t ndx(0); ndx < maxNumU32s; ndx++)
697  {
698  const uint32_t u32 (*pU32++);
699  outUint32s.push_back(inByteSwap ? NTV2EndianSwap32(u32) : u32);
700  }
701  }
702  catch (...)
703  {
704  outUint32s.clear();
705  outUint32s.reserve(0);
706  return false;
707  }
708  return true;
709 }
710 
711 
712 bool NTV2Buffer::GetU16s (UWordSequence & outUint16s, const size_t inU16Offset, const size_t inMaxSize, const bool inByteSwap) const
713 {
714  outUint16s.clear();
715  if (IsNULL())
716  return false;
717 
718  size_t maxSize (size_t(GetByteCount()) / sizeof(uint16_t));
719  if (maxSize < inU16Offset)
720  return false; // Past end
721  maxSize -= inU16Offset; // Remove starting offset
722 
723  const uint16_t * pU16 (reinterpret_cast <const uint16_t *> (GetHostAddress(ULWord(inU16Offset * sizeof(uint16_t)))));
724  if (!pU16)
725  return false; // Past end
726 
727  if (inMaxSize && inMaxSize < maxSize)
728  maxSize = inMaxSize;
729 
730  try
731  {
732  outUint16s.reserve(maxSize);
733  for (size_t ndx(0); ndx < maxSize; ndx++)
734  {
735  const uint16_t u16 (*pU16++);
736  outUint16s.push_back(inByteSwap ? NTV2EndianSwap16(u16) : u16);
737  }
738  }
739  catch (...)
740  {
741  outUint16s.clear();
742  outUint16s.reserve(0);
743  return false;
744  }
745  return true;
746 }
747 
748 
749 bool NTV2Buffer::GetU8s (UByteSequence & outUint8s, const size_t inU8Offset, const size_t inMaxSize) const
750 {
751  outUint8s.clear();
752  if (IsNULL())
753  return false;
754 
755  size_t maxSize (GetByteCount());
756  if (maxSize < inU8Offset)
757  return false; // Past end
758  maxSize -= inU8Offset; // Remove starting offset
759 
760  const uint8_t * pU8 (reinterpret_cast <const uint8_t *> (GetHostAddress(ULWord(inU8Offset))));
761  if (!pU8)
762  return false; // Past end
763 
764  if (inMaxSize && inMaxSize < maxSize)
765  maxSize = inMaxSize;
766 
767  try
768  {
769  outUint8s.reserve(maxSize);
770  for (size_t ndx(0); ndx < maxSize; ndx++)
771  outUint8s.push_back(*pU8++);
772  }
773  catch (...)
774  {
775  outUint8s.clear();
776  outUint8s.reserve(0);
777  return false;
778  }
779  return true;
780 }
781 
783 {
784  const uint8_t * pU8 (reinterpret_cast<const uint8_t*> (GetHostPointer()));
785  if (!pU8)
786  return false; // Past end
787  const size_t maxSize (GetByteCount());
788  try
789  {
790  outU8s.reserve(outU8s.size() + maxSize);
791  outU8s.insert(outU8s.end(),pU8, pU8 + maxSize);
792  }
793  catch (...)
794  {
795  return false;
796  }
797  return true;
798 }
799 
800 
801 bool NTV2Buffer::GetString (std::string & outString, const size_t inU8Offset, const size_t inMaxSize) const
802 {
803  outString.clear();
804  if (IsNULL())
805  return false;
806 
807  size_t maxSize(GetByteCount());
808  if (maxSize < inU8Offset)
809  return false; // Past end
810  maxSize -= inU8Offset; // Remove starting offset
811 
812  const uint8_t * pU8 (reinterpret_cast <const uint8_t *> (GetHostAddress(ULWord(inU8Offset))));
813  if (!pU8)
814  return false; // Past end
815 
816  if (inMaxSize && inMaxSize < maxSize)
817  maxSize = inMaxSize;
818 
819  try
820  {
821  outString.reserve(maxSize);
822  for (size_t ndx(0); ndx < maxSize; ndx++)
823  {
824  const char c = *pU8++;
825  if (c)
826  outString += c;
827  else
828  break;
829  }
830  }
831  catch (...)
832  {
833  outString.clear();
834  outString.reserve(0);
835  return false;
836  }
837  return true;
838 }
839 
840 
841 bool NTV2Buffer::PutU64s (const ULWord64Sequence & inU64s, const size_t inU64Offset, const bool inByteSwap)
842 {
843  if (IsNULL())
844  return false; // No buffer or space
845  if (inU64s.empty())
846  return true; // Nothing to copy
847 
848  size_t maxU64s (GetByteCount() / sizeof(uint64_t));
849  uint64_t * pU64 (reinterpret_cast<uint64_t*>(GetHostAddress(ULWord(inU64Offset * sizeof(uint64_t)))));
850  if (!pU64)
851  return false; // Start offset is past end
852  if (maxU64s > inU64Offset)
853  maxU64s -= inU64Offset; // Don't go past end
854  if (maxU64s > inU64s.size())
855  maxU64s = inU64s.size(); // Truncate incoming vector to not go past my end
856  if (inU64s.size() > maxU64s)
857  return false; // Will write past end
858 
859  for (unsigned ndx(0); ndx < maxU64s; ndx++)
860 #if defined(_DEBUG)
861  *pU64++ = inByteSwap ? NTV2EndianSwap64(inU64s.at(ndx)) : inU64s.at(ndx);
862 #else
863  *pU64++ = inByteSwap ? NTV2EndianSwap64(inU64s[ndx]) : inU64s[ndx];
864 #endif
865  return true;
866 }
867 
868 
869 bool NTV2Buffer::PutU32s (const ULWordSequence & inU32s, const size_t inU32Offset, const bool inByteSwap)
870 {
871  if (IsNULL())
872  return false; // No buffer or space
873  if (inU32s.empty())
874  return true; // Nothing to copy
875 
876  size_t maxU32s (GetByteCount() / sizeof(uint32_t));
877  uint32_t * pU32 (reinterpret_cast<uint32_t*>(GetHostAddress(ULWord(inU32Offset * sizeof(uint32_t)))));
878  if (!pU32)
879  return false; // Start offset is past end
880  if (maxU32s > inU32Offset)
881  maxU32s -= inU32Offset; // Don't go past end
882  if (maxU32s > inU32s.size())
883  maxU32s = inU32s.size(); // Truncate incoming vector to not go past my end
884  if (inU32s.size() > maxU32s)
885  return false; // Will write past end
886 
887  for (unsigned ndx(0); ndx < maxU32s; ndx++)
888 #if defined(_DEBUG)
889  *pU32++ = inByteSwap ? NTV2EndianSwap32(inU32s.at(ndx)) : inU32s.at(ndx);
890 #else
891  *pU32++ = inByteSwap ? NTV2EndianSwap32(inU32s[ndx]) : inU32s[ndx];
892 #endif
893  return true;
894 }
895 
896 
897 bool NTV2Buffer::PutU16s (const UWordSequence & inU16s, const size_t inU16Offset, const bool inByteSwap)
898 {
899  if (IsNULL())
900  return false; // No buffer or space
901  if (inU16s.empty())
902  return true; // Nothing to copy
903 
904  size_t maxU16s (GetByteCount() / sizeof(uint16_t));
905  uint16_t * pU16 (reinterpret_cast<uint16_t*>(GetHostAddress(ULWord(inU16Offset * sizeof(uint16_t)))));
906  if (!pU16)
907  return false; // Start offset is past end
908  if (maxU16s > inU16Offset)
909  maxU16s -= inU16Offset; // Don't go past end
910  if (maxU16s > inU16s.size())
911  maxU16s = inU16s.size(); // Truncate incoming vector to not go past my end
912  if (inU16s.size() > maxU16s)
913  return false; // Will write past end
914 
915  for (unsigned ndx(0); ndx < maxU16s; ndx++)
916 #if defined(_DEBUG)
917  *pU16++ = inByteSwap ? NTV2EndianSwap16(inU16s.at(ndx)) : inU16s.at(ndx);
918 #else
919  *pU16++ = inByteSwap ? NTV2EndianSwap16(inU16s[ndx]) : inU16s[ndx];
920 #endif
921  return true;
922 }
923 
924 
925 bool NTV2Buffer::PutU8s (const UByteSequence & inU8s, const size_t inU8Offset)
926 {
927  if (IsNULL())
928  return false; // No buffer or space
929  if (inU8s.empty())
930  return true; // Nothing to copy
931 
932  size_t maxU8s (GetByteCount());
933  uint8_t * pU8 (reinterpret_cast<uint8_t*>(GetHostAddress(ULWord(inU8Offset))));
934  if (!pU8)
935  return false; // Start offset is past end
936  if (maxU8s > inU8Offset)
937  maxU8s -= inU8Offset; // Don't go past end
938  if (maxU8s > inU8s.size())
939  maxU8s = inU8s.size(); // Truncate incoming vector to not go past end
940  if (inU8s.size() > maxU8s)
941  return false; // Will write past end
942 #if 1
943  ::memcpy(pU8, &inU8s[0], maxU8s);
944 #else
945  for (unsigned ndx(0); ndx < maxU8s; ndx++)
946  #if defined(_DEBUG)
947  *pU8++ = inU8s.at(ndx);
948  #else
949  *pU8++ = inU8s[ndx];
950  #endif
951 #endif
952  return true;
953 }
954 
955 
956 ostream & operator << (ostream & inOutStream, const NTV2_RP188 & inObj)
957 {
958  if (inObj.IsValid ())
959  return inOutStream << "{Dx" << HEX0N(inObj.fDBB,8) << "|Lx" << HEX0N(inObj.fLo,8) << "|Hx" << HEX0N(inObj.fHi,8) << "}";
960  else
961  return inOutStream << "{invalid}";
962 }
963 
964 
966 {
967  inOutList.push_back (inRP188);
968  return inOutList;
969 }
970 
971 
972 ostream & operator << (ostream & inOutStream, const NTV2TimeCodeList & inObj)
973 {
974  inOutStream << inObj.size () << ":[";
975  for (NTV2TimeCodeListConstIter iter (inObj.begin ()); iter != inObj.end (); )
976  {
977  inOutStream << *iter;
978  if (++iter != inObj.end ())
979  inOutStream << ", ";
980  }
981  return inOutStream << "]";
982 }
983 
984 
985 ostream & operator << (std::ostream & inOutStream, const NTV2TimeCodes & inObj)
986 {
987  inOutStream << inObj.size () << ":[";
988  for (NTV2TimeCodesConstIter iter (inObj.begin ()); iter != inObj.end (); )
989  {
990  inOutStream << ::NTV2TCIndexToString (iter->first,true) << "=" << iter->second;
991  if (++iter != inObj.end ())
992  inOutStream << ", ";
993  }
994  return inOutStream << "]";
995 }
996 
997 
998 ostream & operator << (std::ostream & inOutStream, const NTV2TCIndexes & inObj)
999 {
1000  for (NTV2TCIndexesConstIter iter (inObj.begin ()); iter != inObj.end (); )
1001  {
1002  inOutStream << ::NTV2TCIndexToString (*iter);
1003  if (++iter != inObj.end ())
1004  inOutStream << ", ";
1005  }
1006  return inOutStream;
1007 }
1008 
1009 
1011 {
1012  for (NTV2TCIndexesConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
1013  inOutSet.insert (*iter);
1014  return inOutSet;
1015 }
1016 
1017 
1018 ostream & operator << (ostream & inOutStream, const FRAME_STAMP & inObj)
1019 {
1020  return inOutStream << inObj.acHeader
1021  << " frmTime=" << inObj.acFrameTime
1022  << " reqFrm=" << inObj.acRequestedFrame
1023  << " audClkTS=" << inObj.acAudioClockTimeStamp
1024  << " audExpAdr=" << hex << inObj.acAudioExpectedAddress << dec
1025  << " audInStrtAdr=" << hex << inObj.acAudioInStartAddress << dec
1026  << " audInStopAdr=" << hex << inObj.acAudioInStopAddress << dec
1027  << " audOutStrtAdr=" << hex << inObj.acAudioOutStartAddress << dec
1028  << " audOutStopAdr=" << hex << inObj.acAudioOutStopAddress << dec
1029  << " totBytes=" << inObj.acTotalBytesTransferred
1030  << " strtSamp=" << inObj.acStartSample
1031  << " curTime=" << inObj.acCurrentTime
1032  << " curFrm=" << inObj.acCurrentFrame
1033  << " curFrmTime=" << inObj.acCurrentFrameTime
1034  << " audClkCurTime=" << inObj.acAudioClockCurrentTime
1035  << " curAudExpAdr=" << hex << inObj.acCurrentAudioExpectedAddress << dec
1036  << " curAudStrtAdr=" << hex << inObj.acCurrentAudioStartAddress << dec
1037  << " curFldCnt=" << inObj.acCurrentFieldCount
1038  << " curLnCnt=" << inObj.acCurrentLineCount
1039  << " curReps=" << inObj.acCurrentReps
1040  << " curUsrCookie=" << hex << inObj.acCurrentUserCookie << dec
1041  << " acFrame=" << inObj.acFrame
1042  << " acRP188=" << inObj.acRP188 // deprecated
1043  << " " << inObj.acTrailer;
1044 }
1045 
1046 
1047 ostream & operator << (ostream & inOutStream, const NTV2SegmentedDMAInfo & inObj)
1048 {
1049  if (inObj.acNumSegments > 1)
1050  inOutStream << "segs=" << inObj.acNumSegments << " numActBPR=" << inObj.acNumActiveBytesPerRow
1051  << " segHostPitc=" << inObj.acSegmentHostPitch << " segDevPitc=" << inObj.acSegmentDevicePitch;
1052  else
1053  inOutStream << "n/a";
1054  return inOutStream;
1055 }
1056 
1057 
1058 ostream & operator << (ostream & inOutStream, const AUTOCIRCULATE_TRANSFER & inObj)
1059 {
1060  #if defined (_DEBUG)
1061  NTV2_ASSERT (inObj.NTV2_IS_STRUCT_VALID ());
1062  #endif
1063  string str (::NTV2FrameBufferFormatToString (inObj.acFrameBufferFormat, true));
1064  while (str.find (' ') != string::npos)
1065  str.erase (str.find (' '), 1);
1066  inOutStream << inObj.acHeader << " vid=" << inObj.acVideoBuffer
1067  << " aud=" << inObj.acAudioBuffer
1068  << " ancF1=" << inObj.acANCBuffer
1069  << " ancF2=" << inObj.acANCField2Buffer
1070  << " outTC(" << inObj.acOutputTimeCodes << ")"
1071  << " cookie=" << inObj.acInUserCookie
1072  << " vidDMAoff=" << inObj.acInVideoDMAOffset
1073  << " segDMA=" << inObj.acInSegmentedDMAInfo
1074  << " colcor=" << inObj.acColorCorrection
1075  << " fbf=" << str
1076  << " fbo=" << (inObj.acFrameBufferOrientation == NTV2_FRAMEBUFFER_ORIENTATION_BOTTOMUP ? "flip" : "norm")
1077  << " vidProc=" << inObj.acVidProcInfo
1078  << " quartsz=" << inObj.acVideoQuarterSizeExpand
1079  << " p2p=" << inObj.acPeerToPeerFlags
1080  << " repCnt=" << inObj.acFrameRepeatCount
1081  << " desFrm=" << inObj.acDesiredFrame
1082  << " rp188=" << inObj.acRP188 // deprecated
1083  << " xpt=" << inObj.acCrosspoint
1084  << " status{" << inObj.acTransferStatus << "}"
1085  << " " << inObj.acTrailer;
1086  return inOutStream;
1087 }
1088 
1089 
1090 ostream & operator << (ostream & inOutStream, const AUTOCIRCULATE_TRANSFER_STATUS & inObj)
1091 {
1092  inOutStream << inObj.acHeader << " state=" << ::NTV2AutoCirculateStateToString (inObj.acState)
1093  << " xferFrm=" << inObj.acTransferFrame
1094  << " bufLvl=" << inObj.acBufferLevel
1095  << " frms=" << inObj.acFramesProcessed
1096  << " drops=" << inObj.acFramesDropped
1097  << " " << inObj.acFrameStamp
1098  << " audXfrSz=" << inObj.acAudioTransferSize
1099  << " audStrtSamp=" << inObj.acAudioStartSample
1100  << " ancF1Siz=" << inObj.acAncTransferSize
1101  << " ancF2Siz=" << inObj.acAncField2TransferSize
1102  << " " << inObj.acTrailer;
1103  return inOutStream;
1104 }
1105 
1106 
1107 ostream & operator << (ostream & inOutStream, const NTV2RegisterValueMap & inObj)
1108 {
1109  NTV2RegValueMapConstIter iter (inObj.begin ());
1110  inOutStream << "RegValues:" << inObj.size () << "[";
1111  while (iter != inObj.end ())
1112  {
1113  const NTV2RegisterNumber registerNumber (static_cast <NTV2RegisterNumber> (iter->first));
1114  const ULWord registerValue (iter->second);
1115  inOutStream << ::NTV2RegisterNumberToString (registerNumber) << "=0x" << hex << registerValue << dec;
1116  if (++iter != inObj.end ())
1117  inOutStream << ",";
1118  }
1119  return inOutStream << "]";
1120 }
1121 
1122 
1123 ostream & operator << (ostream & inOutStream, const AutoCircVidProcInfo & inObj)
1124 {
1125  return inOutStream << "{mode=" << ::AutoCircVidProcModeToString (inObj.mode, true)
1126  << ", FGvid=" << ::NTV2CrosspointToString (inObj.foregroundVideoCrosspoint)
1127  << ", BGvid=" << ::NTV2CrosspointToString (inObj.backgroundVideoCrosspoint)
1128  << ", FGkey=" << ::NTV2CrosspointToString (inObj.foregroundKeyCrosspoint)
1129  << ", BGkey=" << ::NTV2CrosspointToString (inObj.backgroundKeyCrosspoint)
1130  << ", transCoeff=" << inObj.transitionCoefficient
1131  << ", transSoftn=" << inObj.transitionSoftness << "}";
1132 }
1133 
1134 
1135 ostream & operator << (ostream & inOutStream, const NTV2ColorCorrectionData & inObj)
1136 {
1137  return inOutStream << "{ccMode=" << ::NTV2ColorCorrectionModeToString (inObj.ccMode)
1138  << ", ccSatVal=" << inObj.ccSaturationValue
1139  << ", ccTables=" << inObj.ccLookupTables << "}";
1140 }
1141 
1142 
1144 {
1145  for (NTV2VideoFormatSetConstIter iter(inSet.begin()); iter != inSet.end(); ++iter)
1146  if (inOutSet.find(*iter) == inOutSet.end())
1147  inOutSet.insert(*iter);
1148  return inOutSet;
1149 }
1150 
1151 
1152 // Implementation of NTV2VideoFormatSet's ostream writer...
1153 ostream & operator << (ostream & inOStream, const NTV2VideoFormatSet & inFormats)
1154 {
1155  NTV2VideoFormatSet::const_iterator iter (inFormats.begin ());
1156 
1157  inOStream << inFormats.size ()
1158  << (inFormats.size () == 1 ? " video format: " : " video format(s): ");
1159 
1160  while (iter != inFormats.end ())
1161  {
1162  inOStream << std::string (::NTV2VideoFormatToString (*iter));
1163  inOStream << (++iter == inFormats.end () ? "" : ", ");
1164  }
1165 
1166  return inOStream;
1167 
1168 } // operator <<
1169 
1170 
1171 // Implementation of NTV2FrameBufferFormatSet's ostream writer...
1172 ostream & operator << (ostream & inOStream, const NTV2PixelFormats & inFormats)
1173 {
1174  NTV2PixelFormatsConstIter iter(inFormats.begin());
1175  inOStream << inFormats.size()
1176  << (inFormats.size() == 1 ? " pixel format: " : " pixel formats: ");
1177 
1178  while (iter != inFormats.end())
1179  {
1180  inOStream << ::NTV2FrameBufferFormatToString(*iter);
1181  inOStream << (++iter == inFormats.end() ? "" : ", ");
1182  }
1183  return inOStream;
1184 
1185 } // operator <<
1186 
1187 
1189 {
1190  for (NTV2PixelFormatsConstIter iter(inFBFs.begin()); iter != inFBFs.end(); ++iter)
1191  inOutSet.insert(*iter);
1192  return inOutSet;
1193 }
1194 
1195 
1196 // Implementation of NTV2StandardSet's ostream writer...
1197 ostream & operator << (ostream & inOStream, const NTV2StandardSet & inStandards)
1198 {
1199  NTV2StandardSetConstIter iter (inStandards.begin ());
1200 
1201  inOStream << inStandards.size ()
1202  << (inStandards.size () == 1 ? " standard: " : " standards: ");
1203 
1204  while (iter != inStandards.end ())
1205  {
1206  inOStream << ::NTV2StandardToString(*iter);
1207  inOStream << (++iter == inStandards.end () ? "" : ", ");
1208  }
1209 
1210  return inOStream;
1211 }
1212 
1213 
1215 {
1216  for (NTV2StandardSetConstIter iter(inSet.begin ()); iter != inSet.end(); ++iter)
1217  inOutSet.insert(*iter);
1218  return inOutSet;
1219 }
1220 
1221 
1222 // Implementation of NTV2GeometrySet's ostream writer...
1223 ostream & operator << (ostream & inOStream, const NTV2GeometrySet & inGeometries)
1224 {
1225  NTV2GeometrySetConstIter iter (inGeometries.begin ());
1226  inOStream << inGeometries.size ()
1227  << (inGeometries.size () == 1 ? " geometry: " : " geometries: ");
1228  while (iter != inGeometries.end ())
1229  {
1230  inOStream << ::NTV2FrameGeometryToString(*iter);
1231  inOStream << (++iter == inGeometries.end () ? "" : ", ");
1232  }
1233  return inOStream;
1234 }
1235 
1236 
1238 {
1239  for (NTV2GeometrySetConstIter iter(inSet.begin ()); iter != inSet.end(); ++iter)
1240  inOutSet.insert(*iter);
1241  return inOutSet;
1242 }
1243 
1244 
1245 // Implementation of NTV2FrameBufferFormatSet's ostream writer...
1246 ostream & operator << (ostream & inOStream, const NTV2InputSourceSet & inSet)
1247 {
1248  NTV2InputSourceSetConstIter iter(inSet.begin());
1249  inOStream << inSet.size()
1250  << (inSet.size() == 1 ? " input: " : " inputs: ");
1251  while (iter != inSet.end())
1252  {
1253  inOStream << ::NTV2InputSourceToString (*iter);
1254  inOStream << (++iter == inSet.end() ? "" : ", ");
1255  }
1256  return inOStream;
1257 } // operator <<
1258 
1259 
1261 {
1262  for (NTV2InputSourceSetConstIter iter (inSet.begin ()); iter != inSet.end (); ++iter)
1263  inOutSet.insert (*iter);
1264  return inOutSet;
1265 }
1266 
1267 
1268 ostream & operator << (ostream & inOStream, const NTV2OutputDestinations & inSet)
1269 {
1270  NTV2OutputDestinationsConstIter iter(inSet.begin());
1271  inOStream << inSet.size()
1272  << (inSet.size() == 1 ? " output: " : " outputs: ");
1273  while (iter != inSet.end())
1274  {
1275  inOStream << ::NTV2OutputDestinationToString(*iter);
1276  inOStream << (++iter == inSet.end() ? "" : ", ");
1277  }
1278  return inOStream;
1279 }
1280 
1281 
1283 {
1284  for (NTV2OutputDestinationsConstIter iter(inSet.begin()); iter != inSet.end(); ++iter)
1285  inOutSet.insert(*iter);
1286  return inOutSet;
1287 }
1288 
1290 {
1291  outFormats.clear();
1292  const NTV2DeviceIDSet devIDs (::NTV2GetSupportedDevices());
1293  for (NTV2DeviceIDSetConstIter it(devIDs.begin()); it != devIDs.end(); ++it)
1294  {
1295  NTV2PixelFormats fmts;
1297  for (NTV2PixelFormatsConstIter fit(fmts.begin()); fit != fmts.end(); ++fit)
1298  if (outFormats.find(*fit) == outFormats.end())
1299  outFormats.insert(*fit);
1300  }
1301  return true;
1302 }
1303 
1305 {
1306  NTV2PixelFormats usedFormats;
1307  ::NTV2GetSupportedPixelFormats(usedFormats);
1308  for (NTV2PixelFormat pf(NTV2_FBF_FIRST); pf < NTV2_FBF_LAST; pf = NTV2PixelFormat(pf+1))
1309  if (usedFormats.find(pf) == usedFormats.end()) // if unused
1310  outFormats.insert(pf);
1311  return true;
1312 }
1313 
1315 {
1316  outStandards.clear();
1317  const NTV2DeviceIDSet devIDs (::NTV2GetSupportedDevices());
1318  for (NTV2DeviceIDSetConstIter it(devIDs.begin()); it != devIDs.end(); ++it)
1319  {
1320  NTV2StandardSet stds;
1322  for (NTV2StandardSetConstIter sit(stds.begin()); sit != stds.end(); ++sit)
1323  if (outStandards.find(*sit) == outStandards.end())
1324  outStandards.insert(*sit);
1325  }
1326  return true;
1327 }
1328 
1330 {
1331  NTV2StandardSet usedStandards;
1332  ::NTV2GetSupportedStandards(usedStandards);
1334  if (usedStandards.find(st) == usedStandards.end()) // if unused
1335  outStandards.insert(st);
1336  return true;
1337 }
1338 
1339 
1340 // This needs to be moved into a C++ compatible "device features" module:
1342 {
1343  bool isOkay(true);
1344  outFormats.clear();
1345 
1347  {
1348  if (inDeviceID != DEVICE_ID_INVALID && !::NTV2DeviceCanDoVideoFormat(inDeviceID, vf))
1349  continue; // Valid devID specified and VF not supported on that device
1350  if (inDeviceID == DEVICE_ID_INVALID && !NTV2_IS_VALID_VIDEO_FORMAT(vf))
1351  continue; // Invalid devID specified and invalid VF
1352  try
1353  {
1354  outFormats.insert(vf);
1355  }
1356  catch (const std::bad_alloc &)
1357  {
1358  isOkay = false;
1359  outFormats.clear();
1360  break;
1361  }
1362  } // for each video format
1363 
1364  NTV2_ASSERT ((isOkay && !outFormats.empty()) || (!isOkay && outFormats.empty()));
1365  return isOkay;
1366 
1367 } // NTV2DeviceGetSupportedVideoFormats
1368 
1369 // This needs to be moved into a C++ compatible "device features" module:
1371 {
1372  bool isOkay(true);
1373  outFormats.clear();
1374 
1375  for (NTV2PixelFormat pixelFormat(NTV2_FBF_FIRST); pixelFormat < NTV2_FBF_LAST; pixelFormat = NTV2PixelFormat(pixelFormat+1))
1376  if (::NTV2DeviceCanDoFrameBufferFormat (inDeviceID, pixelFormat))
1377  try
1378  {
1379  outFormats.insert(pixelFormat);
1380  }
1381  catch (const std::bad_alloc &)
1382  {
1383  isOkay = false;
1384  outFormats.clear();
1385  break;
1386  }
1387 
1389  if (supportedDevices.find(inDeviceID) != supportedDevices.end())
1390  {// NTV2_ASSERT ((isOkay && !outFormats.empty() ) || (!isOkay && outFormats.empty() ));
1391  return isOkay && !outFormats.empty();
1392  }
1393  return isOkay;
1394 
1395 } // NTV2DeviceGetSupportedPixelFormats
1396 
1397 // This needs to be moved into a C++ compatible "device features" module:
1398 bool NTV2DeviceGetSupportedStandards (const NTV2DeviceID inDeviceID, NTV2StandardSet & outStandards)
1399 {
1400  NTV2VideoFormatSet videoFormats;
1401  outStandards.clear();
1402  if (!::NTV2DeviceGetSupportedVideoFormats(inDeviceID, videoFormats))
1403  return false;
1404  for (NTV2VideoFormatSetConstIter it(videoFormats.begin()); it != videoFormats.end(); ++it)
1405  {
1407  if (NTV2_IS_VALID_STANDARD(std) && outStandards.find(std) == outStandards.end())
1408  outStandards.insert(std);
1409  }
1410  return true;
1411 }
1412 
1413 // This needs to be moved into a C++ compatible "device features" module:
1414 bool NTV2DeviceGetSupportedGeometries (const NTV2DeviceID inDeviceID, NTV2GeometrySet & outGeometries)
1415 {
1416  NTV2VideoFormatSet videoFormats;
1417  outGeometries.clear();
1418  if (!::NTV2DeviceGetSupportedVideoFormats(inDeviceID, videoFormats))
1419  return false;
1420  for (NTV2VideoFormatSetConstIter it(videoFormats.begin()); it != videoFormats.end(); ++it)
1421  {
1424  outGeometries += ::GetRelatedGeometries(fg);
1425  }
1426  return true;
1427 }
1428 
1429 bool NTV2DeviceGetSupportedInputSources (const NTV2DeviceID inDeviceID, NTV2InputSourceSet & outInputSources, const NTV2IOKinds inKinds)
1430 {
1431  outInputSources.clear();
1432  if (!NTV2_IS_VALID_IOKINDS(inKinds))
1433  return false;
1435  { const bool ok (inDeviceID == DEVICE_ID_INVALID ? true : ::NTV2DeviceCanDoInputSource(inDeviceID, src));
1436  if (ok)
1437  if ( (NTV2_INPUT_SOURCE_IS_SDI(src) && (inKinds & NTV2_IOKINDS_SDI))
1438  || (NTV2_INPUT_SOURCE_IS_HDMI(src) && (inKinds & NTV2_IOKINDS_HDMI))
1439  || (NTV2_INPUT_SOURCE_IS_ANALOG(src) && (inKinds & NTV2_IOKINDS_ANALOG)) )
1440  outInputSources.insert(src);
1441  }
1442  return true;
1443 }
1444 
1445 bool NTV2DeviceGetSupportedOutputDests (const NTV2DeviceID inDeviceID, NTV2OutputDestinations & outOutputDests, const NTV2IOKinds inKinds)
1446 {
1450  outOutputDests.clear();
1451  if (!NTV2_IS_VALID_IOKINDS(inKinds))
1452  return false;
1453  const UWord numSDI(inDeviceID == DEVICE_ID_INVALID ? 8 : ::NTV2DeviceGetNumVideoOutputs(inDeviceID)),
1454  numAnl(inDeviceID == DEVICE_ID_INVALID ? 1 : ::NTV2DeviceGetNumAnalogVideoOutputs(inDeviceID)),
1455  numHDM(inDeviceID == DEVICE_ID_INVALID ? 1 : ::NTV2DeviceGetNumHDMIVideoOutputs(inDeviceID));
1456  for (size_t ndx(0); ndx < 10; ndx++)
1457  {
1458  const NTV2OutputDest dst(sDsts[ndx]);
1459  if ( (NTV2_OUTPUT_DEST_IS_SDI(dst) && (inKinds & NTV2_IOKINDS_SDI) && (numSDI > ::NTV2OutputDestinationToChannel(dst)))
1460  || (NTV2_OUTPUT_DEST_IS_HDMI(dst) && (inKinds & NTV2_IOKINDS_HDMI) && (numHDM) )
1461  || (NTV2_OUTPUT_DEST_IS_ANALOG(dst) && (inKinds & NTV2_IOKINDS_ANALOG) && (numAnl) ) )
1462  outOutputDests.insert(dst);
1463  }
1464  return true;
1465 }
1466 
1467 ostream & operator << (ostream & oss, const NTV2FrameRateSet & inSet)
1468 {
1469  NTV2FrameRateSetConstIter it(inSet.begin());
1470  oss << inSet.size()
1471  << (inSet.size() == 1 ? " rate: " : " rates: ");
1472  while (it != inSet.end())
1473  {
1474  oss << ::NTV2FrameRateToString(*it);
1475  oss << (++it == inSet.end() ? "" : ", ");
1476  }
1477  return oss;
1478 }
1479 
1481 {
1482  for (NTV2FrameRateSetConstIter it(inSet.begin()); it != inSet.end(); ++it)
1483  if (inOutSet.find(*it) == inOutSet.end())
1484  inOutSet.insert(*it);
1485  return inOutSet;
1486 }
1487 
1489 {
1490  outRates.clear();
1491  NTV2VideoFormatSet vfs;
1492  if (!::NTV2DeviceGetSupportedVideoFormats (inDeviceID, vfs))
1493  return false;
1494  for (NTV2VideoFormatSetConstIter it(vfs.begin()); it != vfs.end(); ++it)
1495  { const NTV2FrameRate fr (::GetNTV2FrameRateFromVideoFormat(*it));
1497  outRates.insert(fr);
1498  }
1499  return true;
1500 }
1501 
1502 
1503 ostream & operator << (ostream & inOutStrm, const NTV2SegmentedXferInfo & inRun)
1504 {
1505  return inRun.Print(inOutStrm);
1506 }
1507 
1508 
1509 // Implementation of NTV2AutoCirculateStateToString...
1511 {
1512  static const char * sStateStrings [] = { "Disabled", "Initializing", "Starting", "Paused", "Stopping", "Running", "StartingAtTime", AJA_NULL};
1514  return string (sStateStrings [inState]);
1515  else
1516  return "<invalid>";
1517 }
1518 
1519 
1520 
1523  fTrailerTag (NTV2_TRAILER_TAG)
1524 {
1525 }
1526 
1527 
1528 NTV2FrameSize::operator NTV2FrameGeometry() const // Cast to NTV2FrameGeometry
1529 {
1530  return isValid() ? ::GetGeometryFromFrameDimensions(*this) : NTV2_FG_INVALID;
1531 }
1532 
1534 { // Requires C++11:
1535  static const FGSizesMap sFGWdths = { {NTV2_FG_720x486, 720},
1536  {NTV2_FG_720x508, 720},
1537  {NTV2_FG_720x514, 720},
1538  {NTV2_FG_720x576, 720},
1539  {NTV2_FG_720x598, 720},
1540  {NTV2_FG_720x612, 720},
1541  {NTV2_FG_1280x720, 1280},
1542  {NTV2_FG_1280x740, 1280},
1543  {NTV2_FG_1920x1080, 1920},
1544  {NTV2_FG_1920x1114, 1920},
1545  {NTV2_FG_1920x1112, 1920},
1546  {NTV2_FG_2048x1080, 2048},
1547  {NTV2_FG_2048x1112, 2048},
1548  {NTV2_FG_2048x1114, 2048},
1549  {NTV2_FG_2048x1556, 2048},
1550  {NTV2_FG_2048x1588, 2048},
1551  {NTV2_FG_3840x2160, 3840},
1552  {NTV2_FG_4096x2160, 4096},
1553  {NTV2_FG_7680x4320, 7680},
1554  {NTV2_FG_8192x4320, 8192} };
1555  FGSizesMapCI it (sFGWdths.find(fg));
1556  return it != sFGWdths.end() ? it->second : 0;
1557 }
1558 
1560 { // Requires C++11:
1561  static const FGSizesMap sFGHghts = { {NTV2_FG_720x486, 486},
1562  {NTV2_FG_720x508, 508},
1563  {NTV2_FG_720x514, 514},
1564  {NTV2_FG_720x576, 576},
1565  {NTV2_FG_720x598, 598},
1566  {NTV2_FG_720x612, 612},
1567  {NTV2_FG_1280x720, 720},
1568  {NTV2_FG_1280x740, 740},
1569  {NTV2_FG_2048x1556, 1556},
1570  {NTV2_FG_2048x1588, 1588},
1571  {NTV2_FG_1920x1080, 1080},
1572  {NTV2_FG_2048x1080, 1080},
1573  {NTV2_FG_1920x1114, 1114},
1574  {NTV2_FG_2048x1114, 1114},
1575  {NTV2_FG_1920x1112, 1112},
1576  {NTV2_FG_2048x1112, 1112},
1577  {NTV2_FG_3840x2160, 2160},
1578  {NTV2_FG_4096x2160, 2160},
1579  {NTV2_FG_7680x4320, 4320},
1580  {NTV2_FG_8192x4320, 4320} };
1581  FGSizesMapCI it (sFGHghts.find(fg));
1582  return it != sFGHghts.end() ? it->second : 0;
1583 }
1584 
1585 
1586 static const string sSegXferUnits[] = {"", " U8", " U16", "", " U32", "", "", "", " U64", ""};
1587 
1588 ostream & NTV2SegmentedXferInfo::Print (ostream & inStrm, const bool inDumpSegments) const
1589 {
1590  if (!isValid())
1591  return inStrm << "(invalid)";
1592  if (inDumpSegments)
1593  {
1594  // TBD
1595  }
1596  else
1597  {
1598  inStrm << DEC(getSegmentCount()) << " x " << DEC(getSegmentLength())
1599  << sSegXferUnits[getElementLength()] << " segs";
1600  if (getSourceOffset())
1601  inStrm << " srcOff=" << xHEX0N(getSourceOffset(),8);
1602  if (getSegmentCount() > 1)
1603  inStrm << " srcSpan=" << xHEX0N(getSourcePitch(),8) << (isSourceBottomUp()?" VF":"");
1604  if (getDestOffset())
1605  inStrm << " dstOff=" << xHEX0N(getDestOffset(),8);
1606  if (getSegmentCount() > 1)
1607  inStrm << " dstSpan=" << xHEX0N(getDestPitch(),8) << (isDestBottomUp()?" VF":"");
1608  inStrm << " totElm=" << DEC(getTotalElements()) << " totByt=" << xHEX0N(getTotalBytes(),8);
1609  }
1610  return inStrm;
1611 }
1612 
1613 string NTV2SegmentedXferInfo::getSourceCode (const bool inInclDecl) const
1614 {
1615  static string var("segInfo");
1616  ostringstream oss;
1617  string units("\t// bytes");
1618  if (!isValid())
1619  return "";
1620  if (inInclDecl)
1621  oss << "NTV2SegmentedXferInfo " << var << ";" << endl;
1622  if (getElementLength() > 1)
1623  {
1624  units = "\t// " + sSegXferUnits[getElementLength()] + "s";
1625  oss << var << ".setElementLength(" << getElementLength() << ");" << endl;
1626  }
1627  oss << var << ".setSegmentCount(" << DEC(getSegmentCount()) << ");" << endl;
1628  oss << var << ".setSegmentLength(" << DEC(getSegmentLength()) << ");" << units << endl;
1629  if (getSourceOffset())
1630  oss << var << ".setSourceOffset(" << DEC(getSourceOffset()) << ");" << units << endl;
1631  oss << var << ".setSourcePitch(" << DEC(getSourcePitch()) << ");" << units << endl;
1632  if (isSourceBottomUp())
1633  oss << var << ".setSourceDirection(false);" << endl;
1634  if (getDestOffset())
1635  oss << var << ".setDestOffset(" << DEC(getDestOffset()) << ");" << units << endl;
1636  if (getDestPitch())
1637  oss << var << ".setDestPitch(" << DEC(getDestPitch()) << ");" << units << endl;
1638  if (isDestBottomUp())
1639  oss << var << ".setDestDirection(false);" << endl;
1640  return oss.str();
1641 }
1642 
1643 bool NTV2SegmentedXferInfo::containsElementAtOffset (const ULWord inElementOffset) const
1644 {
1645  if (!isValid())
1646  return false;
1647  if (getSegmentCount() == 1)
1648  {
1649  if (inElementOffset >= getSourceOffset())
1650  if (inElementOffset < getSourceOffset()+getSegmentLength())
1651  return true;
1652  return false;
1653  }
1654  ULWord offset(getSourceOffset());
1655  for (ULWord seg(0); seg < getSegmentCount(); seg++)
1656  {
1657  if (inElementOffset < offset)
1658  return false; // past element of interest already
1659  if (inElementOffset < offset+getSegmentLength())
1660  return true; // must be within this segment
1661  offset += getSourcePitch(); // skip to next segment
1662  }
1663  return false;
1664 }
1665 
1667 {
1668  if (getElementLength() != inRHS.getElementLength())
1669  // FUTURE TBD: Need to transform RHS to match ElementLength so as to make apples-to-apples comparison
1670  return true; // For now, fail
1671  if (getSegmentCount() != inRHS.getSegmentCount())
1672  return true;
1673  if (getSegmentLength() != inRHS.getSegmentLength())
1674  return true;
1675  if (getSourceOffset() != inRHS.getSourceOffset())
1676  return true;
1677  if (getSourcePitch() != inRHS.getSourcePitch())
1678  return true;
1679  if (getDestOffset() != inRHS.getDestOffset())
1680  return true;
1681  if (getDestPitch() != inRHS.getDestPitch())
1682  return true;
1683  return false;
1684 }
1685 
1687 {
1688  mFlags = 0;
1689  mNumSegments = 0;
1690  mElementsPerSegment = 0;
1691  mInitialSrcOffset = 0;
1692  mInitialDstOffset = 0;
1693  mSrcElementsPerRow = 0;
1694  mDstElementsPerRow = 0;
1695  setElementLength(1); // elements == bytes
1696  return *this;
1697 }
1698 
1700 {
1701  std::swap(mSrcElementsPerRow, mDstElementsPerRow);
1702  std::swap(mInitialSrcOffset, mInitialDstOffset);
1703  const bool srcNormal(this->isSourceTopDown()), dstNormal(this->isDestTopDown());
1704  setSourceDirection(dstNormal).setDestDirection(srcNormal);
1705  return *this;
1706 }
1707 
1708 
1709 NTV2Buffer::NTV2Buffer (const void * pInUserPointer, const size_t inByteCount)
1710  : fUserSpacePtr (inByteCount ? NTV2Buffer_TO_ULWORD64(pInUserPointer) : 0),
1711  fByteCount (ULWord(pInUserPointer ? inByteCount : 0)),
1712  fFlags (0),
1713  #if defined (AJAMac)
1714  fKernelSpacePtr (0),
1715  fIOMemoryDesc (0),
1716  fIOMemoryMap (0)
1717  #else
1718  //fKernelSpacePtr (0),
1719  fKernelHandle (0)
1720  #endif
1721 {
1722 }
1723 
1724 
1725 NTV2Buffer::NTV2Buffer (const size_t inByteCount)
1726  : fUserSpacePtr (0),
1727  fByteCount (0),
1728  fFlags (0),
1729  #if defined (AJAMac)
1730  fKernelSpacePtr (0),
1731  fIOMemoryDesc (0),
1732  fIOMemoryMap (0)
1733  #else
1734  //fKernelSpacePtr (0),
1735  fKernelHandle (0)
1736  #endif
1737 {
1738  if (inByteCount)
1739  Allocate(inByteCount);
1740 }
1741 
1742 
1744  : fUserSpacePtr (0),
1745  fByteCount (0),
1746  fFlags (0),
1747  #if defined (AJAMac)
1748  fKernelSpacePtr (0),
1749  fIOMemoryDesc (0),
1750  fIOMemoryMap (0)
1751  #else
1752  //fKernelSpacePtr (0),
1753  fKernelHandle (0)
1754  #endif
1755 {
1756  if (Allocate(inObj.GetByteCount()))
1757  SetFrom(inObj);
1758 }
1759 
1760 bool NTV2Buffer::Truncate (const size_t inNewByteCount)
1761 {
1762  if (inNewByteCount == GetByteCount())
1763  return true; // Same size -- done!
1764  if (inNewByteCount > GetByteCount())
1765  return false; // Cannot enlarge -- i.e. can't be greater than my current size
1766  if (!inNewByteCount && IsAllocatedBySDK())
1767  return Deallocate(); // A newByteCount of zero calls Deallocate
1768  fByteCount = ULWord(inNewByteCount);
1769  return true;
1770 }
1771 
1773 {
1774  if (&inRHS != this)
1775  {
1776  if (inRHS.IsNULL())
1777  Set (AJA_NULL, 0);
1778  else if (GetByteCount() == inRHS.GetByteCount())
1779  SetFrom(inRHS);
1780  else if (Allocate(inRHS.GetByteCount()))
1781  SetFrom(inRHS);
1782  //else; // Error
1783  }
1784  return *this;
1785 }
1786 
1787 
1789 {
1790  Set (AJA_NULL, 0); // Call 'Set' to delete the array (if I allocated it)
1791 }
1792 
1793 
1795 {
1796  uint64_t * pU64s(reinterpret_cast<uint64_t*>(GetHostPointer()));
1797  const size_t loopCount(GetByteCount() / sizeof(uint64_t));
1798  if (IsNULL())
1799  return false;
1800  for (size_t ndx(0); ndx < loopCount; ndx++)
1801  pU64s[ndx] = NTV2EndianSwap64(pU64s[ndx]);
1802  return true;
1803 }
1804 
1805 
1807 {
1808  uint32_t * pU32s(reinterpret_cast<uint32_t*>(GetHostPointer()));
1809  const size_t loopCount(GetByteCount() / sizeof(uint32_t));
1810  if (IsNULL())
1811  return false;
1812  for (size_t ndx(0); ndx < loopCount; ndx++)
1813  pU32s[ndx] = NTV2EndianSwap32(pU32s[ndx]);
1814  return true;
1815 }
1816 
1817 
1819 {
1820  uint16_t * pU16s(reinterpret_cast<uint16_t*>(GetHostPointer()));
1821  const size_t loopCount(GetByteCount() / sizeof(uint16_t));
1822  if (IsNULL())
1823  return false;
1824  for (size_t ndx(0); ndx < loopCount; ndx++)
1825  pU16s[ndx] = NTV2EndianSwap16(pU16s[ndx]);
1826  return true;
1827 }
1828 
1829 
1830 bool NTV2Buffer::Set (const void * pInUserPointer, const size_t inByteCount)
1831 {
1832  if (uint64_t(inByteCount) >= 0x0000000100000000) // inByteCount >= 4GB?
1833  return false; // Can't store 4GB or larger value in fByteCount
1834  Deallocate();
1835  fUserSpacePtr = inByteCount ? NTV2Buffer_TO_ULWORD64(pInUserPointer) : 0;
1836  fByteCount = ULWord(pInUserPointer ? inByteCount : 0);
1837  // Return true only if both UserPointer and ByteCount are non-zero, or both are zero.
1838  return (pInUserPointer && inByteCount) || (!pInUserPointer && !inByteCount);
1839 }
1840 
1841 
1842 bool NTV2Buffer::SetAndFill (const void * pInUserPointer, const size_t inByteCount, const UByte inValue)
1843 {
1844  return Set(pInUserPointer, inByteCount) && Fill(inValue);
1845 }
1846 
1847 
1848 bool NTV2Buffer::Allocate (const size_t inByteCount, const bool inPageAligned)
1849 {
1850  if (uint64_t(inByteCount) >= 0x0000000100000000) // inByteCount >= 4GB?
1851  return false; // Can't store 4GB or more in fByteCount
1852  if (GetByteCount() && IsAllocatedBySDK()) // If already was Allocated
1853  if (inByteCount == GetByteCount()) // If same byte count
1854  {
1855  Fill(UByte(0)); // Zero it...
1856  return true; // ...and return true
1857  }
1858 
1859  bool result(Set(AJA_NULL, 0)); // Jettison existing buffer (if any)
1860  if (inByteCount)
1861  { // Allocate the byte array, and call Set...
1862  UByte * pBuffer(AJA_NULL);
1863  result = false;
1864  if (inPageAligned)
1865  pBuffer = reinterpret_cast<UByte*>(AJAMemory::AllocateAligned(inByteCount, DefaultPageSize()));
1866  else
1867  try
1868  {pBuffer = new UByte[inByteCount];}
1869  catch (const std::bad_alloc &)
1870  {pBuffer = AJA_NULL;}
1871  if (pBuffer && Set(pBuffer, inByteCount))
1872  { // SDK owns this memory -- set NTV2Buffer_ALLOCATED bit -- I'm responsible for deleting
1873  result = true;
1874  fFlags |= NTV2Buffer_ALLOCATED;
1875  if (inPageAligned)
1876  fFlags |= NTV2Buffer_PAGE_ALIGNED; // Set "page aligned" flag
1877  Fill(UByte(0)); // Zero it
1878  }
1879  } // if requested size is non-zero
1880  return result;
1881 }
1882 
1883 
1885 {
1886  if (IsAllocatedBySDK())
1887  {
1888  if (!IsNULL())
1889  {
1890  if (IsPageAligned())
1891  {
1893  fFlags &= ~NTV2Buffer_PAGE_ALIGNED;
1894  }
1895  else
1896  delete [] reinterpret_cast<UByte*>(GetHostPointer());
1897  }
1898  fUserSpacePtr = 0;
1899  fByteCount = 0;
1900  fFlags &= ~NTV2Buffer_ALLOCATED;
1901  }
1902  return true;
1903 }
1904 
1905 
1906 void * NTV2Buffer::GetHostAddress (const ULWord inByteOffset, const bool inFromEnd) const
1907 {
1908  if (IsNULL())
1909  return AJA_NULL;
1910  if (inByteOffset >= GetByteCount())
1911  return AJA_NULL;
1912  UByte * pBytes (reinterpret_cast<UByte*>(GetHostPointer()));
1913  if (inFromEnd)
1914  pBytes += GetByteCount() - inByteOffset;
1915  else
1916  pBytes += inByteOffset;
1917  return pBytes;
1918 }
1919 
1920 
1921 bool NTV2Buffer::SetFrom (const NTV2Buffer & inBuffer)
1922 {
1923  if (inBuffer.IsNULL())
1924  return false; // NULL or empty
1925  if (IsNULL())
1926  return false; // I am NULL or empty
1927  if (inBuffer.GetByteCount() == GetByteCount() && inBuffer.GetHostPointer() == GetHostPointer())
1928  return true; // Same buffer
1929 
1930  size_t bytesToCopy(inBuffer.GetByteCount());
1931  if (bytesToCopy > GetByteCount())
1932  bytesToCopy = GetByteCount();
1933  ::memcpy (GetHostPointer(), inBuffer.GetHostPointer(), bytesToCopy);
1934  return true;
1935 }
1936 
1937 
1938 bool NTV2Buffer::CopyFrom (const void * pInSrcBuffer, const ULWord inByteCount)
1939 {
1940  if (!inByteCount)
1941  return Set (AJA_NULL, 0); // Zero bytes
1942  if (!pInSrcBuffer)
1943  return false; // NULL src ptr
1944  if (!Allocate (inByteCount))
1945  return false; // Resize failed
1946  ::memcpy (GetHostPointer(), pInSrcBuffer, inByteCount);
1947  return true;
1948 }
1949 
1950 
1951 bool NTV2Buffer::CopyFrom (const NTV2Buffer & inBuffer,
1952  const ULWord inSrcByteOffset, const ULWord inDstByteOffset, const ULWord inByteCount)
1953 {
1954  if (inBuffer.IsNULL() || IsNULL())
1955  return false; // NULL or empty
1956  if (inSrcByteOffset + inByteCount > inBuffer.GetByteCount())
1957  return false; // Past end of src
1958  if (inDstByteOffset + inByteCount > GetByteCount())
1959  return false; // Past end of me
1960 
1961  const UByte * pSrc (inBuffer);
1962  pSrc += inSrcByteOffset;
1963 
1964  UByte * pDst (*this);
1965  pDst += inDstByteOffset;
1966 
1967  ::memcpy (pDst, pSrc, inByteCount);
1968  return true;
1969 }
1970 
1971 
1972 bool NTV2Buffer::CopyFrom (const NTV2Buffer & inSrcBuffer, const NTV2SegmentedXferInfo & inXferInfo)
1973 {
1974  if (!inXferInfo.isValid() || inSrcBuffer.IsNULL() || IsNULL())
1975  return false;
1976 
1977  // Copy every segment...
1978  LWord srcOffset (LWord(inXferInfo.getSourceOffset() * inXferInfo.getElementLength()));
1979  LWord dstOffset (LWord(inXferInfo.getDestOffset() * inXferInfo.getElementLength()));
1980  LWord srcPitch (LWord(inXferInfo.getSourcePitch() * inXferInfo.getElementLength()));
1981  LWord dstPitch (LWord(inXferInfo.getDestPitch() * inXferInfo.getElementLength()));
1982  const LWord bytesPerSeg (inXferInfo.getSegmentLength() * inXferInfo.getElementLength());
1983  if (inXferInfo.isSourceBottomUp())
1984  srcPitch = 0 - srcPitch;
1985  if (inXferInfo.isDestBottomUp())
1986  dstPitch = 0 - dstPitch;
1987  for (ULWord segNdx(0); segNdx < inXferInfo.getSegmentCount(); segNdx++)
1988  {
1989  const void * pSrc (inSrcBuffer.GetHostAddress(srcOffset));
1990  void * pDst (GetHostAddress(dstOffset));
1991  if (!pSrc) return false;
1992  if (!pDst) return false;
1993  if (srcOffset + bytesPerSeg > LWord(inSrcBuffer.GetByteCount()))
1994  return false; // memcpy will read past end of srcBuffer
1995  if (dstOffset + bytesPerSeg > LWord(GetByteCount()))
1996  return false; // memcpy will write past end of me
1997  ::memcpy (pDst, pSrc, size_t(bytesPerSeg));
1998  srcOffset += srcPitch; // Bump src offset
1999  dstOffset += dstPitch; // Bump dst offset
2000  } // for each segment
2001  return true;
2002 }
2003 
2004 bool NTV2Buffer::SetFromHexString (const string & inStr)
2005 {
2006  string str(inStr);
2007 
2008  // Remove all whitespace...
2009  const string newline("\n"), tab("\t");
2010  aja::replace(str, newline, string());
2011  aja::replace(str, tab, string());
2012  aja::upper(str);
2013 
2014  // Fail if any non-hex found...
2015  for (size_t ndx(0); ndx < str.size(); ndx++)
2016  if (!aja::is_hex_digit(str.at(ndx)))
2017  return false;
2018 
2019  if (str.size() & 1)
2020  return false; // Remaining length must be even
2021  if (!Allocate(str.size() / 2))
2022  return false; // Resize failed
2023 
2024  // Decode and copy in the data...
2025  for (size_t srcNdx(0), dstNdx(0); srcNdx < str.size(); srcNdx += 2)
2026  U8(int(dstNdx++)) = uint8_t(aja::stoul (str.substr(srcNdx,2), AJA_NULL, 16));
2027 
2028  return true;
2029 }
2030 
2032 {
2033  if (inBuffer.IsNULL ())
2034  return false; // NULL or empty
2035  if (IsNULL ())
2036  return false; // I am NULL or empty
2037  if (inBuffer.GetByteCount () != GetByteCount ())
2038  return false; // Different sizes
2039  if (fFlags != inBuffer.fFlags)
2040  return false; // Flags mismatch
2041  if (inBuffer.GetHostPointer () == GetHostPointer ())
2042  return true; // Same buffer
2043 
2044  ULWord64 tmp = fUserSpacePtr;
2045  fUserSpacePtr = inBuffer.fUserSpacePtr;
2046  inBuffer.fUserSpacePtr = tmp;
2047  return true;
2048 }
2049 
2050 ULWordSet & NTV2Buffer::Find (ULWordSet & outOffsets, const NTV2Buffer & inValue, const size_t inLimit) const
2051 {
2052  outOffsets.clear();
2053  if (IsNULL())
2054  return outOffsets; // NULL buffer, return "no matches"
2055  if (inValue.IsNULL())
2056  return outOffsets; // NULL buffer, return "no matches"
2057  const ULWord srchByteCount(inValue.GetByteCount());
2058  if (GetByteCount() < srchByteCount)
2059  return outOffsets; // I'm smaller than the search data, return "no matches"
2060 
2061  const ULWord maxOffset(GetByteCount() - srchByteCount); // Don't search past here
2062  const uint8_t * pSrchData (inValue); // Pointer to search data
2063  const uint8_t * pMyData (*this); // Pointer to where search starts in me
2064  ULWord offset(0); // Search starts at this byte offset
2065  do
2066  {
2067  if (!::memcmp(pMyData, pSrchData, srchByteCount))
2068  {
2069  outOffsets.insert(offset); // Record byte offset of match
2070  if (inLimit && outOffsets.size() >= inLimit)
2071  break; // reached limit, early exit
2072  }
2073  pMyData++; // Bump search pointer
2074  offset++; // Bump search byte offset
2075  } while (offset < maxOffset);
2076  return outOffsets;
2077 }
2078 
2079 bool NTV2Buffer::IsContentEqual (const NTV2Buffer & inBuffer, const ULWord inByteOffset, const ULWord inByteCount) const
2080 {
2081  if (IsNULL() || inBuffer.IsNULL())
2082  return false; // Buffer(s) are NULL/empty
2083  if (inBuffer.GetByteCount() != GetByteCount())
2084  return false; // Buffers are different sizes
2085 
2086  ULWord totalBytes(GetByteCount());
2087  if (inByteOffset >= totalBytes)
2088  return false; // Bad offset
2089 
2090  totalBytes -= inByteOffset;
2091 
2092  ULWord byteCount(inByteCount);
2093  if (byteCount > totalBytes)
2094  byteCount = totalBytes;
2095 
2096  if (inBuffer.GetHostPointer() == GetHostPointer())
2097  return true; // Same buffer
2098 
2099  const UByte * pByte1 (*this);
2100  const UByte * pByte2 (inBuffer);
2101  pByte1 += inByteOffset;
2102  pByte2 += inByteOffset;
2103  #if !defined(NTV2BUFFER_NO_MEMCMP)
2104  return ::memcmp (pByte1, pByte2, byteCount) == 0;
2105  #else // NTV2BUFFER_NO_MEMCMP
2106  ULWord offset(inByteOffset);
2107  while (byteCount)
2108  {
2109  if (*pByte1 != *pByte2)
2110  {
2111  cerr << "## ERROR: IsContentEqual: miscompare at offset " << xHEX0N(offset,8)
2112  << " (" << DEC(offset) << "): " << xHEX0N(UWord(*pByte1),2) << " != "
2113  << xHEX0N(UWord(*pByte2),2) << ", " << xHEX0N(byteCount,8) << " ("
2114  << DEC(byteCount) << ") bytes left to compare" << endl;
2115  return false;
2116  }
2117  pByte1++; pByte2++;
2118  byteCount--;
2119  offset++;
2120  }
2121  return true;
2122  #endif // NTV2BUFFER_NO_MEMCMP
2123 }
2124 
2125 bool NTV2Buffer::NextDifference (const NTV2Buffer & inBuffer, ULWord & byteOffset) const
2126 {
2127  if (byteOffset == 0xFFFFFFFF)
2128  return false; // bad offset
2129  if (IsNULL() || inBuffer.IsNULL())
2130  return false; // NULL or empty buffers
2131  if (inBuffer.GetByteCount() != GetByteCount())
2132  return false; // Different byte counts
2133  if (inBuffer.GetHostPointer() == GetHostPointer())
2134  {byteOffset = 0xFFFFFFFF; return true;} // Same buffer
2135 
2136  ULWord totalBytesToCompare(GetByteCount());
2137  if (byteOffset >= totalBytesToCompare)
2138  return false; // Bad offset
2139  totalBytesToCompare -= byteOffset;
2140 
2141  const UByte * pByte1 (*this);
2142  const UByte * pByte2 (inBuffer);
2143  while (totalBytesToCompare)
2144  {
2145  if (pByte1[byteOffset] != pByte2[byteOffset])
2146  return true;
2147  totalBytesToCompare--;
2148  byteOffset++;
2149  }
2150  byteOffset = 0xFFFFFFFF;
2151  return true;
2152 }
2153 
2154 bool NTV2Buffer::GetRingChangedByteRange (const NTV2Buffer & inBuffer, ULWord & outByteOffsetFirst, ULWord & outByteOffsetLast) const
2155 {
2156  outByteOffsetFirst = outByteOffsetLast = GetByteCount ();
2157  if (IsNULL () || inBuffer.IsNULL ())
2158  return false; // NULL or empty
2159  if (inBuffer.GetByteCount () != GetByteCount ())
2160  return false; // Different byte counts
2161  if (inBuffer.GetHostPointer () == GetHostPointer ())
2162  return true; // Same buffer
2163  if (GetByteCount() < 3)
2164  return false; // Too small
2165 
2166  const UByte * pByte1 (reinterpret_cast <const UByte *> (GetHostPointer()));
2167  const UByte * pByte2 (reinterpret_cast <const UByte *> (inBuffer.GetHostPointer()));
2168 
2169  outByteOffsetFirst = 0;
2170  while (outByteOffsetFirst < GetByteCount())
2171  {
2172  if (*pByte1 != *pByte2)
2173  break;
2174  pByte1++;
2175  pByte2++;
2176  outByteOffsetFirst++;
2177  }
2178  if (outByteOffsetFirst == 0)
2179  {
2180  // Wrap case -- look for first match...
2181  while (outByteOffsetFirst < GetByteCount())
2182  {
2183  if (*pByte1 == *pByte2)
2184  break;
2185  pByte1++;
2186  pByte2++;
2187  outByteOffsetFirst++;
2188  }
2189  if (outByteOffsetFirst < GetByteCount())
2190  outByteOffsetFirst--;
2191  }
2192  if (outByteOffsetFirst == GetByteCount())
2193  return true; // Identical --- outByteOffsetFirst == outByteOffsetLast == GetByteCount()
2194 
2195  // Now scan from the end...
2196  pByte1 = reinterpret_cast <const UByte *> (GetHostPointer());
2197  pByte2 = reinterpret_cast <const UByte *> (inBuffer.GetHostPointer());
2198  pByte1 += GetByteCount () - 1; // Point to last byte
2199  pByte2 += GetByteCount () - 1;
2200  while (--outByteOffsetLast)
2201  {
2202  if (*pByte1 != *pByte2)
2203  break;
2204  pByte1--;
2205  pByte2--;
2206  }
2207  if (outByteOffsetLast == (GetByteCount() - 1))
2208  {
2209  // Wrap case -- look for first match...
2210  while (outByteOffsetLast)
2211  {
2212  if (*pByte1 == *pByte2)
2213  break;
2214  pByte1--;
2215  pByte2--;
2216  outByteOffsetLast--;
2217  }
2218  if (outByteOffsetLast < GetByteCount())
2219  outByteOffsetLast++;
2220  if (outByteOffsetLast <= outByteOffsetFirst)
2221  cerr << "## WARNING: GetRingChangedByteRange: last " << outByteOffsetLast << " <= first " << outByteOffsetFirst << " in wrap condition" << endl;
2222  const ULWord tmp (outByteOffsetLast);
2223  outByteOffsetLast = outByteOffsetFirst;
2224  outByteOffsetFirst = tmp;
2225  if (outByteOffsetLast >= outByteOffsetFirst)
2226  cerr << "## WARNING: GetRingChangedByteRange: last " << outByteOffsetLast << " >= first " << outByteOffsetFirst << " in wrap condition" << endl;
2227  }
2228  return true;
2229 
2230 } // GetRingChangedByteRange
2231 
2232 
2233 static size_t gDefaultPageSize (AJA_PAGE_SIZE);
2234 
2236 {
2237  return gDefaultPageSize;
2238 }
2239 
2240 bool NTV2Buffer::SetDefaultPageSize (const size_t inNewSize)
2241 {
2242  const bool result (inNewSize && (!(inNewSize & (inNewSize - 1))));
2243  if (result)
2244  gDefaultPageSize = inNewSize;
2245  return result;
2246 }
2247 
2249 {
2250 #if defined(MSWindows) || defined(AJABareMetal)
2251  return AJA_PAGE_SIZE;
2252 #else
2253  return size_t(::getpagesize());
2254 #endif
2255 }
2256 
2257 
2259  : acHeader (NTV2_TYPE_ACFRAMESTAMP, sizeof(FRAME_STAMP)),
2260  acFrameTime (0),
2261  acRequestedFrame (0),
2262  acAudioClockTimeStamp (0),
2263  acAudioExpectedAddress (0),
2264  acAudioInStartAddress (0),
2265  acAudioInStopAddress (0),
2266  acAudioOutStopAddress (0),
2267  acAudioOutStartAddress (0),
2268  acTotalBytesTransferred (0),
2269  acStartSample (0),
2270  acTimeCodes (NTV2_MAX_NUM_TIMECODE_INDEXES * sizeof (NTV2_RP188)),
2271  acCurrentTime (0),
2272  acCurrentFrame (0),
2273  acCurrentFrameTime (0),
2274  acAudioClockCurrentTime (0),
2275  acCurrentAudioExpectedAddress (0),
2276  acCurrentAudioStartAddress (0),
2277  acCurrentFieldCount (0),
2278  acCurrentLineCount (0),
2279  acCurrentReps (0),
2280  acCurrentUserCookie (0),
2281  acFrame (0),
2282  acRP188 ()
2283 {
2285 }
2286 
2287 
2289  : acHeader (inObj.acHeader),
2290  acFrameTime (inObj.acFrameTime),
2291  acRequestedFrame (inObj.acRequestedFrame),
2292  acAudioClockTimeStamp (inObj.acAudioClockTimeStamp),
2293  acAudioExpectedAddress (inObj.acAudioExpectedAddress),
2294  acAudioInStartAddress (inObj.acAudioInStartAddress),
2295  acAudioInStopAddress (inObj.acAudioInStopAddress),
2296  acAudioOutStopAddress (inObj.acAudioOutStopAddress),
2297  acAudioOutStartAddress (inObj.acAudioOutStartAddress),
2298  acTotalBytesTransferred (inObj.acTotalBytesTransferred),
2299  acStartSample (inObj.acStartSample),
2300  acCurrentTime (inObj.acCurrentTime),
2301  acCurrentFrame (inObj.acCurrentFrame),
2302  acCurrentFrameTime (inObj.acCurrentFrameTime),
2303  acAudioClockCurrentTime (inObj.acAudioClockCurrentTime),
2304  acCurrentAudioExpectedAddress (inObj.acCurrentAudioExpectedAddress),
2305  acCurrentAudioStartAddress (inObj.acCurrentAudioStartAddress),
2306  acCurrentFieldCount (inObj.acCurrentFieldCount),
2307  acCurrentLineCount (inObj.acCurrentLineCount),
2308  acCurrentReps (inObj.acCurrentReps),
2309  acCurrentUserCookie (inObj.acCurrentUserCookie),
2310  acFrame (inObj.acFrame),
2311  acRP188 (inObj.acRP188),
2312  acTrailer (inObj.acTrailer)
2313 {
2315 }
2316 
2317 
2319 {
2320 }
2321 
2322 
2324 {
2326  ULWord numRP188s (acTimeCodes.GetByteCount () / sizeof (NTV2_RP188));
2327  const NTV2_RP188 * pArray (reinterpret_cast <const NTV2_RP188 *> (acTimeCodes.GetHostPointer ()));
2328  outValues.clear ();
2329  if (!pArray)
2330  return false; // No 'acTimeCodes' array!
2331 
2332  if (numRP188s > NTV2_MAX_NUM_TIMECODE_INDEXES)
2333  numRP188s = NTV2_MAX_NUM_TIMECODE_INDEXES; // clamp to this max number
2334 
2335  for (ULWord ndx (0); ndx < numRP188s; ndx++)
2336  outValues << pArray [ndx];
2337 
2338  return true;
2339 }
2340 
2341 
2342 bool FRAME_STAMP::GetInputTimeCode (NTV2_RP188 & outTimeCode, const NTV2TCIndex inTCIndex) const
2343 {
2345  ULWord numRP188s (acTimeCodes.GetByteCount () / sizeof (NTV2_RP188));
2346  const NTV2_RP188 * pArray (reinterpret_cast <const NTV2_RP188 *> (acTimeCodes.GetHostPointer ()));
2347  outTimeCode.Set (); // invalidate
2348  if (!pArray)
2349  return false; // No 'acTimeCodes' array!
2350  if (numRP188s > NTV2_MAX_NUM_TIMECODE_INDEXES)
2351  numRP188s = NTV2_MAX_NUM_TIMECODE_INDEXES; // clamp to this max number
2352  if (!NTV2_IS_VALID_TIMECODE_INDEX (inTCIndex))
2353  return false;
2354 
2355  outTimeCode = pArray [inTCIndex];
2356  return true;
2357 }
2358 
2359 
2360 bool FRAME_STAMP::GetInputTimeCodes (NTV2TimeCodes & outTimeCodes, const NTV2Channel inSDIInput, const bool inValidOnly) const
2361 {
2363  outTimeCodes.clear();
2364 
2365  if (!NTV2_IS_VALID_CHANNEL(inSDIInput))
2366  return false; // Bad SDI input
2367 
2368  NTV2TimeCodeList allTCs;
2369  if (!GetInputTimeCodes(allTCs))
2370  return false; // GetInputTimeCodes failed
2371 
2372  const NTV2TCIndexes tcIndexes (GetTCIndexesForSDIInput(inSDIInput));
2373  for (NTV2TCIndexesConstIter iter(tcIndexes.begin()); iter != tcIndexes.end(); ++iter)
2374  {
2375  const NTV2TCIndex tcIndex(*iter);
2377  const NTV2_RP188 tc(allTCs.at(tcIndex));
2378  if (!inValidOnly)
2379  outTimeCodes[tcIndex] = tc;
2380  else if (tc.IsValid())
2381  outTimeCodes[tcIndex] = tc;
2382  }
2383  return true;
2384 }
2385 
2386 
2387 bool FRAME_STAMP::GetSDIInputStatus(NTV2SDIInputStatus & outStatus, const UWord inSDIInputIndex0) const
2388 {
2390  (void)outStatus;
2391  (void)inSDIInputIndex0;
2392  return true;
2393 }
2394 
2395 bool FRAME_STAMP::SetInputTimecode (const NTV2TCIndex inTCNdx, const NTV2_RP188 & inTimecode)
2396 {
2397  ULWord numRP188s (acTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2398  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acTimeCodes.GetHostPointer()));
2399  if (!pArray || !numRP188s)
2400  return false; // No 'acTimeCodes' array!
2401 
2402  if (numRP188s > NTV2_MAX_NUM_TIMECODE_INDEXES)
2403  numRP188s = NTV2_MAX_NUM_TIMECODE_INDEXES; // clamp to this max number
2404  if (ULWord(inTCNdx) >= numRP188s)
2405  return false; // Past end
2406 
2407  pArray[inTCNdx] = inTimecode; // Write the new value
2408  return true; // Success!
2409 }
2410 
2411 
2413 {
2414  if (this != &inRHS)
2415  {
2416  acTimeCodes = inRHS.acTimeCodes;
2417  acHeader = inRHS.acHeader;
2418  acFrameTime = inRHS.acFrameTime;
2427  acStartSample = inRHS.acStartSample;
2428  acCurrentTime = inRHS.acCurrentTime;
2436  acCurrentReps = inRHS.acCurrentReps;
2438  acFrame = inRHS.acFrame;
2439  acRP188 = inRHS.acRP188;
2440  acTrailer = inRHS.acTrailer;
2441  }
2442  return *this;
2443 }
2444 
2445 
2446 bool FRAME_STAMP::SetFrom (const FRAME_STAMP_STRUCT & inOldStruct)
2447 {
2449  //acCrosspoint = inOldStruct.channelSpec;
2450  acFrameTime = inOldStruct.frameTime;
2451  acRequestedFrame = inOldStruct.frame;
2458  acTotalBytesTransferred = inOldStruct.bytesRead;
2459  acStartSample = inOldStruct.startSample;
2460  acCurrentTime = inOldStruct.currentTime;
2461  acCurrentFrame = inOldStruct.currentFrame;
2462  acCurrentFrameTime = inOldStruct.currentFrameTime;
2466  acCurrentFieldCount = inOldStruct.currentFieldCount;
2467  acCurrentLineCount = inOldStruct.currentLineCount;
2468  acCurrentReps = inOldStruct.currentReps;
2469  acCurrentUserCookie = inOldStruct.currenthUser;
2470  acRP188 = NTV2_RP188 (inOldStruct.currentRP188);
2471  if (!acTimeCodes.IsNULL() && acTimeCodes.GetByteCount () >= sizeof (NTV2_RP188))
2472  {
2473  NTV2_RP188 * pTimecodes (reinterpret_cast <NTV2_RP188 *> (acTimeCodes.GetHostPointer ()));
2474  NTV2_ASSERT (pTimecodes);
2476  pTimecodes [NTV2_TCINDEX_DEFAULT] = acRP188;
2477  }
2478  return true;
2479 }
2480 
2481 
2482 bool FRAME_STAMP::CopyTo (FRAME_STAMP_STRUCT & outOldStruct) const
2483 {
2485  outOldStruct.frameTime = acFrameTime;
2486  outOldStruct.frame = acRequestedFrame;
2493  outOldStruct.bytesRead = acTotalBytesTransferred;
2494  outOldStruct.startSample = acStartSample;
2495  outOldStruct.currentTime = acCurrentTime;
2496  outOldStruct.currentFrame = acCurrentFrame;
2497  outOldStruct.currentFrameTime = acCurrentFrameTime;
2501  outOldStruct.currentFieldCount = acCurrentFieldCount;
2502  outOldStruct.currentLineCount = acCurrentLineCount;
2503  outOldStruct.currentReps = acCurrentReps;
2504  outOldStruct.currenthUser = ULWord(acCurrentUserCookie);
2505  outOldStruct.currentRP188 = acRP188;
2506  // Ticket 3367 -- Mark Gilbert of Gallery UK reports that after updating from AJA Retail Software 10.5 to 14.0,
2507  // their QuickTime app stopped receiving timecode during capture. Turns out the QuickTime components use the new
2508  // AutoCirculate APIs, but internally still use the old FRAME_STAMP_STRUCT for frame info, including timecode...
2509  // ...and only use the "currentRP188" field for the "retail" timecode.
2510  // Sadly, this FRAME_STAMP-to-FRAME_STAMP_STRUCT function historically only set "currentRP188" from the deprecated
2511  // (and completely unused) "acRP188" field, when it really should've been using the acTimeCodes[NTV2_TCINDEX_DEFAULT]
2512  // value all along...
2513  if (!acTimeCodes.IsNULL()) // If there's an acTimeCodes buffer...
2514  if (acTimeCodes.GetByteCount() >= sizeof(NTV2_RP188)) // ...and it has at least one timecode value...
2515  {
2516  const NTV2_RP188 * pDefaultTC (reinterpret_cast<const NTV2_RP188*>(acTimeCodes.GetHostPointer()));
2517  if (pDefaultTC)
2518  outOldStruct.currentRP188 = pDefaultTC[NTV2_TCINDEX_DEFAULT]; // Stuff the "default" (retail) timecode into "currentRP188".
2519  }
2520  return true;
2521 }
2522 
2523 
2524 string FRAME_STAMP::operator [] (const unsigned inIndexNum) const
2525 {
2526  ostringstream oss;
2527  NTV2_RP188 rp188;
2528  if (GetInputTimeCode (rp188, NTV2TimecodeIndex (inIndexNum)))
2529  {
2530  if (rp188.IsValid())
2531  {
2532  CRP188 foo (rp188);
2533  oss << foo;
2534  }
2535  else
2536  oss << "---";
2537  }
2538  else if (NTV2_IS_VALID_TIMECODE_INDEX (inIndexNum))
2539  oss << "---";
2540  return oss.str();
2541 }
2542 
2543 
2545  : mHeader(NTV2_TYPE_SDISTATS, sizeof(NTV2SDIInStatistics)),
2546  mInStatistics(NTV2_MAX_NUM_CHANNELS * sizeof(NTV2SDIInputStatus))
2547 {
2548  Clear();
2550 }
2551 
2553 {
2555  if (mInStatistics.IsNULL())
2556  return;
2557  NTV2SDIInputStatus * pArray(reinterpret_cast <NTV2SDIInputStatus *> (mInStatistics.GetHostPointer()));
2558  for (int i = 0; i < NTV2_MAX_NUM_CHANNELS; i++)
2559  pArray[i].Clear();
2560 }
2561 
2562 bool NTV2SDIInStatistics::GetSDIInputStatus(NTV2SDIInputStatus & outStatus, const UWord inSDIInputIndex0)
2563 {
2565  const ULWord numElements(mInStatistics.GetByteCount() / sizeof(NTV2SDIInputStatus));
2566  const NTV2SDIInputStatus * pArray(reinterpret_cast <const NTV2SDIInputStatus *> (mInStatistics.GetHostPointer()));
2567  outStatus.Clear();
2568  if (!pArray)
2569  return false;
2570  if (numElements != 8)
2571  return false;
2572  if (inSDIInputIndex0 >= numElements)
2573  return false;
2574  outStatus = pArray[inSDIInputIndex0];
2575  return true;
2576 }
2577 
2579 {
2581  static NTV2SDIInputStatus dummy;
2582  const ULWord numElements(mInStatistics.GetByteCount() / sizeof(NTV2SDIInputStatus));
2583  NTV2SDIInputStatus * pArray(reinterpret_cast<NTV2SDIInputStatus*>(mInStatistics.GetHostPointer()));
2584  if (!pArray)
2585  return dummy;
2586  if (numElements != 8)
2587  return dummy;
2588  if (inSDIInputIndex0 >= numElements)
2589  return dummy;
2590  return pArray[inSDIInputIndex0];
2591 }
2592 
2593 std::ostream & NTV2SDIInStatistics::Print(std::ostream & inOutStream) const
2594 {
2596  inOutStream << mHeader << ", " << mInStatistics << ", " << mTrailer; return inOutStream;
2597 }
2598 
2599 
2602  acState (NTV2_AUTOCIRCULATE_DISABLED),
2603  acTransferFrame (0),
2604  acBufferLevel (0),
2605  acFramesProcessed (0),
2606  acFramesDropped (0),
2607  acFrameStamp (),
2608  acAudioTransferSize (0),
2609  acAudioStartSample (0),
2610  acAncTransferSize (0),
2611  acAncField2TransferSize (0)
2612  //acTrailer ()
2613 {
2615 }
2616 
2617 
2619  : acHeader (NTV2_TYPE_ACSTATUS, sizeof (AUTOCIRCULATE_STATUS)),
2620  acCrosspoint (inCrosspoint),
2621  acState (NTV2_AUTOCIRCULATE_DISABLED),
2622  acStartFrame (0),
2623  acEndFrame (0),
2624  acActiveFrame (0),
2625  acRDTSCStartTime (0),
2626  acAudioClockStartTime (0),
2627  acRDTSCCurrentTime (0),
2628  acAudioClockCurrentTime (0),
2629  acFramesProcessed (0),
2630  acFramesDropped (0),
2631  acBufferLevel (0),
2632  acOptionFlags (0),
2633  acAudioSystem (NTV2_AUDIOSYSTEM_INVALID)
2634 {
2636 }
2637 
2638 
2640 {
2642  outOldStruct.channelSpec = acCrosspoint;
2643  outOldStruct.state = acState;
2644  outOldStruct.startFrame = acStartFrame;
2645  outOldStruct.endFrame = acEndFrame;
2646  outOldStruct.activeFrame = acActiveFrame;
2647  outOldStruct.rdtscStartTime = acRDTSCStartTime;
2649  outOldStruct.rdtscCurrentTime = acRDTSCCurrentTime;
2651  outOldStruct.framesProcessed = acFramesProcessed;
2652  outOldStruct.framesDropped = acFramesDropped;
2653  outOldStruct.bufferLevel = acBufferLevel;
2655  outOldStruct.bWithRP188 = acOptionFlags & AUTOCIRCULATE_WITH_RP188 ? 1 : 0;
2656  outOldStruct.bFbfChange = acOptionFlags & AUTOCIRCULATE_WITH_FBFCHANGE ? 1 : 0;
2657  outOldStruct.bFboChange = acOptionFlags & AUTOCIRCULATE_WITH_FBOCHANGE ? 1 : 0;
2659  outOldStruct.bWithVidProc = acOptionFlags & AUTOCIRCULATE_WITH_VIDPROC ? 1 : 0;
2660  outOldStruct.bWithCustomAncData = acOptionFlags & AUTOCIRCULATE_WITH_ANC ? 1 : 0;
2661  return true;
2662 }
2663 
2664 
2666 {
2668  acCrosspoint = inOldStruct.channelSpec;
2669  acState = inOldStruct.state;
2670  acStartFrame = inOldStruct.startFrame;
2671  acEndFrame = inOldStruct.endFrame;
2672  acActiveFrame = inOldStruct.activeFrame;
2673  acRDTSCStartTime = inOldStruct.rdtscStartTime;
2675  acRDTSCCurrentTime = inOldStruct.rdtscCurrentTime;
2677  acFramesProcessed = inOldStruct.framesProcessed;
2678  acFramesDropped = inOldStruct.framesDropped;
2679  acBufferLevel = inOldStruct.bufferLevel;
2680  acAudioSystem = NTV2_AUDIOSYSTEM_INVALID; // NTV2_AUDIOSYSTEM_1;
2681  acOptionFlags = (inOldStruct.bWithRP188 ? AUTOCIRCULATE_WITH_RP188 : 0) |
2682  (inOldStruct.bFbfChange ? AUTOCIRCULATE_WITH_FBFCHANGE : 0) |
2683  (inOldStruct.bFboChange ? AUTOCIRCULATE_WITH_FBOCHANGE : 0) |
2685  (inOldStruct.bWithVidProc ? AUTOCIRCULATE_WITH_VIDPROC : 0) |
2686  (inOldStruct.bWithCustomAncData ? AUTOCIRCULATE_WITH_ANC : 0);
2687  return true;
2688 }
2689 
2690 
2692 {
2696  acStartFrame = 0;
2697  acEndFrame = 0;
2698  acActiveFrame = 0;
2699  acRDTSCStartTime = 0;
2701  acRDTSCCurrentTime = 0;
2703  acFramesProcessed = 0;
2704  acFramesDropped = 0;
2705  acBufferLevel = 0;
2706  acOptionFlags = 0;
2708 }
2709 
2710 
2712 {
2714 }
2715 
2716 
2717 struct ThousandsSeparator : std::numpunct <char>
2718 {
2719  virtual inline char do_thousands_sep() const {return ',';}
2720  virtual inline std::string do_grouping() const {return "\03";}
2721 };
2722 
2723 
2724 template <class T> string CommaStr (const T & inNum)
2725 {
2726  ostringstream oss;
2727  const locale loc (oss.getloc(), new ThousandsSeparator);
2728  oss.imbue (loc);
2729  oss << inNum;
2730  return oss.str();
2731 } // CommaStr
2732 
2733 
2734 string AUTOCIRCULATE_STATUS::operator [] (const unsigned inIndexNum) const
2735 {
2736  ostringstream oss;
2737  if (inIndexNum == 0)
2739  else if (!IsStopped())
2740  switch (inIndexNum)
2741  {
2742  case 1: oss << DEC(GetStartFrame()); break;
2743  case 2: oss << DEC(GetEndFrame()); break;
2744  case 3: oss << DEC(GetFrameCount()); break;
2745  case 4: oss << DEC(GetActiveFrame()); break;
2746  case 5: oss << xHEX0N(acRDTSCStartTime,16); break;
2747  case 6: oss << xHEX0N(acAudioClockStartTime,16); break;
2748  case 7: oss << DEC(acRDTSCCurrentTime); break;
2749  case 8: oss << DEC(acAudioClockCurrentTime); break;
2750  case 9: oss << CommaStr(GetProcessedFrameCount()); break;
2751  case 10: oss << CommaStr(GetDroppedFrameCount()); break;
2752  case 11: oss << DEC(GetBufferLevel()); break;
2753  case 12: oss << ::NTV2AudioSystemToString(acAudioSystem, true); break;
2754  case 13: oss << (WithRP188() ? "Yes" : "No"); break;
2755  case 14: oss << (WithLTC() ? "Yes" : "No"); break;
2756  case 15: oss << (WithFBFChange() ? "Yes" : "No"); break;
2757  case 16: oss << (WithFBOChange() ? "Yes" : "No"); break;
2758  case 17: oss << (WithColorCorrect() ? "Yes" : "No"); break;
2759  case 18: oss << (WithVidProc() ? "Yes" : "No"); break;
2760  case 19: oss << (WithCustomAnc() ? "Yes" : "No"); break;
2761  case 20: oss << (WithHDMIAuxData() ? "Yes" : "No"); break;
2762  case 21: oss << (IsFieldMode() ? "Yes" : "No"); break;
2763  default: break;
2764  }
2765  else if (inIndexNum < 22)
2766  oss << "---";
2767  return oss.str();
2768 }
2769 
2770 
2771 ostream & operator << (ostream & oss, const AUTOCIRCULATE_STATUS & inObj)
2772 {
2773  if (!inObj.IsStopped())
2774  oss << ::NTV2ChannelToString(inObj.GetChannel(), true) << ": "
2775  << (inObj.IsInput() ? "Input " : (inObj.IsOutput() ? "Output" : "*BAD* "))
2776  << setw(12) << ::NTV2AutoCirculateStateToString(inObj.acState) << " "
2777  << setw( 5) << inObj.GetStartFrame()
2778  << setw( 6) << inObj.GetEndFrame()
2779  << setw( 6) << inObj.GetActiveFrame()
2780  << setw( 8) << inObj.GetProcessedFrameCount()
2781  << setw( 8) << inObj.GetDroppedFrameCount()
2782  << setw( 7) << inObj.GetBufferLevel()
2783  << setw(10) << ::NTV2AudioSystemToString(inObj.acAudioSystem, true)
2784  << setw(10) << (inObj.WithRP188() ? "+RP188" : "-RP188")
2785  << setw(10) << (inObj.WithLTC() ? "+LTC" : "-LTC")
2786  << setw(10) << (inObj.WithFBFChange() ? "+FBFchg" : "-FBFchg")
2787  << setw(10) << (inObj.WithFBOChange() ? "+FBOchg" : "-FBOchg")
2788  << setw(10) << (inObj.WithColorCorrect() ? "+ColCor" : "-ColCor")
2789  << setw(10) << (inObj.WithVidProc() ? "+VidProc" : "-VidProc")
2790  << setw(10) << (inObj.WithCustomAnc() ? "+AncData" : "-AncData")
2791  << setw(10) << (inObj.WithHDMIAuxData() ? "+HDMIAux" : "-HDMIAux")
2792  << setw(10) << (inObj.IsFieldMode() ? "+FldMode" : "-FldMode");
2793  return oss;
2794 }
2795 
2796 
2798 {
2799  Reset ();
2800 }
2801 
2802 
2803 NTV2SegmentedDMAInfo::NTV2SegmentedDMAInfo (const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow, const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
2804 {
2805  Set (inNumSegments, inNumActiveBytesPerRow, inHostBytesPerRow, inDeviceBytesPerRow);
2806 }
2807 
2808 
2809 void NTV2SegmentedDMAInfo::Set (const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow, const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
2810 {
2811  acNumSegments = inNumSegments;
2812  if (acNumSegments > 1)
2813  {
2814  acNumActiveBytesPerRow = inNumActiveBytesPerRow;
2815  acSegmentHostPitch = inHostBytesPerRow;
2816  acSegmentDevicePitch = inDeviceBytesPerRow;
2817  }
2818  else
2819  Reset ();
2820 }
2821 
2822 
2824 {
2826 }
2827 
2828 
2830  : ccMode (NTV2_CCMODE_INVALID),
2831  ccSaturationValue (0)
2832 {
2833 }
2834 
2835 
2837 {
2838  Clear ();
2839 }
2840 
2841 
2843 {
2845  ccSaturationValue = 0;
2847 }
2848 
2849 
2850 bool NTV2ColorCorrectionData::Set (const NTV2ColorCorrectionMode inMode, const ULWord inSaturation, const void * pInTableData)
2851 {
2852  Clear();
2854  return false;
2855 
2856  if (pInTableData)
2858  return false;
2859  ccMode = inMode;
2860  ccSaturationValue = (inMode == NTV2_CCMODE_3WAY) ? inSaturation : 0;
2861  return true;
2862 }
2863 
2864 
2866  : acHeader (NTV2_TYPE_ACXFER, sizeof(AUTOCIRCULATE_TRANSFER)),
2867  acOutputTimeCodes (NTV2_MAX_NUM_TIMECODE_INDEXES * sizeof (NTV2_RP188)),
2868  acTransferStatus (),
2869  acInUserCookie (0),
2870  acInVideoDMAOffset (0),
2871  acInSegmentedDMAInfo (),
2872  acColorCorrection (),
2873  acFrameBufferFormat (NTV2_FBF_10BIT_YCBCR),
2874  acFrameBufferOrientation (NTV2_FRAMEBUFFER_ORIENTATION_TOPDOWN),
2875  acVidProcInfo (),
2876  acVideoQuarterSizeExpand (NTV2_QuarterSizeExpandOff),
2877  acPeerToPeerFlags (0),
2878  acFrameRepeatCount (1),
2879  acDesiredFrame (-1),
2880  acRP188 (),
2881  acCrosspoint (NTV2CROSSPOINT_INVALID)
2882 {
2886 }
2887 
2888 
2889 AUTOCIRCULATE_TRANSFER::AUTOCIRCULATE_TRANSFER (ULWord * pInVideoBuffer, const ULWord inVideoByteCount, ULWord * pInAudioBuffer,
2890  const ULWord inAudioByteCount, ULWord * pInANCBuffer, const ULWord inANCByteCount,
2891  ULWord * pInANCF2Buffer, const ULWord inANCF2ByteCount)
2892  : acHeader (NTV2_TYPE_ACXFER, sizeof(AUTOCIRCULATE_TRANSFER)),
2893  acVideoBuffer (pInVideoBuffer, inVideoByteCount),
2894  acAudioBuffer (pInAudioBuffer, inAudioByteCount),
2895  acANCBuffer (pInANCBuffer, inANCByteCount),
2896  acANCField2Buffer (pInANCF2Buffer, inANCF2ByteCount),
2897  acOutputTimeCodes (NTV2_MAX_NUM_TIMECODE_INDEXES * sizeof (NTV2_RP188)),
2898  acTransferStatus (),
2899  acInUserCookie (0),
2900  acInVideoDMAOffset (0),
2901  acInSegmentedDMAInfo (),
2902  acColorCorrection (),
2903  acFrameBufferFormat (NTV2_FBF_10BIT_YCBCR),
2904  acFrameBufferOrientation (NTV2_FRAMEBUFFER_ORIENTATION_TOPDOWN),
2905  acVidProcInfo (),
2906  acVideoQuarterSizeExpand (NTV2_QuarterSizeExpandOff),
2907  acPeerToPeerFlags (0),
2908  acFrameRepeatCount (1),
2909  acDesiredFrame (-1),
2910  acRP188 (),
2911  acCrosspoint (NTV2CROSSPOINT_INVALID)
2912 {
2916 }
2917 
2918 
2920 {
2921 }
2922 
2923 
2924 bool AUTOCIRCULATE_TRANSFER::SetBuffers (ULWord * pInVideoBuffer, const ULWord inVideoByteCount,
2925  ULWord * pInAudioBuffer, const ULWord inAudioByteCount,
2926  ULWord * pInANCBuffer, const ULWord inANCByteCount,
2927  ULWord * pInANCF2Buffer, const ULWord inANCF2ByteCount)
2928 {
2930  return SetVideoBuffer (pInVideoBuffer, inVideoByteCount)
2931  && SetAudioBuffer (pInAudioBuffer, inAudioByteCount)
2932  && SetAncBuffers (pInANCBuffer, inANCByteCount, pInANCF2Buffer, inANCF2ByteCount);
2933 }
2934 
2935 
2936 bool AUTOCIRCULATE_TRANSFER::SetVideoBuffer (ULWord * pInVideoBuffer, const ULWord inVideoByteCount)
2937 {
2939  acVideoBuffer.Set (pInVideoBuffer, inVideoByteCount);
2940  return true;
2941 }
2942 
2943 
2944 bool AUTOCIRCULATE_TRANSFER::SetAudioBuffer (ULWord * pInAudioBuffer, const ULWord inAudioByteCount)
2945 {
2947  acAudioBuffer.Set (pInAudioBuffer, inAudioByteCount);
2948  return true;
2949 }
2950 
2951 
2952 bool AUTOCIRCULATE_TRANSFER::SetAncBuffers (ULWord * pInANCBuffer, const ULWord inANCByteCount, ULWord * pInANCF2Buffer, const ULWord inANCF2ByteCount)
2953 {
2955  acANCBuffer.Set (pInANCBuffer, inANCByteCount);
2956  acANCField2Buffer.Set (pInANCF2Buffer, inANCF2ByteCount);
2957  return true;
2958 }
2959 
2961 
2962 
2964 {
2966  ULWord maxNumValues (acOutputTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2967  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acOutputTimeCodes.GetHostPointer()));
2968  if (!pArray)
2969  return false;
2970  if (maxNumValues > NTV2_MAX_NUM_TIMECODE_INDEXES)
2971  maxNumValues = NTV2_MAX_NUM_TIMECODE_INDEXES;
2972 
2973  for (UWord ndx (0); ndx < UWord(maxNumValues); ndx++)
2974  {
2975  const NTV2TCIndex tcIndex (static_cast<NTV2TCIndex>(ndx));
2976  NTV2TimeCodesConstIter iter (inValues.find(tcIndex));
2977  pArray[ndx] = (iter != inValues.end()) ? iter->second : INVALID_TIMECODE_VALUE;
2978  } // for each possible NTV2TCSource value
2979  return true;
2980 }
2981 
2982 
2983 bool AUTOCIRCULATE_TRANSFER::SetOutputTimeCode (const NTV2_RP188 & inTimeCode, const NTV2TCIndex inTCIndex)
2984 {
2986  ULWord maxNumValues (acOutputTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
2987  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acOutputTimeCodes.GetHostPointer()));
2988  if (!pArray)
2989  return false;
2990  if (maxNumValues > NTV2_MAX_NUM_TIMECODE_INDEXES)
2991  maxNumValues = NTV2_MAX_NUM_TIMECODE_INDEXES;
2992  if (!NTV2_IS_VALID_TIMECODE_INDEX(inTCIndex))
2993  return false;
2994 
2995  pArray[inTCIndex] = inTimeCode;
2996  return true;
2997 }
2998 
2999 bool AUTOCIRCULATE_TRANSFER::SetAllOutputTimeCodes (const NTV2_RP188 & inTimeCode, const bool inIncludeF2)
3000 {
3002  ULWord maxNumValues (acOutputTimeCodes.GetByteCount() / sizeof(NTV2_RP188));
3003  NTV2_RP188 * pArray (reinterpret_cast<NTV2_RP188*>(acOutputTimeCodes.GetHostPointer()));
3004  if (!pArray)
3005  return false;
3006  if (maxNumValues > NTV2_MAX_NUM_TIMECODE_INDEXES)
3007  maxNumValues = NTV2_MAX_NUM_TIMECODE_INDEXES;
3008 
3009  for (ULWord tcIndex(0); tcIndex < maxNumValues; tcIndex++)
3010  if (NTV2_IS_ATC_VITC2_TIMECODE_INDEX(tcIndex))
3011  pArray[tcIndex] = inIncludeF2 ? inTimeCode : INVALID_TIMECODE_VALUE;
3012  else
3013  pArray[tcIndex] = inTimeCode;
3014  return true;
3015 }
3016 
3017 
3019 {
3021  if (!NTV2_IS_VALID_FRAME_BUFFER_FORMAT (inNewFormat))
3022  return false;
3023  acFrameBufferFormat = inNewFormat;
3024  return true;
3025 }
3026 
3027 
3029 {
3031  SetBuffers (AJA_NULL, 0, AJA_NULL, 0, AJA_NULL, 0, AJA_NULL, 0);
3032 }
3033 
3034 
3035 bool AUTOCIRCULATE_TRANSFER::EnableSegmentedDMAs (const ULWord inNumSegments, const ULWord inNumActiveBytesPerRow,
3036  const ULWord inHostBytesPerRow, const ULWord inDeviceBytesPerRow)
3037 {
3039  // Cannot allow segmented DMAs if video buffer was self-allocated by the SDK, since the video buffer size holds the segment size (in bytes)...
3041  return false; // Disallow
3042  acInSegmentedDMAInfo.Set (inNumSegments, inNumActiveBytesPerRow, inHostBytesPerRow, inDeviceBytesPerRow);
3043  return true;
3044 }
3045 
3046 
3048 {
3051  return true;
3052 }
3053 
3054 
3056 {
3059 }
3060 
3061 
3063 {
3065  return acTransferStatus.acFrameStamp.GetInputTimeCodes (outValues);
3066 }
3067 
3068 
3069 bool AUTOCIRCULATE_TRANSFER::GetInputTimeCode (NTV2_RP188 & outTimeCode, const NTV2TCIndex inTCIndex) const
3070 {
3072  return acTransferStatus.acFrameStamp.GetInputTimeCode (outTimeCode, inTCIndex);
3073 }
3074 
3075 
3076 bool AUTOCIRCULATE_TRANSFER::GetInputTimeCodes (NTV2TimeCodes & outTimeCodes, const NTV2Channel inSDIInput, const bool inValidOnly) const
3077 {
3079  return acTransferStatus.acFrameStamp.GetInputTimeCodes (outTimeCodes, inSDIInput, inValidOnly);
3080 }
3081 
3082 
3084  : mHeader (NTV2_TYPE_AJADEBUGLOGGING, sizeof (NTV2DebugLogging)),
3085  mSharedMemory (inEnable ? AJADebug::GetPrivateDataLoc() : AJA_NULL, inEnable ? AJADebug::GetPrivateDataLen() : 0)
3086 {
3087 }
3088 
3089 
3090 ostream & NTV2DebugLogging::Print (ostream & inOutStream) const
3091 {
3093  inOutStream << mHeader << " shMem=" << mSharedMemory << " " << mTrailer;
3094  return inOutStream;
3095 }
3096 
3097 
3098 
3100  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3101 {
3103  SetFlags(0);
3104  SetMaxLockSize(0);
3105 }
3106 
3107 NTV2BufferLock::NTV2BufferLock (const NTV2Buffer & inBuffer, const ULWord inFlags)
3108  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3109 {
3111  SetBuffer(inBuffer);
3112  SetFlags(inFlags);
3113  SetMaxLockSize(0);
3114 }
3115 
3116 NTV2BufferLock::NTV2BufferLock(const ULWord * pInBuffer, const ULWord inByteCount, const ULWord inFlags)
3117  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3118 {
3120  SetBuffer (NTV2Buffer(pInBuffer, inByteCount));
3121  SetFlags (inFlags);
3122  SetMaxLockSize(0);
3123 }
3124 
3125 NTV2BufferLock::NTV2BufferLock(const ULWord64 inMaxLockSize, const ULWord inFlags)
3126  : mHeader (NTV2_TYPE_AJABUFFERLOCK, sizeof(NTV2BufferLock))
3127 {
3129  SetBuffer (NTV2Buffer());
3130  SetFlags (inFlags);
3131  SetMaxLockSize(inMaxLockSize);
3132 }
3133 
3134 bool NTV2BufferLock::SetBuffer (const NTV2Buffer & inBuffer)
3135 { // Just use address & length (don't deep copy)...
3137  return mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
3138 }
3139 
3140 ostream & NTV2BufferLock::Print (ostream & inOutStream) const
3141 {
3143  inOutStream << mHeader << mBuffer << " flags=" << xHEX0N(mFlags,8) << " " << mTrailer;
3144  return inOutStream;
3145 }
3146 
3147 
3149  : mHeader (NTV2_TYPE_AJABITSTREAM, sizeof(NTV2Bitstream))
3150 {
3152 }
3153 
3154 NTV2Bitstream::NTV2Bitstream (const NTV2Buffer & inBuffer, const ULWord inFlags)
3155  : mHeader (NTV2_TYPE_AJABITSTREAM, sizeof(NTV2Bitstream))
3156 {
3158  SetBuffer(inBuffer);
3159  SetFlags(inFlags);
3160 }
3161 
3162 NTV2Bitstream::NTV2Bitstream(const ULWord * pInBuffer, const ULWord inByteCount, const ULWord inFlags)
3163  : mHeader (NTV2_TYPE_AJABITSTREAM, sizeof(NTV2Bitstream))
3164 {
3166  SetBuffer (NTV2Buffer(pInBuffer, inByteCount));
3167  SetFlags (inFlags);
3168 }
3169 
3170 bool NTV2Bitstream::SetBuffer (const NTV2Buffer & inBuffer)
3171 { // Just use address & length (don't deep copy)...
3173  return mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
3174 }
3175 
3176 ostream & NTV2Bitstream::Print (ostream & inOutStream) const
3177 {
3179  inOutStream << mHeader << mBuffer << " flags=" << xHEX0N(mFlags,8) << " " << mTrailer;
3180  return inOutStream;
3181 }
3182 
3184  : mHeader (NTV2_TYPE_AJASTREAMCHANNEL, sizeof(NTV2StreamChannel))
3185 {
3187 }
3188 
3189 ostream & NTV2StreamChannel::Print (ostream & inOutStream) const
3190 {
3192  inOutStream << mHeader << mChannel << " flags=" << xHEX0N(mFlags,8) << xHEX0N(mStatus, 8) << " " << mTrailer;
3193  return inOutStream;
3194 }
3195 
3197  : mHeader (NTV2_TYPE_AJASTREAMBUFFER, sizeof(NTV2StreamBuffer))
3198 {
3200 }
3201 
3202 ostream & NTV2StreamBuffer::Print (ostream & inOutStream) const
3203 {
3205  inOutStream << mHeader << mChannel << " flags=" << xHEX0N(mFlags,8) << xHEX0N(mStatus, 8) << " " << mTrailer;
3206  return inOutStream;
3207 }
3208 
3210  : mHeader (NTV2_TYPE_AJAMAILBUFFER, sizeof(NTV2MailBuffer))
3211 {
3213 }
3214 
3215 ostream & NTV2MailBuffer::Print (ostream & inOutStream) const
3216 {
3218  inOutStream << mHeader << mChannel << " flags=" << xHEX0N(mFlags,8) << xHEX0N(mStatus, 8) << " " << mTrailer;
3219  return inOutStream;
3220 }
3221 
3223  : mHeader (NTV2_TYPE_GETREGS, sizeof(NTV2GetRegisters)),
3224  mInNumRegisters (ULWord (inRegisterNumbers.size ())),
3225  mOutNumRegisters (0)
3226 {
3228  ResetUsing (inRegisterNumbers);
3229 }
3230 
3231 
3233  : mHeader (NTV2_TYPE_GETREGS, sizeof(NTV2GetRegisters)),
3234  mInNumRegisters (ULWord (inRegReads.size ())),
3235  mOutNumRegisters (0)
3236 {
3238  ResetUsing (inRegReads);
3239 }
3240 
3241 
3242 bool NTV2GetRegisters::ResetUsing (const NTV2RegNumSet & inRegisterNumbers)
3243 {
3245  mInNumRegisters = ULWord(inRegisterNumbers.size());
3246  mOutNumRegisters = 0;
3247  bool result ( mInRegisters.Allocate(mInNumRegisters * sizeof(ULWord))
3248  && mOutGoodRegisters.Allocate(mInNumRegisters * sizeof(ULWord))
3249  && mOutValues.Allocate(mInNumRegisters * sizeof(ULWord)));
3250  if (!result)
3251  return false;
3252  mInRegisters.Fill(ULWord(0)); mOutGoodRegisters.Fill(ULWord(0)); mOutValues.Fill(ULWord(0));
3253 
3254  ULWord * pRegArray(mInRegisters);
3255  if (!pRegArray)
3256  return false;
3257 
3258  ULWord ndx(0);
3259  for (NTV2RegNumSetConstIter iter(inRegisterNumbers.begin()); iter != inRegisterNumbers.end(); ++iter)
3260  pRegArray[ndx++] = *iter;
3261  return (ndx * sizeof(ULWord)) == mInRegisters.GetByteCount();
3262 }
3263 
3265 {
3266  outRegNums.clear();
3267  if (!mInNumRegisters)
3268  return true; // None requested
3269  if (!mInRegisters)
3270  return false; // Empty/NULL reg num buffer
3271  if (mInRegisters.GetByteCount()/4 < mInNumRegisters)
3272  return false; // Sanity check failed: Reg num buffer too small
3273 
3274  const ULWord * pRegNums(mInRegisters);
3275  for (ULWord ndx(0); ndx < mInNumRegisters; ndx++)
3276  if (outRegNums.find(pRegNums[ndx]) == outRegNums.end())
3277  outRegNums.insert(pRegNums[ndx]);
3278  return true;
3279 }
3280 
3281 
3283 {
3285  outGoodRegNums.clear();
3286  if (!mOutGoodRegisters)
3287  return false; // Empty/NULL 'mOutGoodRegisters' array!
3288  if (!mOutNumRegisters)
3289  return false; // The driver says zero successfully read!
3290  if (mOutNumRegisters > mInNumRegisters)
3291  return false; // Sanity check failed: mOutNumRegisters must be less than or equal to mInNumRegisters!
3292 
3293  const ULWord * pRegArray (mOutGoodRegisters);
3294  for (ULWord ndx(0); ndx < mOutNumRegisters; ndx++)
3295  outGoodRegNums.insert(pRegArray[ndx]);
3296  return true;
3297 }
3298 
3300 {
3302  outBadRegNums.clear();
3303  NTV2RegNumSet reqRegNums, goodRegNums;
3304  if (!GetRequestedRegisterNumbers(reqRegNums))
3305  return false;
3306  if (!GetGoodRegisters(goodRegNums))
3307  return false;
3308  if (reqRegNums == goodRegNums)
3309  return true; // Requested reg nums identical to those that were read successfully
3310 
3311  // Subtract goodRegNums from reqRegNums...
3312  std::set_difference (reqRegNums.begin(), reqRegNums.end(),
3313  goodRegNums.begin(), goodRegNums.end(),
3314  std::inserter(outBadRegNums, outBadRegNums.begin()));
3315  return true;
3316 }
3317 
3318 bool NTV2GetRegisters::PatchRegister (const ULWord inRegNum, const ULWord inValue)
3319 {
3320  if (!mOutGoodRegisters)
3321  return false; // Empty/null 'mOutGoodRegisters' array!
3322  if (!mOutNumRegisters)
3323  return false; // Driver says zero successfully read!
3324  if (mOutNumRegisters > mInNumRegisters)
3325  return false; // Sanity check failed: mOutNumRegisters must be less than or equal to mInNumRegisters!
3326  if (!mOutValues)
3327  return false; // Empty/null 'mOutValues' array!
3328  if (mOutGoodRegisters.GetByteCount() != mOutValues.GetByteCount())
3329  return false; // Sanity check failed: These sizes should match
3330  const ULWord * pRegArray (mOutGoodRegisters);
3331  ULWord * pValArray (mOutValues);
3332  for (ULWord ndx(0); ndx < mOutNumRegisters; ndx++)
3333  if (pRegArray[ndx] == inRegNum)
3334  {
3335  pValArray[ndx] = inValue;
3336  return true;
3337  }
3338  return false; // Not found
3339 }
3340 
3341 
3343 {
3345  outValues.clear ();
3346  if (!mOutGoodRegisters)
3347  return false; // Empty/null 'mOutGoodRegisters' array!
3348  if (!mOutNumRegisters)
3349  return false; // Driver says zero successfully read!
3350  if (mOutNumRegisters > mInNumRegisters)
3351  return false; // Sanity check failed: mOutNumRegisters must be less than or equal to mInNumRegisters!
3352  if (!mOutValues)
3353  return false; // Empty/null 'mOutValues' array!
3354  if (mOutGoodRegisters.GetByteCount() != mOutValues.GetByteCount())
3355  return false; // Sanity check failed: These sizes should match
3356 
3357  const ULWord * pRegArray (mOutGoodRegisters);
3358  const ULWord * pValArray (mOutValues);
3359  for (ULWord ndx(0); ndx < mOutNumRegisters; ndx++)
3360  {
3361  outValues [pRegArray[ndx]] = pValArray[ndx];
3362 #if defined(NTV2_PRETEND_DEVICE)
3363  if (pRegArray[ndx] == kRegBoardID && pValArray[ndx] == NTV2_PRETEND_DEVICE_FROM)
3364  outValues [pRegArray[ndx]] = NTV2_PRETEND_DEVICE_TO;
3365 // else if (pRegArray[ndx] == kRegReserved83 || pRegArray[ndx] == kRegLPRJ45IP)
3366 // outValues [pRegArray[ndx]] = 0x0A03FAD9; // Local IPv4 10.3.250.217
3367 #endif // NTV2_PRETEND_DEVICE
3368  }
3369  return true;
3370 }
3371 
3372 
3374 {
3375  NTV2RegisterValueMap regValMap;
3376  if (!GetRegisterValues(regValMap))
3377  return false;
3378 
3379  if (outValues.empty())
3380  {
3381  for (NTV2RegValueMapConstIter it(regValMap.begin()); it != regValMap.end(); ++it)
3382  {
3383  NTV2RegInfo regInfo(/*regNum*/it->first, /*regVal*/it->second);
3384 #if defined(NTV2_PRETEND_DEVICE)
3385  if (regInfo.regNum() == kRegBoardID && regInfo.value() == NTV2_PRETEND_DEVICE_FROM)
3386  regInfo.setValue(NTV2_PRETEND_DEVICE_TO);
3387 // else if (regInfo.regNum() == kRegReserved83 || regInfo.regNum() == kRegLPRJ45IP)
3388 // regInfo.setValue(0x0A03FAD9); // Local IPv4 10.3.250.217
3389 #endif // NTV2_PRETEND_DEVICE
3390  outValues.push_back(regInfo);
3391  }
3392  return true;
3393  }
3394  else
3395  {
3396  uint32_t missingTally(0);
3397  for (NTV2RegisterReadsIter it (outValues.begin()); it != outValues.end(); ++it)
3398  {
3399  NTV2RegValueMapConstIter mapIter(regValMap.find(it->registerNumber));
3400  if (mapIter != regValMap.end())
3401  it->registerValue = mapIter->second;
3402  else
3403  missingTally++; // Missing register
3404 
3405 #if defined(NTV2_PRETEND_DEVICE) // Fake KONAIP25G from C4412G (see also CNTV2XXXXDriverInterface::ReadRegister):
3406  if (it->registerNumber == kRegBoardID && it->registerValue == NTV2_PRETEND_DEVICE_FROM)
3407  it->registerValue = NTV2_PRETEND_DEVICE_TO;
3408 // else if (it->registerNumber == kRegReserved83 || it->registerNumber == kRegLPRJ45IP)
3409 // it->registerValue = 0x0A03FAD9; // Local IPv4 10.3.250.217
3410 #endif // NTV2_PRETEND_DEVICE
3411  }
3412  return !missingTally;
3413  }
3414 }
3415 
3416 
3417 ostream & NTV2GetRegisters::Print (ostream & inOutStream) const
3418 {
3419  inOutStream << mHeader << ", numRegs=" << mInNumRegisters << ", inRegs=" << mInRegisters << ", outNumGoodRegs=" << mOutNumRegisters
3420  << ", outGoodRegs=" << mOutGoodRegisters << ", outValues=" << mOutValues << ", " << mTrailer;
3421  return inOutStream;
3422 }
3423 
3424 
3426  : mHeader (NTV2_TYPE_SETREGS, sizeof(NTV2SetRegisters)),
3427  mInNumRegisters (ULWord(inRegWrites.size())),
3428  mOutNumFailures (0)
3429 {
3430  ResetUsing(inRegWrites);
3431 }
3432 
3433 
3435 {
3437  mInNumRegisters = ULWord(inRegWrites.size());
3438  mOutNumFailures = 0;
3439  const bool result (mInRegInfos.Allocate (mInNumRegisters * sizeof(NTV2RegInfo))
3441  if (!result)
3442  return false;
3443 
3444  ULWord ndx (0);
3445  NTV2RegInfo * pRegInfoArray (mInRegInfos);
3446  UWord * pBadRegIndexes (mOutBadRegIndexes);
3447 
3448  for (NTV2RegisterWritesConstIter it(inRegWrites.begin()); it != inRegWrites.end(); ++it)
3449  {
3450  if (pBadRegIndexes)
3451  pBadRegIndexes[ndx] = 0;
3452  if (pRegInfoArray)
3453  pRegInfoArray[ndx++] = *it;
3454  }
3455  NTV2_ASSERT((ndx * sizeof(NTV2RegInfo)) == mInRegInfos.GetByteCount());
3456  NTV2_ASSERT((ndx * sizeof(UWord)) == mOutBadRegIndexes.GetByteCount());
3457  return result;
3458 }
3459 
3460 
3462 {
3464  outFailedRegWrites.clear();
3465  return true;
3466 }
3467 
3469 {
3470  outRegWrites.clear();
3471  if (!mInNumRegisters)
3472  return false;
3473  if (!mInRegInfos)
3474  return false;
3475 
3476  outRegWrites.reserve(size_t(mInNumRegisters));
3477  const NTV2RegInfo * pRegInfos(mInRegInfos);
3478  for (ULWord ndx(0); ndx < mInNumRegisters; ndx++)
3479  outRegWrites.push_back(pRegInfos[ndx]);
3480  return true;
3481 }
3482 
3483 ostream & NTV2SetRegisters::Print (ostream & oss) const
3484 {
3486  oss << mHeader << ": numRegs=" << mInNumRegisters << " inRegInfos=" << mInRegInfos << " numFailures=" << DEC(mOutNumFailures)
3487  << " outBadRegIndexes=" << mOutBadRegIndexes << ": " << mTrailer;
3488  const UWord * pBadRegIndexes (mOutBadRegIndexes);
3489  const UWord maxNumBadRegIndexes (UWord(mOutBadRegIndexes.GetByteCount() / sizeof(UWord)));
3490  const NTV2RegInfo * pRegInfoArray (mInRegInfos);
3491  const UWord maxNumRegInfos (UWord(mInRegInfos.GetByteCount() / sizeof(NTV2RegInfo)));
3492  if (pBadRegIndexes && maxNumBadRegIndexes && pRegInfoArray && maxNumRegInfos && mOutNumFailures)
3493  {
3494  oss << endl;
3495  for (UWord num(0); num < maxNumBadRegIndexes; num++)
3496  {
3497  const UWord badRegIndex (pBadRegIndexes[num]);
3498  if (badRegIndex < maxNumRegInfos)
3499  {
3500  const NTV2RegInfo & badRegInfo (pRegInfoArray[badRegIndex]);
3501  oss << "Failure " << num << ": " << badRegInfo << endl;
3502  }
3503  }
3504  }
3505  return oss;
3506 }
3507 
3508 
3509 bool NTV2RegInfo::operator < (const NTV2RegInfo & inRHS) const
3510 {
3511  typedef std::pair <ULWord, ULWord> ULWordPair;
3512  typedef std::pair <ULWordPair, ULWordPair> ULWordPairs;
3513  const ULWordPairs rhs (ULWordPair (inRHS.registerNumber, inRHS.registerValue), ULWordPair (inRHS.registerMask, inRHS.registerShift));
3514  const ULWordPairs mine(ULWordPair (registerNumber, registerValue), ULWordPair (registerMask, registerShift));
3515  return mine < rhs;
3516 }
3517 
3518 ostream & NTV2RegInfo::Print (ostream & oss, const bool inAsCode) const
3519 {
3520  if (inAsCode)
3521  return PrintCode(oss);
3523  oss << "[" << regName << "|" << DEC(registerNumber) << ": val=" << xHEX0N(registerValue,8);
3524  if (registerMask != 0xFFFFFFFF)
3525  oss << " msk=" << xHEX0N(registerMask,8);
3526  if (registerShift)
3527  oss << " shf=" << DEC(registerShift);
3528  return oss << "]";
3529 }
3530 
3531 ostream & NTV2RegInfo::PrintCode (ostream & oss, const int inRadix, const NTV2DeviceID inDeviceID, const string & sCard) const
3532 {
3534  const bool readOnly (CNTV2RegisterExpert::IsReadOnly(registerNumber));
3535  const bool badName (regName.find(' ') != string::npos);
3536  if (readOnly)
3537  oss << "//\t";
3538  oss << sCard << ".WriteRegister (";
3539  if (badName)
3540  oss << DEC(registerNumber);
3541  else
3542  oss << regName;
3543  switch (inRadix)
3544  {
3545  case 2: oss << ", " << BIN032(registerValue); break;
3546  case 8: oss << ", " << OCT(registerValue); break;
3547  case 10: oss << ", " << DEC(registerValue); break;
3548  default: oss << ", " << xHEX0N(registerValue,8); break;
3549  }
3550  if (registerMask != 0xFFFFFFFF)
3551  switch (inRadix)
3552  {
3553  case 2: oss << ", " << BIN032(registerMask); break;
3554  case 8: oss << ", " << OCT(registerMask); break;
3555  case 10: oss << ", " << DEC(registerMask); break;
3556  default: oss << ", " << xHEX0N(registerMask,8); break;
3557  }
3558  if (registerShift)
3559  oss << ", " << DEC(registerShift);
3560  oss << "); // ";
3561  if (badName)
3562  oss << regName;
3563  else
3564  oss << "Reg " << DEC(registerNumber);
3565  // Decode the reg value...
3567  if (!info.empty()) // and add to end of comment
3568  oss << " // " << aja::replace(info, "\n", ", ");
3569  return oss;
3570 }
3571 
3572 ostream & NTV2RegInfo::PrintLog (ostream & oss, const NTV2DeviceID inDeviceID) const
3573 {
3574  const string name ((regNum() < VIRTUALREG_START) || (regNum() > kVRegLast) ? "Register" : "VReg");
3575  oss << name << " Name: " << CNTV2RegisterExpert::GetDisplayName(regNum()) << endl
3576  << name << " Number: " << regNum() << endl
3577  << name << " Value: " << value() << " : " << xHEX0N(value(),8);
3578  //<< "Register Classes: " << CNTV2RegisterExpert::GetRegisterClasses(regNum()) << endl
3579  const string sVal(CNTV2RegisterExpert::GetDisplayValue (regNum(), value(), inDeviceID));
3580 // if (!sVal.empty()) // stay compatible with older supportlogs
3581  oss << endl
3582  << sVal << endl;
3583  return oss;
3584 }
3585 
3587 {
3588  ULWord received(0), rcvdRegNum(0), rcvdRegVal(0); // what was received
3589  static const string sNumber (" Number: "), sValue (" Value: "), sHexPrefix(" : 0x");
3590  for (size_t ndx(0); ndx < inLogLines.size(); ndx++)
3591  {
3592  string line (inLogLines.at(ndx));
3593  size_t posNumber (line.find(sNumber));
3594  if (posNumber != string::npos)
3595  { // e.g. "VReg Number: 10394" pos=4, then 4+9=13
3596  if (received & 0x0001)
3597  continue; // uh-oh, already received "Number:"
3598  line.erase(0, posNumber + sNumber.length()); // only decimal number should remain
3599  if (!aja::is_legal_decimal_number (line, line.length()))
3600  continue; // missing decimal register number, keep looking
3601  rcvdRegNum = aja::stoull(line); // Read the reg number
3602  received |= 0x00000001; // received register number
3603  continue;
3604  } // if " Number: " found
3605  size_t posValue(inLogLines.at(ndx).find(sValue));
3606  if (posValue != string::npos)
3607  { // e.g. "VReg Value: 13966 : 0x0000368E"
3608  if (received & 0x0002)
3609  continue; // uh-oh, already received "Value:"
3610  posValue += sValue.length();
3611  line.erase(0, posValue + sValue.length()); // remainder: "13966 : 0x0000368E"
3612  aja::strip(line); aja::lower(line); // strip any remaining whitespace, then force lower case
3613  // Check for non-hex digits...
3614  size_t numHexDigits(0);
3615  for (size_t ndx(0); ndx < line.size(); ndx++)
3616  if (aja::is_hex_digit(line.at(ndx)))
3617  numHexDigits++;
3618  if (numHexDigits != line.length())
3619  continue; // mismatch indicates bad hex digit(s), keep looking
3620  // Read the value...
3621  istringstream iss(line);
3622  iss >> std::hex >> rcvdRegVal;
3623  received |= 0x0002; // received register value
3624  continue;
3625  } // if " Value: " found
3626  } // for each line
3627  if (received == 3)
3628  setRegNum(rcvdRegNum).setValue(rcvdRegVal).setMask(0xFFFFFFFF).setShift(0);
3629  return received == 3; // success if we got both " Number: " and " Value: "
3630 } // ImportFromLog
3631 
3632 
3633 ostream & NTV2PrintULWordVector (const NTV2ULWordVector & inObj, ostream & inOutStream)
3634 {
3635  for (NTV2ULWordVector::const_iterator it(inObj.begin()); it != inObj.end(); ++it)
3636  inOutStream << " " << HEX0N(*it,8);
3637  return inOutStream;
3638 }
3639 
3640 
3641 ostream & NTV2PrintChannelList (const NTV2ChannelList & inObj, const bool inCompact, ostream & inOutStream)
3642 {
3643  inOutStream << (inCompact ? "Ch[" : "[");
3644  for (NTV2ChannelListConstIter it(inObj.begin()); it != inObj.end(); )
3645  {
3646  if (inCompact)
3647  inOutStream << DEC(*it+1);
3648  else
3649  inOutStream << ::NTV2ChannelToString(*it);
3650  if (++it != inObj.end())
3651  inOutStream << (inCompact ? "|" : ",");
3652  }
3653  return inOutStream << "]";
3654 }
3655 
3656 string NTV2ChannelListToStr (const NTV2ChannelList & inObj, const bool inCompact)
3657 { ostringstream oss;
3658  ::NTV2PrintChannelList (inObj, inCompact, oss);
3659  return oss.str();
3660 }
3661 
3662 ostream & NTV2PrintChannelSet (const NTV2ChannelSet & inObj, const bool inCompact, ostream & inOutStream)
3663 {
3664  inOutStream << (inCompact ? "Ch{" : "{");
3665  for (NTV2ChannelSetConstIter it(inObj.begin()); it != inObj.end(); )
3666  {
3667  if (inCompact)
3668  inOutStream << DEC(*it+1);
3669  else
3670  inOutStream << ::NTV2ChannelToString(*it);
3671  if (++it != inObj.end())
3672  inOutStream << (inCompact ? "|" : ",");
3673  }
3674  return inOutStream << "}";
3675 }
3676 
3677 string NTV2ChannelSetToStr (const NTV2ChannelSet & inObj, const bool inCompact)
3678 { ostringstream oss;
3679  ::NTV2PrintChannelSet (inObj, inCompact, oss);
3680  return oss.str();
3681 }
3682 
3683 NTV2ChannelSet NTV2MakeChannelSet (const NTV2Channel inFirstChannel, const UWord inNumChannels)
3684 {
3685  NTV2ChannelSet result;
3686  for (NTV2Channel ch(inFirstChannel); ch < NTV2Channel(inFirstChannel+inNumChannels); ch = NTV2Channel(ch+1))
3687  if (NTV2_IS_VALID_CHANNEL(ch))
3688  result.insert(ch);
3689  return result;
3690 }
3691 
3693 {
3694  NTV2ChannelSet result;
3695  for (NTV2ChannelListConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
3696  result.insert(*it);
3697  return result;
3698 }
3699 
3700 NTV2ChannelList NTV2MakeChannelList (const NTV2Channel inFirstChannel, const UWord inNumChannels)
3701 {
3702  NTV2ChannelList result;
3703  for (NTV2Channel ch(inFirstChannel); ch < NTV2Channel(inFirstChannel+inNumChannels); ch = NTV2Channel(ch+1))
3704  if (NTV2_IS_VALID_CHANNEL(ch))
3705  result.push_back(ch);
3706  return result;
3707 }
3708 
3710 {
3711  NTV2ChannelList result;
3712  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
3713  result.push_back(*it);
3714  return result;
3715 }
3716 
3717 ostream & NTV2PrintAudioSystemSet (const NTV2AudioSystemSet & inObj, const bool inCompact, std::ostream & inOutStream)
3718 {
3719  inOutStream << (inCompact ? "AudSys{" : "{");
3720  for (NTV2AudioSystemSetConstIter it(inObj.begin()); it != inObj.end(); )
3721  {
3722  if (inCompact)
3723  inOutStream << DEC(*it+1);
3724  else
3725  inOutStream << ::NTV2AudioSystemToString(*it);
3726  if (++it != inObj.end())
3727  inOutStream << (inCompact ? "|" : ",");
3728  }
3729  return inOutStream << "}";
3730 }
3731 
3732 string NTV2AudioSystemSetToStr (const NTV2AudioSystemSet & inObj, const bool inCompact)
3733 { ostringstream oss;
3734  ::NTV2PrintAudioSystemSet (inObj, inCompact, oss);
3735  return oss.str();
3736 }
3737 
3738 NTV2AudioSystemSet NTV2MakeAudioSystemSet (const NTV2AudioSystem inFirstAudioSystem, const UWord inCount)
3739 {
3740  NTV2AudioSystemSet result;
3741  for (NTV2AudioSystem audSys(inFirstAudioSystem); audSys < NTV2AudioSystem(inFirstAudioSystem+inCount); audSys = NTV2AudioSystem(audSys+1))
3742  if (NTV2_IS_VALID_AUDIO_SYSTEM(audSys))
3743  result.insert(audSys);
3744  return result;
3745 }
3746 
3748 {
3749  NTV2RegNumSet result;
3750  for (NTV2RegisterReadsConstIter it(inRegInfos.begin()); it != inRegInfos.end(); ++it)
3751  if (result.find(it->registerNumber) == result.end())
3752  result.insert(it->registerNumber);
3753  return result;
3754 }
3755 
3757 {
3758  for (NTV2RegisterReadsConstIter iter(inRegInfos.begin()); iter != inRegInfos.end(); ++iter) // Ugh -- linear search
3759  if (iter->registerNumber == inRegNum)
3760  return iter;
3761  return inRegInfos.end();
3762 }
3763 
3764 
3765 ostream & operator << (std::ostream & inOutStream, const NTV2RegInfo & inObj)
3766 {
3767  return inObj.Print(inOutStream);
3768 }
3769 
3770 
3771 ostream & operator << (ostream & inOutStream, const NTV2RegisterWrites & inObj)
3772 {
3773  inOutStream << inObj.size () << " regs:" << endl;
3774  for (NTV2RegisterWritesConstIter iter (inObj.begin ()); iter != inObj.end (); ++iter)
3775  inOutStream << *iter << endl;
3776  return inOutStream;
3777 }
3778 
3779 
3780 NTV2BankSelGetSetRegs::NTV2BankSelGetSetRegs (const NTV2RegInfo & inBankSelect, const NTV2RegInfo & inOutRegInfo, const bool inDoWrite)
3781  : mHeader (NTV2_TYPE_BANKGETSET, sizeof (NTV2BankSelGetSetRegs)),
3782  mIsWriting (inDoWrite), // Default to reading
3783  mInBankInfos (sizeof(NTV2RegInfo)), // Room for one bank select
3784  mInRegInfos (sizeof(NTV2RegInfo)) // Room for one register read or write
3785 {
3786  NTV2RegInfo * pRegInfo (mInBankInfos);
3787  if (pRegInfo)
3788  *pRegInfo = inBankSelect; // Store bank select regInfo
3789  pRegInfo = mInRegInfos;
3790  if (pRegInfo)
3791  *pRegInfo = inOutRegInfo; // Store regInfo
3793 }
3794 
3795 
3797 {
3799  NTV2RegInfo result;
3800  if (mInRegInfos)
3801  {
3802  const NTV2RegInfo * pRegInfos (mInRegInfos);
3803  const ULWord maxNum (mInRegInfos.GetByteCount() / ULWord(sizeof(NTV2RegInfo)));
3804  if (ULWord(inIndex0) < maxNum)
3805  result = pRegInfos[inIndex0];
3806  }
3807  return result;
3808 }
3809 
3810 
3811 ostream & NTV2BankSelGetSetRegs::Print (ostream & oss) const
3812 {
3814  const NTV2RegInfo * pBankRegInfo (mInBankInfos);
3815  const NTV2RegInfo * pRegInfo (mInRegInfos);
3816  oss << mHeader << (mIsWriting ? " WRIT" : " READ") << " bankReg=";
3817  if (mInBankInfos) oss << *pBankRegInfo; else oss << "-";
3818  oss << " regInfos=";
3819  if (mInRegInfos) oss << *pRegInfo; else oss << "-";
3820  return oss;
3821 }
3822 
3823 
3824 NTV2VirtualData::NTV2VirtualData (const ULWord inTag, const void* inVirtualData, const size_t inVirtualDataSize, const bool inDoWrite)
3825  : mHeader (NTV2_TYPE_VIRTUAL_DATA_RW, sizeof (NTV2VirtualData)),
3826  mTag (inTag), // setup tag
3827  mIsWriting (inDoWrite), // setup write/read
3828  mVirtualData (inVirtualData, inVirtualDataSize) // setup virtual data
3829 {
3831 }
3832 
3833 
3834 ostream & NTV2VirtualData::Print (ostream & inOutStream) const
3835 {
3837  inOutStream << mHeader << ", mTag=" << mTag << ", mIsWriting=" << mIsWriting;
3838  return inOutStream;
3839 }
3840 
3841 NTV2MessageData::NTV2MessageData (const void* inMessage, const size_t inMessageSize, const ULWord inFlags)
3842  : mHeader (NTV2_TYPE_MESSAGE_DATA, sizeof (NTV2MessageData)),
3843  mMessage (inMessage, inMessageSize),
3844  mFlags (inFlags),
3845  mStatus (0)
3846 {
3848 }
3849 
3850 
3851 ostream & NTV2MessageData::Print (ostream & inOutStream) const
3852 {
3854  inOutStream << mHeader;
3855  return inOutStream;
3856 }
3857 
3858 using namespace ntv2nub;
3859 
3860  /*********************************************************************************************************************
3861  RPC ENCODE/DECODE FUNCTIONS
3862  *********************************************************************************************************************/
3863  #define AsU8Ref(_x_) reinterpret_cast<uint8_t&>(_x_)
3864  #define AsU16Ref(_x_) reinterpret_cast<uint16_t&>(_x_)
3865  #define AsU32Ref(_x_) reinterpret_cast<uint32_t&>(_x_)
3866  #define AsU64Ref(_x_) reinterpret_cast<uint64_t&>(_x_)
3867 
3869  {
3870  PUSHU32(fHeaderTag, outBlob); // ULWord fHeaderTag
3871  PUSHU32(fType, outBlob); // ULWord fType
3872  PUSHU32(fHeaderVersion, outBlob); // ULWord fHeaderVersion
3873  PUSHU32(fVersion, outBlob); // ULWord fVersion
3874  PUSHU32(fSizeInBytes, outBlob); // ULWord fSizeInBytes
3875  PUSHU32(fPointerSize, outBlob); // ULWord fPointerSize
3876  PUSHU32(fOperation, outBlob); // ULWord fOperation
3877  PUSHU32(fResultStatus, outBlob); // ULWord fResultStatus
3878  return true;
3879  }
3880 
3881  bool NTV2_HEADER::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
3882  { uint32_t v32(0);
3883  POPU32(fHeaderTag, inBlob, inOutIndex); // ULWord fHeaderTag
3884  POPU32(fType, inBlob, inOutIndex); // ULWord fType
3885  POPU32(fHeaderVersion, inBlob, inOutIndex); // ULWord fHeaderVersion
3886  POPU32(fVersion, inBlob, inOutIndex); // ULWord fVersion
3887  // Do not decode fSizeInBytes, use native size because size can vary based on OS specific struct padding
3888  POPU32(v32, inBlob, inOutIndex); // ULWord fSizeInBytes - dummy read
3889  POPU32(fPointerSize, inBlob, inOutIndex); // ULWord fPointerSize
3890  POPU32(fOperation, inBlob, inOutIndex); // ULWord fOperation
3891  POPU32(fResultStatus, inBlob, inOutIndex); // ULWord fResultStatus
3892  return true;
3893  }
3894 
3896  {
3897  PUSHU32(fTrailerVersion, outBlob); // ULWord fTrailerVersion
3898  PUSHU32(fTrailerTag, outBlob); // ULWord fTrailerTag
3899  return true;
3900  }
3901 
3902  bool NTV2_TRAILER::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
3903  {
3904  POPU32(fTrailerVersion, inBlob, inOutIndex); // ULWord fTrailerVersion
3905  POPU32(fTrailerTag, inBlob, inOutIndex); // ULWord fTrailerTag
3906  return true;
3907  }
3908 
3909 
3910  bool NTV2Buffer::RPCEncode (UByteSequence & outBlob, bool fillBuffer)
3911  {
3912  PUSHU32(fByteCount, outBlob); // ULWord fByteCount
3913  PUSHU32(fFlags, outBlob); // ULWord fFlags
3914  if (!IsNULL() && fillBuffer)
3915  AppendU8s(outBlob); // NOTE: My buffer content should already have been made BigEndian, if necessary
3916  return true;
3917  }
3918 
3919  bool NTV2Buffer::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex, bool fillBuffer)
3920  {
3921  ULWord byteCount(0), flags(0);
3922  POPU32(byteCount, inBlob, inOutIndex); // ULWord fByteCount
3923  POPU32(flags, inBlob, inOutIndex); // ULWord fFlags
3924  if (!Allocate(byteCount, flags & NTV2Buffer_PAGE_ALIGNED))
3925  return false;
3926  if (fillBuffer)
3927  {
3928  if ((inOutIndex + byteCount) > inBlob.size())
3929  return false; // past end of inBlob
3930  ::memcpy(GetHostPointer(), inBlob.data() + inOutIndex, byteCount); // Caller is responsible for byte-swapping if needed
3931  inOutIndex += byteCount;
3932  }
3933  return true;
3934  }
3935 
3936  // Created for DMATransfer, removed Allocate().
3937  bool NTV2Buffer::RPCDecodeNoAllocate (const UByteSequence & inBlob, size_t & inOutIndex)
3938  {
3939  ULWord byteCount(0), flags(0);
3940  POPU32(byteCount, inBlob, inOutIndex); // ULWord fByteCount
3941  POPU32(flags, inBlob, inOutIndex); // ULWord fFlags
3942  if ((inOutIndex + byteCount) > inBlob.size())
3943  return false; // past end of inBlob
3944 
3945  ::memcpy(GetHostPointer(), inBlob.data() + inOutIndex, byteCount); // Caller is responsible for byte-swapping if needed
3946  inOutIndex += byteCount;
3947  return true;
3948  }
3949 
3951  {
3952  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
3953  + mInRegisters.GetByteCount() + mOutGoodRegisters.GetByteCount() + mOutValues.GetByteCount()); // NTV2Buffer fields
3954  if (outBlob.capacity() < totBytes)
3955  outBlob.reserve(totBytes);
3956  if (!NTV2HostIsBigEndian)
3957  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
3958  mInRegisters.ByteSwap32();
3959  }
3960  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
3961  PUSHU32(mInNumRegisters, outBlob); // ULWord mInNumRegisters
3962  ok &= mInRegisters.RPCEncode(outBlob, /*fillbuffer=*/true); // NTV2Buffer mInRegisters
3963  PUSHU32(mOutNumRegisters, outBlob); // ULWord mOutNumRegisters
3964  ok &= mOutGoodRegisters.RPCEncode(outBlob, /*fillbuffer=*/false) // NTV2Buffer mOutGoodRegisters
3965  && mOutValues.RPCEncode(outBlob, /*fillbuffer=*/false) // NTV2Buffer mOutValues
3966  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
3967  if (!NTV2HostIsBigEndian && !ok)
3968  { // FAILED: Un-byteswap NTV2Buffer data...
3969  mInRegisters.ByteSwap32();
3970  }
3971  return ok;
3972  }
3973 
3974  bool NTV2GetRegisters::RPCDecodeServer (const UByteSequence & inBlob, size_t & inOutIndex)
3975  {
3976  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
3977  if (!ok) return false;
3978  POPU32(mInNumRegisters, inBlob, inOutIndex); // ULWord mInNumRegisters
3979  ok &= mInRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/true); // NTV2Buffer mInRegisters
3980  POPU32(mOutNumRegisters, inBlob, inOutIndex); // ULWord mOutNumRegisters
3981  ok &= mOutGoodRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/false); // NTV2Buffer mOutGoodRegisters
3982  ok &= mOutValues.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/false); // NTV2Buffer mOutValues
3983  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
3984  if (!NTV2HostIsBigEndian)
3985  { // Re-byteswap NTV2Buffer data after decoding...
3986  mInRegisters.ByteSwap32();
3987  }
3988  return ok;
3989  }
3990 
3992  {
3993  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
3994  + mInRegisters.GetByteCount() + mOutGoodRegisters.GetByteCount() + mOutValues.GetByteCount()); // NTV2Buffer fields
3995  if (outBlob.capacity() < totBytes)
3996  outBlob.reserve(totBytes);
3997  if (!NTV2HostIsBigEndian)
3998  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
3999  mOutGoodRegisters.ByteSwap32();
4000  mOutValues.ByteSwap32();
4001  }
4002  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4003  PUSHU32(mInNumRegisters, outBlob); // ULWord mInNumRegisters
4004  ok &= mInRegisters.RPCEncode(outBlob, /*fillbuffer=*/false); // NTV2Buffer mInRegisters
4005  PUSHU32(mOutNumRegisters, outBlob); // ULWord mOutNumRegisters
4006  ok &= mOutGoodRegisters.RPCEncode(outBlob, /*fillbuffer=*/true) // NTV2Buffer mOutGoodRegisters
4007  && mOutValues.RPCEncode(outBlob, /*fillbuffer=*/true) // NTV2Buffer mOutValues
4008  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4009  if (!NTV2HostIsBigEndian && !ok)
4010  { // FAILED: Un-byteswap NTV2Buffer data...
4011  mOutGoodRegisters.ByteSwap32();
4012  mOutValues.ByteSwap32();
4013  }
4014  return ok;
4015  }
4016 
4017  bool NTV2GetRegisters::RPCDecodeClient (const UByteSequence & inBlob, size_t & inOutIndex)
4018  {
4019  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
4020  if (!ok) return false;
4021  POPU32(mInNumRegisters, inBlob, inOutIndex); // ULWord mInNumRegisters
4022  ok &= mInRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/false); // NTV2Buffer mInRegisters
4023  POPU32(mOutNumRegisters, inBlob, inOutIndex); // ULWord mOutNumRegisters
4024  ok &= mOutGoodRegisters.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/true); // NTV2Buffer mOutGoodRegisters
4025  ok &= mOutValues.RPCDecode(inBlob, inOutIndex, /*fillbuffer=*/true); // NTV2Buffer mOutValues
4026  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4027  if (!NTV2HostIsBigEndian)
4028  { // Re-byteswap NTV2Buffer data after decoding...
4029  mOutGoodRegisters.ByteSwap32();
4030  mOutValues.ByteSwap32();
4031  }
4032  return ok;
4033  }
4034 
4036  {
4037  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
4038  + mInRegInfos.GetByteCount() + mOutBadRegIndexes.GetByteCount()); // NTV2Buffer fields
4039  if (outBlob.capacity() < totBytes)
4040  outBlob.reserve(totBytes);
4041  if (!NTV2HostIsBigEndian)
4042  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
4043  mInRegInfos.ByteSwap32();
4044  mOutBadRegIndexes.ByteSwap32();
4045  }
4046  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4047  PUSHU32(mInNumRegisters, outBlob); // ULWord mInNumRegisters
4048  ok &= mInRegInfos.RPCEncode(outBlob); // NTV2Buffer mInRegInfos
4049  PUSHU32(mOutNumFailures, outBlob); // ULWord mOutNumFailures
4050  ok &= mOutBadRegIndexes.RPCEncode(outBlob) // NTV2Buffer mOutBadRegIndexes
4051  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4052  if (!NTV2HostIsBigEndian && !ok)
4053  { // FAILED: Un-byteswap NTV2Buffer data...
4054  mInRegInfos.ByteSwap32();
4055  mOutBadRegIndexes.ByteSwap16();
4056  }
4057  return ok;
4058  }
4059 
4060  bool NTV2SetRegisters::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4061  {
4062  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
4063  POPU32(mInNumRegisters, inBlob, inOutIndex); // ULWord mInNumRegisters
4064  ok &= mInRegInfos.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mInRegInfos
4065  POPU32(mOutNumFailures, inBlob, inOutIndex); // ULWord mOutNumFailures
4066  ok &= mOutBadRegIndexes.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mOutBadRegIndexes
4067  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4068  if (!NTV2HostIsBigEndian)
4069  { // Re-byteswap NTV2Buffer data after decoding...
4070  mInRegInfos.ByteSwap32();
4071  mOutBadRegIndexes.ByteSwap16();
4072  }
4073  return ok;
4074  }
4075 
4077  {
4078  const size_t totBytes (mHeader.GetSizeInBytes() // Header + natural size of all structs/fields inbetween + Trailer
4079  + mInBankInfos.GetByteCount() + mInRegInfos.GetByteCount()); // NTV2Buffer fields
4080  if (outBlob.capacity() < totBytes)
4081  outBlob.reserve(totBytes);
4082  if (!NTV2HostIsBigEndian)
4083  { // All of my NTV2Buffers store arrays of ULWords that must be BigEndian BEFORE encoding into outBlob...
4084  mInBankInfos.ByteSwap32();
4085  mInRegInfos.ByteSwap32();
4086  }
4087  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4088  PUSHU32(mIsWriting, outBlob); // ULWord mIsWriting
4089  ok &= mInBankInfos.RPCEncode(outBlob); // NTV2Buffer mInBankInfos
4090  ok &= mInRegInfos.RPCEncode(outBlob) // NTV2Buffer mInRegInfos
4091  && mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4092  if (!NTV2HostIsBigEndian && !ok)
4093  { // FAILED: Un-byteswap NTV2Buffer data...
4094  mInBankInfos.ByteSwap32();
4095  mInRegInfos.ByteSwap32();
4096  }
4097  return ok;
4098  }
4099 
4100  bool NTV2BankSelGetSetRegs::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4101  {
4102  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER mHeader
4103  POPU32(mIsWriting, inBlob, inOutIndex); // ULWord mIsWriting
4104  ok &= mInBankInfos.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mInBankInfos
4105  ok &= mInRegInfos.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mInRegInfos
4106  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4107  if (!NTV2HostIsBigEndian)
4108  { // Re-byteswap NTV2Buffer data after decoding...
4109  mInBankInfos.ByteSwap32();
4110  mInRegInfos.ByteSwap32();
4111  }
4112  return ok;
4113  }
4114 
4116  {
4117  const size_t totBytes (acHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4118  if (outBlob.capacity() < totBytes)
4119  outBlob.reserve(totBytes);
4120  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4121  PUSHU16(UWord(acCrosspoint), outBlob); // NTV2Crosspoint acCrosspoint
4122  PUSHU16(UWord(acState), outBlob); // NTV2AutoCirculateState acState
4123  PUSHU32(ULWord(acStartFrame), outBlob); // LWord acStartFrame
4124  PUSHU32(ULWord(acEndFrame), outBlob); // LWord acEndFrame
4125  PUSHU32(ULWord(acActiveFrame), outBlob); // LWord acActiveFrame
4126  PUSHU64(acRDTSCStartTime, outBlob); // ULWord64 acRDTSCStartTime
4127  PUSHU64(acAudioClockStartTime, outBlob); // ULWord64 acAudioClockStartTime
4128  PUSHU64(acRDTSCCurrentTime, outBlob); // ULWord64 acRDTSCCurrentTime
4129  PUSHU64(acAudioClockCurrentTime, outBlob); // ULWord64 acAudioClockCurrentTime
4130  PUSHU32(acFramesProcessed, outBlob); // ULWord acFramesProcessed
4131  PUSHU32(acFramesDropped, outBlob); // ULWord acFramesDeopped
4132  PUSHU32(acBufferLevel, outBlob); // ULWord acBufferLevel
4133  PUSHU32(acOptionFlags, outBlob); // ULWord acOptionFlags
4134  PUSHU16(UWord(acAudioSystem), outBlob); // NTV2AudioSystem acAudioSystem
4135  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4136  return ok;
4137  }
4138 
4139  bool AUTOCIRCULATE_STATUS::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4140  { uint16_t v16(0); uint32_t v32(0);
4141  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4142  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint acCrosspoint
4143  acCrosspoint = NTV2Crosspoint(v16);
4144  POPU16(v16, inBlob, inOutIndex); // NTV2AutoCirculateState acState
4145  acState = NTV2AutoCirculateState(v16);
4146  POPU32(v32, inBlob, inOutIndex); // LWord acStartFrame
4147  acStartFrame = LWord(v32);
4148  POPU32(v32, inBlob, inOutIndex); // LWord acEndFrame
4149  acEndFrame = LWord(v32);
4150  POPU32(v32, inBlob, inOutIndex); // LWord acActiveFrame
4151  acActiveFrame = LWord(v32);
4152  POPU64(acRDTSCStartTime, inBlob, inOutIndex); // ULWord64 acRDTSCStartTime
4153  POPU64(acAudioClockStartTime, inBlob, inOutIndex); // ULWord64 acAudioClockStartTime
4154  POPU64(acRDTSCCurrentTime, inBlob, inOutIndex); // ULWord64 acRDTSCCurrentTime
4155  POPU64(acAudioClockCurrentTime, inBlob, inOutIndex); // ULWord64 acAudioClockCurrentTime
4156  POPU32(acFramesProcessed, inBlob, inOutIndex); // ULWord acFramesProcessed
4157  POPU32(acFramesDropped, inBlob, inOutIndex); // ULWord acFramesDropped
4158  POPU32(acBufferLevel, inBlob, inOutIndex); // ULWord acBufferLevel
4159  POPU32(acOptionFlags, inBlob, inOutIndex); // ULWord acOptionFlags
4160  POPU16(v16, inBlob, inOutIndex); // NTV2AudioSystem acAudioSystem
4161  acAudioSystem = NTV2AudioSystem(v16);
4162  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4163  return ok;
4164  }
4165 
4167  {
4168  const size_t totBytes (acHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4169  if (outBlob.capacity() < totBytes)
4170  outBlob.reserve(totBytes);
4171  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4172  PUSHU64(ULWord64(acFrameTime), outBlob); // LWord64 acFrameTime
4173  PUSHU32(acRequestedFrame, outBlob); // ULWord acRequestedFrame
4174  PUSHU64(acAudioClockTimeStamp, outBlob); // ULWord64 acAudioClockTimeStamp
4175  PUSHU32(acAudioExpectedAddress, outBlob); // ULWord acAudioExpectedAddress
4176  PUSHU32(acAudioInStartAddress, outBlob); // ULWord acAudioInStartAddress
4177  PUSHU32(acAudioInStopAddress, outBlob); // ULWord acAudioInStopAddress
4178  PUSHU32(acAudioOutStopAddress, outBlob); // ULWord acAudioOutStopAddress
4179  PUSHU32(acAudioOutStartAddress, outBlob); // ULWord acAudioOutStartAddress
4180  PUSHU32(acTotalBytesTransferred, outBlob); // ULWord acTotalBytesTransferred
4181  PUSHU32(acStartSample, outBlob); // ULWord acStartSample
4182 
4183  ok &= acTimeCodes.RPCEncode(outBlob); // NTV2Buffer acTimeCodes
4184  PUSHU64(ULWord64(acCurrentTime), outBlob); // LWord64 acCurrentTime
4185  PUSHU32(acCurrentFrame, outBlob); // ULWord acCurrentFrame
4186  PUSHU64(ULWord64(acCurrentFrameTime), outBlob); // LWord64 acCurrentFrameTime
4187  PUSHU64(acAudioClockCurrentTime, outBlob); // ULWord64 acAudioClockCurrentTime
4188  PUSHU32(acCurrentAudioExpectedAddress, outBlob); // ULWord acCurrentAudioExpectedAddress
4189  PUSHU32(acCurrentAudioStartAddress, outBlob); // ULWord acCurrentAudioStartAddress
4190  PUSHU32(acCurrentFieldCount, outBlob); // ULWord acCurrentFieldCount
4191  PUSHU32(acCurrentLineCount, outBlob); // ULWord acCurrentLineCount
4192  PUSHU32(acCurrentReps, outBlob); // ULWord acCurrentReps
4193  PUSHU64(acCurrentUserCookie, outBlob); // ULWord64 acCurrentUserCookie
4194  PUSHU32(acFrame, outBlob); // ULWord acFrame
4195  PUSHU32(acRP188.fDBB, outBlob); // ULWord acRP188.fDBB
4196  PUSHU32(acRP188.fLo, outBlob); // ULWord acRP188.fLo
4197  PUSHU32(acRP188.fHi, outBlob); // ULWord acRP188.fHi
4198  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4199  return ok;
4200  }
4201 
4202  bool FRAME_STAMP::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4203  { uint64_t v64(0);
4204  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4205  POPU64(v64, inBlob, inOutIndex); // LWord64 acFrameTime
4206  acFrameTime = LWord64(v64);
4207  POPU32(acRequestedFrame, inBlob, inOutIndex); // ULWord acRequestedFrame
4208  POPU64(acAudioClockTimeStamp, inBlob, inOutIndex); // ULWord64 acAudioClockTimeStamp
4209  POPU32(acAudioExpectedAddress, inBlob, inOutIndex); // ULWord acAudioExpectedAddress
4210  POPU32(acAudioInStartAddress, inBlob, inOutIndex); // ULWord acAudioInStartAddress
4211  POPU32(acAudioInStopAddress, inBlob, inOutIndex); // ULWord acAudioInStopAddress
4212  POPU32(acAudioOutStopAddress, inBlob, inOutIndex); // ULWord acAudioOutStopAddress
4213  POPU32(acAudioOutStartAddress, inBlob, inOutIndex); // ULWord acAudioOutStartAddress
4214  POPU32(acTotalBytesTransferred, inBlob, inOutIndex); // ULWord acTotalBytesTransferred
4215  POPU32(acStartSample, inBlob, inOutIndex); // ULWord acStartSample
4216 
4217  ok &= acTimeCodes.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acTimeCodes
4218  POPU64(v64, inBlob, inOutIndex); // LWord64 acCurrentTime
4219  acCurrentTime = LWord64(v64);
4220  POPU32(acCurrentFrame, inBlob, inOutIndex); // ULWord acCurrentFrame
4221  POPU64(v64, inBlob, inOutIndex); // LWord64 acCurrentFrameTime
4222  acCurrentFrameTime = LWord64(v64);
4223  POPU64(acAudioClockCurrentTime, inBlob, inOutIndex); // ULWord64 acAudioClockCurrentTime
4224  POPU32(acCurrentAudioExpectedAddress, inBlob, inOutIndex); // ULWord acCurrentAudioExpectedAddress
4225  POPU32(acCurrentAudioStartAddress, inBlob, inOutIndex); // ULWord acCurrentAudioStartAddress
4226  POPU32(acCurrentFieldCount, inBlob, inOutIndex); // ULWord acCurrentFieldCount
4227  POPU32(acCurrentLineCount, inBlob, inOutIndex); // ULWord acCurrentLineCount
4228  POPU32(acCurrentReps, inBlob, inOutIndex); // ULWord acCurrentReps
4229  POPU64(acCurrentUserCookie, inBlob, inOutIndex); // ULWord64 acCurrentUserCookie
4230  POPU32(acFrame, inBlob, inOutIndex); // ULWord acFrame
4231  POPU32(acRP188.fDBB, inBlob, inOutIndex); // ULWord acRP188.fDBB
4232  POPU32(acRP188.fLo, inBlob, inOutIndex); // ULWord acRP188.fLo
4233  POPU32(acRP188.fHi, inBlob, inOutIndex); // ULWord acRP188.fHi
4234  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4235  return ok;
4236  }
4237 
4239  {
4240  const size_t totBytes (acHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4241  if (outBlob.capacity() < totBytes)
4242  outBlob.reserve(totBytes);
4243  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4244  PUSHU16(acState, outBlob); // UWord acState
4245  PUSHU32(ULWord(acTransferFrame), outBlob); // LWord acTransferFrame
4246  PUSHU32(acBufferLevel, outBlob); // ULWord acBufferLevel
4247  PUSHU32(acFramesProcessed, outBlob); // ULWord acFramesProcessed
4248  PUSHU32(acFramesDropped, outBlob); // ULWord acFramesDropped
4249  ok &= acFrameStamp.RPCEncode(outBlob); // FRAME_STAMP acFrameStamp
4250  PUSHU32(acAudioTransferSize, outBlob); // ULWord acAudioTransferSize
4251  PUSHU32(acAudioStartSample, outBlob); // ULWord acAudioStartSample
4252  PUSHU32(acAncTransferSize, outBlob); // ULWord acAncTransferSize
4253  PUSHU32(acAncField2TransferSize, outBlob); // ULWord acAncField2TransferSize
4254  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4255  return ok;
4256  }
4257 
4258  bool AUTOCIRCULATE_TRANSFER_STATUS::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4259  { uint16_t v16(0); uint32_t v32(0);
4260  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4261  POPU16(v16, inBlob, inOutIndex); // NTV2AutoCirculateState acState
4262  acState = NTV2AutoCirculateState(v16);
4263  POPU32(v32, inBlob, inOutIndex); // LWord acTransferFrame
4264  acTransferFrame = LWord(v32);
4265  POPU32(acBufferLevel, inBlob, inOutIndex); // ULWord acBufferLevel
4266  POPU32(acFramesProcessed, inBlob, inOutIndex); // ULWord acFramesProcessed
4267  POPU32(acFramesDropped, inBlob, inOutIndex); // ULWord acFramesDropped
4268  ok &= acFrameStamp.RPCDecode(inBlob, inOutIndex); // FRAME_STAMP acFrameStamp
4269  POPU32(acAudioTransferSize, inBlob, inOutIndex); // ULWord acAudioTransferSize
4270  POPU32(acAudioStartSample, inBlob, inOutIndex); // ULWord acAudioStartSample
4271  POPU32(acAncTransferSize, inBlob, inOutIndex); // ULWord acAncTransferSize
4272  POPU32(acAncField2TransferSize, inBlob, inOutIndex); // ULWord acAncField2TransferSize
4273  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4274  return ok;
4275  }
4276 
4278  {
4279  PUSHU32(acNumSegments, outBlob); // ULWord acNumSegments
4280  PUSHU32(acNumActiveBytesPerRow, outBlob); // ULWord acNumActiveBytesPerRow
4281  PUSHU32(acSegmentHostPitch, outBlob); // ULWord acSegmentHostPitch
4282  PUSHU32(acSegmentDevicePitch, outBlob); // ULWord acSegmentDevicePitch
4283  return true;
4284  }
4285 
4286  bool NTV2SegmentedDMAInfo::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4287  {
4288  POPU32(acNumSegments, inBlob, inOutIndex); // ULWord acNumSegments
4289  POPU32(acNumActiveBytesPerRow, inBlob, inOutIndex); // ULWord acNumActiveBytesPerRow
4290  POPU32(acSegmentHostPitch, inBlob, inOutIndex); // ULWord acSegmentHostPitch
4291  POPU32(acSegmentDevicePitch, inBlob, inOutIndex); // ULWord acSegmentDevicePitch
4292  return true;
4293  }
4294 
4296  {
4297  PUSHU16(ccMode, outBlob); // NTV2ColorCorrectionMode ccMode
4298  PUSHU32(ccSaturationValue, outBlob); // ULWord ccSaturationValue
4299  return ccLookupTables.RPCEncode(outBlob); // NTV2Buffer ccLookupTables
4300  }
4301 
4302  bool NTV2ColorCorrectionData::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4303  { uint16_t u16(0);
4304  POPU16(u16, inBlob, inOutIndex); // NTV2ColorCorrectionMode ccMode
4305  ccMode = NTV2ColorCorrectionMode(u16);
4306  POPU32(ccSaturationValue, inBlob, inOutIndex); // ULWord ccSaturationValue
4307  return ccLookupTables.RPCDecode(inBlob, inOutIndex); // NTV2Buffer ccLookupTables
4308  }
4309 
4311  {
4312  PUSHU16(mode, outBlob); // AutoCircVidProcMode mode
4313  PUSHU16(foregroundVideoCrosspoint, outBlob); // NTV2Crosspoint foregroundVideoCrosspoint
4314  PUSHU16(backgroundVideoCrosspoint, outBlob); // NTV2Crosspoint backgroundVideoCrosspoint
4315  PUSHU16(foregroundKeyCrosspoint, outBlob); // NTV2Crosspoint foregroundKeyCrosspoint
4316  PUSHU16(backgroundKeyCrosspoint, outBlob); // NTV2Crosspoint backgroundKeyCrosspoint
4317  PUSHU32(ULWord(transitionCoefficient), outBlob); // Fixed_ transitionCoefficient
4318  PUSHU32(ULWord(transitionSoftness), outBlob); // Fixed_ transitionSoftness
4319  return true;
4320  }
4321 
4322  bool AutoCircVidProcInfo::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4323  { uint16_t v16(0); uint32_t v32(0);
4324  POPU16(v16, inBlob, inOutIndex); // AutoCircVidProcMode mode
4325  mode = AutoCircVidProcMode(v16);
4326  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint foregroundVideoCrosspoint
4327  foregroundVideoCrosspoint = NTV2Crosspoint(v16);
4328  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint backgroundVideoCrosspoint
4329  backgroundVideoCrosspoint = NTV2Crosspoint(v16);
4330  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint foregroundKeyCrosspoint
4331  foregroundKeyCrosspoint = NTV2Crosspoint(v16);
4332  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint backgroundKeyCrosspoint
4333  backgroundKeyCrosspoint = NTV2Crosspoint(v16);
4334  POPU32(v32, inBlob, inOutIndex); // Fixed_ transitionCoefficient
4335  transitionCoefficient = Fixed_(v32);
4336  POPU32(v32, inBlob, inOutIndex); // Fixed_ transitionSoftness
4337  transitionSoftness = Fixed_(v32);
4338  return true;
4339  }
4340 
4342  {
4343  PUSHU32(fDBB, outBlob); // ULWord fDBB
4344  PUSHU32(fLo, outBlob); // ULWord fLo
4345  PUSHU32(fHi, outBlob); // ULWord fHi
4346  return true;
4347  }
4348 
4349  bool NTV2_RP188::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4350  {
4351  POPU32(fDBB, inBlob, inOutIndex); // ULWord fDBB
4352  POPU32(fLo, inBlob, inOutIndex); // ULWord fLo
4353  POPU32(fHi, inBlob, inOutIndex); // ULWord fHi
4354  return true;
4355  }
4356 
4358  {
4360  const size_t totBytes (acHeader.GetSizeInBytes() + acVideoBuffer.GetByteCount() + acAudioBuffer.GetByteCount()
4361  + acANCBuffer.GetByteCount() + acANCField2Buffer.GetByteCount() + acOutputTimeCodes.GetByteCount()
4362  + acHDMIAuxData.GetByteCount() + 64); // Header + natural size of all structs/fields inbetween + Trailer
4363  if (outBlob.capacity() < totBytes)
4364  outBlob.reserve(totBytes);
4365  bool ok = acHeader.RPCEncode(outBlob); // NTV2_HEADER acHeader
4366  ok &= acVideoBuffer.RPCEncode(outBlob); // NTV2Buffer acVideoBuffer
4367  ok &= acAudioBuffer.RPCEncode(outBlob); // NTV2Buffer acAudioBuffer
4368  ok &= acANCBuffer.RPCEncode(outBlob); // NTV2Buffer acANCBuffer
4369  ok &= acANCField2Buffer.RPCEncode(outBlob); // NTV2Buffer acANCField2Buffer
4370  ok &= acOutputTimeCodes.RPCEncode(outBlob); // NTV2Buffer acOutputTimeCodes
4371  ok &= acTransferStatus.RPCEncode(outBlob); // AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
4372  PUSHU64(acInUserCookie, outBlob); // ULWord64 acInUserCookie
4373  PUSHU32(acInVideoDMAOffset, outBlob); // ULWord acInVideoDMAOffset
4374  ok &= acInSegmentedDMAInfo.RPCEncode(outBlob); // NTV2SegmentedDMAInfo acInSegmentedDMAInfo
4375  ok &= acColorCorrection.RPCEncode(outBlob); // NTV2ColorCorrectionData acColorCorrection
4376  PUSHU16(acFrameBufferFormat, outBlob); // NTV2PixelFormat acFrameBufferFormat
4377  PUSHU16(acFrameBufferOrientation, outBlob); // NTV2FBOrientation acFrameBufferOrientation
4378  ok &= acVidProcInfo.RPCEncode(outBlob); // AutoCircVidProcInfo acVidProcInfo
4379  PUSHU16(acVideoQuarterSizeExpand, outBlob); // NTV2QtrSizeExpandMode acVideoQuarterSizeExpand
4380  ok &= acHDMIAuxData.RPCEncode(outBlob); // NTV2Buffer acHDMIAuxData
4381  PUSHU32(acPeerToPeerFlags, outBlob); // ULWord acPeerToPeerFlags
4382  PUSHU32(acFrameRepeatCount, outBlob); // ULWord acFrameRepeatCount
4383  PUSHU32(ULWord(acDesiredFrame), outBlob); // LWord acDesiredFrame
4384  ok &= acRP188.RPCEncode(outBlob); // NTV2_RP188 acRP188
4385  PUSHU16(acCrosspoint, outBlob); // NTV2Crosspoint acCrosspoint
4386  ok &= acTrailer.RPCEncode(outBlob); // NTV2_TRAILER acTrailer
4388  return ok;
4389  }
4390 
4391  bool AUTOCIRCULATE_TRANSFER::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4392  { uint16_t v16(0); uint32_t v32(0);
4394  bool ok = acHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4395  ok &= acVideoBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acVideoBuffer
4396  ok &= acAudioBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acAudioBuffer
4397  ok &= acANCBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acANCBuffer
4398  ok &= acANCField2Buffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acANCField2Buffer
4399  ok &= acOutputTimeCodes.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acOutputTimeCodes
4400  ok &= acTransferStatus.RPCDecode(inBlob, inOutIndex); // AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
4401  POPU64(acInUserCookie, inBlob, inOutIndex); // ULWord64 acInUserCookie
4402  POPU32(acInVideoDMAOffset, inBlob, inOutIndex); // ULWord acInVideoDMAOffset
4403  ok &= acInSegmentedDMAInfo.RPCDecode(inBlob, inOutIndex);// NTV2Buffer acInSegmentedDMAInfo
4404  ok &= acColorCorrection.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acColorCorrection
4405  POPU16(v16, inBlob, inOutIndex); // NTV2PixelFormat acFrameBufferFormat
4406  acFrameBufferFormat = NTV2FrameBufferFormat(v16);
4407  POPU16(v16, inBlob, inOutIndex); // NTV2FBOrientation acFrameBufferOrientation
4408  acFrameBufferOrientation = NTV2FBOrientation(v16);
4409  ok &= acVidProcInfo.RPCDecode(inBlob, inOutIndex); // AutoCircVidProcInfo acVidProcInfo
4410  POPU16(v16, inBlob, inOutIndex); // NTV2QtrSizeExpandMode acVideoQuarterSizeExpand
4411  acVideoQuarterSizeExpand = NTV2QtrSizeExpandMode(v16);
4412  ok &= acHDMIAuxData.RPCDecode(inBlob, inOutIndex); // NTV2Buffer acHDMIAuxData
4413  POPU32(acPeerToPeerFlags, inBlob, inOutIndex); // ULWord acPeerToPeerFlags
4414  POPU32(acFrameRepeatCount, inBlob, inOutIndex); // ULWord acFrameRepeatCount
4415  POPU32(v32, inBlob, inOutIndex); // LWord acDesiredFrame
4416  acDesiredFrame = LWord(v32);
4417  ok &= acRP188.RPCDecode(inBlob, inOutIndex); // NTV2_RP188 acRP188
4418  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint acCrosspoint
4419  acCrosspoint = NTV2Crosspoint(v16);
4420  ok &= acTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER acTrailer
4422  return ok;
4423  }
4424 
4426  {
4427  NTV2Buffer buff;
4428  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4429 // PUSHU64(ULWord64(videoBuffer), outBlob) // ULWord * videoBuffer
4430  PUSHU32(videoBufferSize, outBlob); // ULWord videoBufferSize
4431  if (videoBuffer && videoBufferSize)
4432  { buff.Set(videoBuffer, videoBufferSize);
4433  buff.AppendU8s(outBlob);
4434  }
4435  PUSHU32(videoDmaOffset, outBlob); // ULWord videoDmaOffset
4436 // PUSHU64(ULWord64(audioBuffer), outBlob) // ULWord * audioBuffer
4437  PUSHU32(audioBufferSize, outBlob); // ULWord audioBufferSize
4438  if (audioBuffer && audioBufferSize)
4439  { buff.Set(audioBuffer, audioBufferSize);
4440  buff.AppendU8s(outBlob);
4441  }
4442  PUSHU32(audioStartSample, outBlob); // ULWord audioStartSample
4443  PUSHU32(audioNumChannels, outBlob); // ULWord audioNumChannels
4444  PUSHU32(frameRepeatCount, outBlob); // ULWord frameRepeatCount
4445  rp188.RPCEncode(outBlob); // RP188_STRUCT rp188
4446  PUSHU32(ULWord(desiredFrame), outBlob); // LWord desiredFrame
4447  PUSHU32(hUser, outBlob); // ULWord hUser
4448  PUSHU32(transferFlags, outBlob); // ULWord transferFlags
4449  PUSHU8(bDisableExtraAudioInfo, outBlob); // BOOL_ bDisableExtraAudioInfo
4450  PUSHU16(UWord(frameBufferFormat), outBlob); // NTV2PixelFormat frameBufferFormat
4451  PUSHU16(UWord(frameBufferOrientation), outBlob); // NTV2FBOrientation frameBufferOrientation
4452  // Skip color correction for now // NTV2ColorCorrectionInfo colorCorrectionInfo
4453  vidProcInfo.RPCEncode(outBlob); // AutoCircVidProcInfo vidProcInfo
4454  PUSHU32(customAncInfo.Group1, outBlob); // CUSTOM_ANC_STRUCT customAncInfo
4455  PUSHU32(customAncInfo.Group2, outBlob);
4456  PUSHU32(customAncInfo.Group3, outBlob);
4457  PUSHU32(customAncInfo.Group4, outBlob);
4458  PUSHU32(videoNumSegments, outBlob); // ULWord videoNumSegments
4459  PUSHU32(videoSegmentHostPitch, outBlob); // ULWord videoSegmentHostPitch
4460  PUSHU32(videoSegmentCardPitch, outBlob); // ULWord videoSegmentCardPitch
4461  PUSHU16(UWord(videoQuarterSizeExpand), outBlob); // NTV2QtrSizeExpandMode videoQuarterSizeExpand
4462  return true;
4463  }
4464 
4465  bool AUTOCIRCULATE_TRANSFER_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4466  { UWord v16(0); ULWord v32(0);
4467  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4468  channelSpec = NTV2Crosspoint(v16);
4469 // POPU64(u64, inBlob, inOutIndex); // ULWord * videoBuffer
4470 // videoBuffer = reinterpret_cast<ULWord*>(u64);
4471  POPU32(videoBufferSize, inBlob, inOutIndex); // ULWord videoBufferSize
4472  if (videoBufferSize && !videoBuffer)
4473  {
4474  videoBuffer = reinterpret_cast<ULWord*>(AJAMemory::AllocateAligned(videoBufferSize, NTV2Buffer::DefaultPageSize()));
4475  if (!videoBuffer)
4476  return false;
4477  if ((inOutIndex + videoBufferSize) >= inBlob.size())
4478  return false; // past end of inBlob
4479  UByte* pBuffer = reinterpret_cast<UByte*>(videoBuffer);
4480  for (ULWord cnt(0); cnt < videoBufferSize; cnt++)
4481  pBuffer[cnt] = inBlob.at(inOutIndex++); // Caller is responsible for byte-swapping if needed
4482  }
4483  POPU32(videoDmaOffset, inBlob, inOutIndex); // ULWord videoDmaOffset
4484 // POPU64(u64, inBlob, inOutIndex); // ULWord * audioBuffer
4485 // audioBuffer = reinterpret_cast<ULWord*>(u64);
4486  POPU32(audioBufferSize, inBlob, inOutIndex); // ULWord audioBufferSize
4487  if (audioBufferSize && !audioBuffer)
4488  {
4489  audioBuffer = reinterpret_cast<ULWord*>(AJAMemory::AllocateAligned(audioBufferSize, NTV2Buffer::DefaultPageSize()));
4490  if (!audioBuffer)
4491  return false;
4492  if ((inOutIndex + audioBufferSize) >= inBlob.size())
4493  return false; // past end of inBlob
4494  UByte* pBuffer = reinterpret_cast<UByte*>(audioBuffer);
4495  for (ULWord cnt(0); cnt < audioBufferSize; cnt++)
4496  pBuffer[cnt] = inBlob.at(inOutIndex++); // Caller is responsible for byte-swapping if needed
4497  }
4498  POPU32(audioStartSample, inBlob, inOutIndex); // ULWord audioStartSample
4499  POPU32(audioNumChannels, inBlob, inOutIndex); // ULWord audioNumChannels
4500  POPU32(frameRepeatCount, inBlob, inOutIndex); // ULWord frameRepeatCount
4501  rp188.RPCDecode(inBlob, inOutIndex); // RP188_STRUCT rp188
4502  POPU32(v32, inBlob, inOutIndex); // LWord desiredFrame
4503  desiredFrame = LWord(v32);
4504  POPU32(hUser, inBlob, inOutIndex); // ULWord hUser
4505  POPU32(transferFlags, inBlob, inOutIndex); // ULWord transferFlags
4506  POPU8(AsU8Ref(bDisableExtraAudioInfo), inBlob, inOutIndex); // BOOL_ bDisableExtraAudioInfo
4507  POPU16(v16, inBlob, inOutIndex); // NTV2PixelFormat frameBufferFormat
4508  frameBufferFormat = NTV2PixelFormat(v16);
4509  POPU16(v16, inBlob, inOutIndex); // NTV2FBOrientation frameBufferOrientation
4510  frameBufferOrientation = NTV2FBOrientation(v16);
4511  // Skip color correction for now // NTV2ColorCorrectionInfo colorCorrectionInfo
4512  vidProcInfo.RPCDecode(inBlob, inOutIndex); // AutoCircVidProcInfo vidProcInfo
4513  POPU32(customAncInfo.Group1, inBlob, inOutIndex); // CUSTOM_ANC_STRUCT customAncInfo
4514  POPU32(customAncInfo.Group2, inBlob, inOutIndex);
4515  POPU32(customAncInfo.Group3, inBlob, inOutIndex);
4516  POPU32(customAncInfo.Group4, inBlob, inOutIndex);
4517  POPU32(videoNumSegments, inBlob, inOutIndex); // ULWord videoNumSegments
4518  POPU32(videoSegmentHostPitch, inBlob, inOutIndex); // ULWord videoSegmentHostPitch
4519  POPU32(videoSegmentCardPitch, inBlob, inOutIndex); // ULWord videoSegmentCardPitch
4520  POPU16(v16, inBlob, inOutIndex); // NTV2QtrSizeExpandMode videoQuarterSizeExpand
4521  videoQuarterSizeExpand = NTV2QtrSizeExpandMode(v16);
4522  return true;
4523  }
4524 
4526  {
4527  const size_t totBytes (mHeader.GetSizeInBytes()); // Header + natural size of all structs/fields inbetween + Trailer
4528  if (outBlob.capacity() < totBytes)
4529  outBlob.reserve(totBytes);
4530  bool ok = mHeader.RPCEncode(outBlob); // NTV2_HEADER mHeader
4531  ok &= mBuffer.RPCEncode(outBlob); // NTV2Buffer mBuffer
4532  PUSHU32(mFlags, outBlob); // ULWord mFlags
4533  PUSHU32(mStatus, outBlob); // ULWord mStatus
4534  for (size_t ndx(0); ndx < 16; ndx++)
4535  PUSHU32(mRegisters[ndx], outBlob); // ULWord mRegisters[16]
4536  for (size_t ndx(0); ndx < 32; ndx++)
4537  PUSHU32(mReserved[ndx], outBlob); // ULWord mReserved[32]
4538  ok &= mTrailer.RPCEncode(outBlob); // NTV2_TRAILER mTrailer
4539  return ok;
4540  }
4541 
4542  bool NTV2Bitstream::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4543  {
4544  bool ok = mHeader.RPCDecode(inBlob, inOutIndex); // NTV2_HEADER acHeader
4545  ok &= mBuffer.RPCDecode(inBlob, inOutIndex); // NTV2Buffer mBuffer
4546  POPU32(mFlags, inBlob, inOutIndex); // ULWord mFlags
4547  POPU32(mStatus, inBlob, inOutIndex); // ULWord mStatus
4548  for (size_t ndx(0); ndx < 16; ndx++)
4549  POPU32(mRegisters[ndx], inBlob, inOutIndex); // ULWord mRegisters[16]
4550  for (size_t ndx(0); ndx < 16; ndx++)
4551  POPU32(mReserved[ndx], inBlob, inOutIndex); // ULWord mReserved[16]
4552  ok &= mTrailer.RPCDecode(inBlob, inOutIndex); // NTV2_TRAILER mTrailer
4553  return ok;
4554  }
4555 
4557  {
4558  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4559  PUSHU16(UWord(state), outBlob); // NTV2AutoCirculateState state
4560  PUSHU32(ULWord(startFrame), outBlob); // LWord startFrame
4561  PUSHU32(ULWord(endFrame), outBlob); // LWord endFrame
4562  PUSHU32(ULWord(activeFrame), outBlob); // LWord activeFrame
4563  PUSHU64(rdtscStartTime, outBlob); // ULWord64 rdtscStartTime
4564  PUSHU64(audioClockStartTime, outBlob); // ULWord64 audioClockStartTime
4565  PUSHU64(rdtscCurrentTime, outBlob); // ULWord64 rdtscCurrentTime
4566  PUSHU64(audioClockCurrentTime, outBlob); // ULWord64 audioClockCurrentTime
4567  PUSHU32(framesProcessed, outBlob); // ULWord framesProcessed
4568  PUSHU32(framesDropped, outBlob); // ULWord framesDropped
4569  PUSHU32(bufferLevel, outBlob); // ULWord bufferLevel
4570  PUSHU8(bWithAudio, outBlob); // BOOL_ bWithAudio
4571  PUSHU8(bWithRP188, outBlob); // BOOL_ bWithRP188
4572  PUSHU8(bFbfChange, outBlob); // BOOL_ bFbfChange
4573  PUSHU8(bFboChange, outBlob); // BOOL_ bFboChange
4574  PUSHU8(bWithColorCorrection, outBlob); // BOOL_ bWithColorCorrection
4575  PUSHU8(bWithVidProc, outBlob); // BOOL_ bWithVidProc
4576  PUSHU8(bWithCustomAncData, outBlob); // BOOL_ bWithCustomAncData
4577  return true;
4578  }
4579 
4580  bool AUTOCIRCULATE_STATUS_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4581  { uint16_t v16(0); uint32_t v32(0);
4582  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4583  channelSpec = NTV2Crosspoint(v16);
4584  POPU16(v16, inBlob, inOutIndex); // NTV2AutoCirculateState state
4585  state = NTV2AutoCirculateState(v16);
4586  POPU32(v32, inBlob, inOutIndex); // LWord startFrame
4587  startFrame = LWord(v32);
4588  POPU32(v32, inBlob, inOutIndex); // LWord endFrame
4589  endFrame = LWord(v32);
4590  POPU32(v32, inBlob, inOutIndex); // LWord activeFrame
4591  activeFrame = LWord(v32);
4592  POPU64(rdtscStartTime, inBlob, inOutIndex); // ULWord64 rdtscStartTime
4593  POPU64(audioClockStartTime, inBlob, inOutIndex); // ULWord64 audioClockStartTime
4594  POPU64(rdtscCurrentTime, inBlob, inOutIndex); // ULWord64 rdtscCurrentTime
4595  POPU64(audioClockCurrentTime, inBlob, inOutIndex); // ULWord64 audioClockCurrentTime
4596  POPU32(framesProcessed, inBlob, inOutIndex); // ULWord framesProcessed
4597  POPU32(framesDropped, inBlob, inOutIndex); // ULWord framesDropped
4598  POPU32(bufferLevel, inBlob, inOutIndex); // ULWord bufferLevel
4599  POPU8(AsU8Ref(bWithAudio), inBlob, inOutIndex); // BOOL_ bWithAudio
4600  POPU8(AsU8Ref(bWithRP188), inBlob, inOutIndex); // BOOL_ bWithRP188
4601  POPU8(AsU8Ref(bFbfChange), inBlob, inOutIndex); // BOOL_ bFbfChange
4602  POPU8(AsU8Ref(bFboChange), inBlob, inOutIndex); // BOOL_ bFboChange
4603  POPU8(AsU8Ref(bWithColorCorrection), inBlob, inOutIndex);// BOOL_ bWithColorCorrection
4604  POPU8(AsU8Ref(bWithVidProc), inBlob, inOutIndex); // BOOL_ bWithVidProc
4605  POPU8(AsU8Ref(bWithCustomAncData), inBlob, inOutIndex); // BOOL_ bWithCustomAncData
4606  return true;
4607  }
4608 
4610  {
4611  PUSHU32(DBB, outBlob); // ULWord DBB
4612  PUSHU32(Low, outBlob); // ULWord Low
4613  PUSHU32(High, outBlob); // ULWord High
4614  return true;
4615  }
4616 
4617  bool RP188_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4618  {
4619  POPU32(DBB, inBlob, inOutIndex); // ULWord DBB
4620  POPU32(Low, inBlob, inOutIndex); // ULWord Low
4621  POPU32(High, inBlob, inOutIndex); // ULWord High
4622  return true;
4623  }
4624 
4625 
4627  {
4628  PUSHU32(taskVersion, outBlob); // ULWord taskVersion
4629  PUSHU32(taskSize, outBlob); // ULWord taskSize
4630  PUSHU32(numTasks, outBlob); // ULWord numTasks
4631  PUSHU32(maxTasks, outBlob); // ULWord maxTasks
4632  PUSHU64(ULWord64(taskArray), outBlob); // ULWord taskArray
4633  if (taskArray && numTasks)
4634  for (ULWord num(0); num < numTasks; num++)
4635  {
4636  const AutoCircGenericTask & task (taskArray[num]);
4637  PUSHU32(task.taskType, outBlob); // AutoCircTaskType taskType
4638  const ULWord * pULWords = reinterpret_cast<const ULWord*>(&task.u);
4639  ULWord numWords(0);
4640  if (NTV2_IS_REGISTER_TASK(task.taskType))
4641  numWords = sizeof(AutoCircRegisterTask)/sizeof(ULWord);
4642  else if (NTV2_IS_TIMECODE_TASK(task.taskType))
4643  numWords = sizeof(AutoCircTimeCodeTask)/sizeof(ULWord);
4644  for (ULWord word(0); word < numWords; word++)
4645  PUSHU32(pULWords[word], outBlob);
4646  }
4647  return true;
4648  }
4649 
4650  bool AUTOCIRCULATE_TASK_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4651  { ULWord u32(0); ULWord64 u64(0);
4652  POPU32(taskVersion, inBlob, inOutIndex); // ULWord taskVersion
4653  POPU32(taskSize, inBlob, inOutIndex); // ULWord taskSize
4654  POPU32(numTasks, inBlob, inOutIndex); // ULWord numTasks
4655  POPU32(maxTasks, inBlob, inOutIndex); // ULWord maxTasks
4656  POPU64(u64, inBlob, inOutIndex); // ULWord taskArray
4657  taskArray = reinterpret_cast<AutoCircGenericTask*>(u64);
4658  if (taskArray && numTasks)
4659  for (ULWord num(0); num < numTasks; num++)
4660  {
4661  AutoCircGenericTask & task (taskArray[num]);
4662  POPU32(u32, inBlob, inOutIndex); // AutoCircTaskType taskType
4663  task.taskType = AutoCircTaskType(u32);
4664  ULWord * pULWords = reinterpret_cast<ULWord*>(&task.u);
4665  ULWord numWords(0);
4666  if (NTV2_IS_REGISTER_TASK(task.taskType))
4667  numWords = sizeof(AutoCircRegisterTask)/sizeof(ULWord);
4668  else if (NTV2_IS_TIMECODE_TASK(task.taskType))
4669  numWords = sizeof(AutoCircTimeCodeTask)/sizeof(ULWord);
4670  for (ULWord word(0); word < numWords; word++)
4671  POPU32(pULWords[word], inBlob, inOutIndex);
4672  }
4673  return true;
4674  }
4675 
4677  {
4678  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4679  PUSHU64(ULWord64(frameTime), outBlob); // LWord64 frameTime
4680  PUSHU32(frame, outBlob); // ULWord frame
4681  PUSHU64(audioClockTimeStamp, outBlob); // ULWord64 audioClockTimeStamp
4682  PUSHU32(audioExpectedAddress, outBlob); // ULWord audioExpectedAddress
4683  PUSHU32(audioInStartAddress, outBlob); // ULWord audioInStartAddress
4684  PUSHU32(audioInStopAddress, outBlob); // ULWord audioInStopAddress
4685  PUSHU32(audioOutStopAddress, outBlob); // ULWord audioOutStopAddress
4686  PUSHU32(audioOutStartAddress, outBlob); // ULWord audioOutStartAddress
4687  PUSHU32(bytesRead, outBlob); // ULWord bytesRead
4688  PUSHU32(startSample, outBlob); // ULWord startSample
4689  PUSHU64(ULWord64(currentTime), outBlob); // LWord64 currentTime
4690  PUSHU32(currentFrame, outBlob); // ULWord currentFrame
4691  currentRP188.RPCEncode(outBlob); // RP188_STRUCT currentRP188
4692  PUSHU64(ULWord64(currentFrameTime), outBlob); // LWord64 currentFrameTime
4693  PUSHU64(audioClockCurrentTime, outBlob); // ULWord64 audioClockCurrentTime
4694  PUSHU32(currentAudioExpectedAddress, outBlob); // ULWord currentAudioExpectedAddress
4695  PUSHU32(currentAudioStartAddress, outBlob); // ULWord currentAudioStartAddress
4696  PUSHU32(currentFieldCount, outBlob); // ULWord currentFieldCount
4697  PUSHU32(currentLineCount, outBlob); // ULWord currentLineCount
4698  PUSHU32(currentReps, outBlob); // ULWord currentReps
4699  PUSHU32(currenthUser, outBlob); // ULWord currenthUser
4700  return true;
4701  }
4702 
4703  bool FRAME_STAMP_STRUCT::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4704  { uint16_t v16(0); uint64_t v64(0);
4705  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4706  channelSpec = NTV2Crosspoint(v16);
4707  POPU64(v64, inBlob, inOutIndex); // LWord64 frameTime
4708  frameTime = LWord64(v64);
4709  POPU32(frame, inBlob, inOutIndex); // ULWord frame
4710  POPU64(audioClockTimeStamp, inBlob, inOutIndex); // ULWord64 audioClockTimeStamp
4711  POPU32(audioExpectedAddress, inBlob, inOutIndex); // ULWord audioExpectedAddress
4712  POPU32(audioInStartAddress, inBlob, inOutIndex); // ULWord audioInStartAddress
4713  POPU32(audioInStopAddress, inBlob, inOutIndex); // ULWord audioInStopAddress
4714  POPU32(audioOutStopAddress, inBlob, inOutIndex); // ULWord audioOutStopAddress
4715  POPU32(audioOutStartAddress, inBlob, inOutIndex); // ULWord audioOutStartAddress
4716  POPU32(bytesRead, inBlob, inOutIndex); // ULWord bytesRead
4717  POPU32(startSample, inBlob, inOutIndex); // ULWord startSample
4718  POPU64(v64, inBlob, inOutIndex); // LWord64 currentTime
4719  currentTime = LWord64(v64);
4720  POPU32(currentFrame, inBlob, inOutIndex); // ULWord currentFrame
4721  currentRP188.RPCDecode(inBlob, inOutIndex); // RP188_STRUCT currentRP188
4722  POPU64(v64, inBlob, inOutIndex); // LWord64 currentFrameTime
4723  currentFrameTime = LWord64(v64);
4724  POPU64(audioClockCurrentTime, inBlob, inOutIndex); // ULWord64 audioClockCurrentTime
4725  POPU32(currentAudioExpectedAddress, inBlob, inOutIndex);// ULWord currentAudioExpectedAddress
4726  POPU32(currentAudioStartAddress, inBlob, inOutIndex); // ULWord currentAudioStartAddress
4727  POPU32(currentFieldCount, inBlob, inOutIndex); // ULWord currentFieldCount
4728  POPU32(currentLineCount, inBlob, inOutIndex); // ULWord currentLineCount
4729  POPU32(currentReps, inBlob, inOutIndex); // ULWord currentReps
4730  POPU32(currenthUser, inBlob, inOutIndex); // ULWord currenthUser
4731  return true;
4732  }
4733 
4735  {
4736  PUSHU16(UWord(eCommand), outBlob); // AUTO_CIRC_COMMAND eCommand
4737  PUSHU16(UWord(channelSpec), outBlob); // NTV2Crosspoint channelSpec
4738  PUSHU32(ULWord(lVal1), outBlob); // LWord lVal1
4739  PUSHU32(ULWord(lVal2), outBlob); // LWord lVal2
4740  PUSHU32(ULWord(lVal3), outBlob); // LWord lVal3
4741  PUSHU32(ULWord(lVal4), outBlob); // LWord lVal4
4742  PUSHU32(ULWord(lVal5), outBlob); // LWord lVal5
4743  PUSHU32(ULWord(lVal6), outBlob); // LWord lVal6
4744  PUSHU8(bVal1, outBlob); // BOOL_ bVal1
4745  PUSHU8(bVal2, outBlob); // BOOL_ bVal2
4746  PUSHU8(bVal3, outBlob); // BOOL_ bVal3
4747  PUSHU8(bVal4, outBlob); // BOOL_ bVal4
4748  PUSHU8(bVal5, outBlob); // BOOL_ bVal5
4749  PUSHU8(bVal6, outBlob); // BOOL_ bVal6
4750  PUSHU8(bVal7, outBlob); // BOOL_ bVal7
4751  PUSHU8(bVal8, outBlob); // BOOL_ bVal8
4752  PUSHU64(ULWord64(pvVal1), outBlob); // void* pvVal1
4753  PUSHU64(ULWord64(pvVal2), outBlob); // void* pvVal2
4754  PUSHU64(ULWord64(pvVal3), outBlob); // void* pvVal3
4755  PUSHU64(ULWord64(pvVal4), outBlob); // void* pvVal4
4756  if (eCommand == eGetAutoCirc && pvVal1)
4757  reinterpret_cast<AUTOCIRCULATE_STATUS_STRUCT*>(pvVal1)->RPCEncode(outBlob);
4758  if ((eCommand == eGetFrameStamp || eCommand == eGetFrameStampEx2) && pvVal1)
4759  reinterpret_cast<FRAME_STAMP_STRUCT*>(pvVal1)->RPCEncode(outBlob);
4760  if (eCommand == eGetFrameStampEx2 && pvVal2)
4761  reinterpret_cast<AUTOCIRCULATE_TASK_STRUCT*>(pvVal2)->RPCEncode(outBlob);
4762  if (eCommand == eTransferAutoCirculate && pvVal1)
4763  reinterpret_cast<AUTOCIRCULATE_TRANSFER_STRUCT*>(pvVal1)->RPCEncode(outBlob);
4764  return true;
4765  }
4766 
4767  bool AUTOCIRCULATE_DATA::RPCDecode (const UByteSequence & inBlob, size_t & inOutIndex)
4768  {
4769 #if defined(AJA_LINUX)
4770  #pragma GCC diagnostic push
4771  #pragma GCC diagnostic ignored "-Wstrict-aliasing"
4772 #endif
4773  uint16_t v16(0); uint32_t v32(0);
4774  POPU16(v16, inBlob, inOutIndex); // AUTO_CIRC_COMMAND eCommand
4775  eCommand = AUTO_CIRC_COMMAND(v16);
4776  POPU16(v16, inBlob, inOutIndex); // NTV2Crosspoint channelSpec
4777  channelSpec = NTV2Crosspoint(v16);
4778  POPU32(v32, inBlob, inOutIndex); lVal1 = LWord(v32); // LWord lVal1
4779  POPU32(v32, inBlob, inOutIndex); lVal2 = LWord(v32); // LWord lVal2
4780  POPU32(v32, inBlob, inOutIndex); lVal3 = LWord(v32); // LWord lVal3
4781  POPU32(v32, inBlob, inOutIndex); lVal4 = LWord(v32); // LWord lVal4
4782  POPU32(v32, inBlob, inOutIndex); lVal5 = LWord(v32); // LWord lVal5
4783  POPU32(v32, inBlob, inOutIndex); lVal6 = LWord(v32); // LWord lVal6
4784  POPU8(AsU8Ref(bVal1), inBlob, inOutIndex); // BOOL_ bVal1
4785  POPU8(AsU8Ref(bVal2), inBlob, inOutIndex); // BOOL_ bVal2
4786  POPU8(AsU8Ref(bVal3), inBlob, inOutIndex); // BOOL_ bVal3
4787  POPU8(AsU8Ref(bVal4), inBlob, inOutIndex); // BOOL_ bVal4
4788  POPU8(AsU8Ref(bVal5), inBlob, inOutIndex); // BOOL_ bVal5
4789  POPU8(AsU8Ref(bVal6), inBlob, inOutIndex); // BOOL_ bVal6
4790  POPU8(AsU8Ref(bVal7), inBlob, inOutIndex); // BOOL_ bVal7
4791  POPU8(AsU8Ref(bVal8), inBlob, inOutIndex); // BOOL_ bVal8
4792  POPU64(AsU64Ref(pvVal1), inBlob, inOutIndex); // void* pvVal1
4793  POPU64(AsU64Ref(pvVal2), inBlob, inOutIndex); // void* pvVal2
4794  POPU64(AsU64Ref(pvVal3), inBlob, inOutIndex); // void* pvVal3
4795  POPU64(AsU64Ref(pvVal4), inBlob, inOutIndex); // void* pvVal4
4796 #if defined(AJA_LINUX)
4797  #pragma GCC diagnostic pop
4798 #endif
4799  if (eCommand == eGetAutoCirc && pvVal1)
4800  reinterpret_cast<AUTOCIRCULATE_STATUS_STRUCT*>(pvVal1)->RPCDecode(inBlob, inOutIndex);
4801  if ((eCommand == eGetFrameStamp || eCommand == eGetFrameStampEx2) && pvVal1)
4802  reinterpret_cast<FRAME_STAMP_STRUCT*>(pvVal1)->RPCDecode(inBlob, inOutIndex);
4803  if (eCommand == eGetFrameStampEx2 && pvVal2)
4804  reinterpret_cast<AUTOCIRCULATE_TASK_STRUCT*>(pvVal2)->RPCDecode(inBlob, inOutIndex);
4805  if (eCommand == eTransferAutoCirculate && pvVal1)
4806  reinterpret_cast<AUTOCIRCULATE_TRANSFER_STRUCT*>(pvVal1)->RPCDecode(inBlob, inOutIndex);
4807  return true;
4808  }
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.
NTV2Buffer acOutputTimeCodes
Intended for playout, this is an ordered sequence of NTV2_RP188 values to send to the device...
#define NTV2_TYPE_MESSAGE_DATA
Identifies NTV2MessageData struct.
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)
Definition: ntv2utils.cpp:6981
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:5748
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:6648
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.
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:7396
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:592
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:7065
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:7564
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:7584
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:6705
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:1161
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:7042
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:5158
std::string AutoCircVidProcModeToString(const AutoCircVidProcMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:7570
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:6913
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:6446
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:1045
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:6671
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
static std::string FourCCToString(const ULWord in4CC, const char nonPrintable='?')
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:6660
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:6749
~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:6397
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:6458
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:6434
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.
NTV2_HEADER mHeader
The common structure header – ALWAYS FIRST!
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:6682
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:1141
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)
NTV2MessageData(const void *inMessage, const size_t inMessageSize, const ULWord inFlags)
Constructs an NTV2VirtualData struct for reading or writing virtual data.
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:6693
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:5808
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
std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
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:5759
NTV2RegisterValueMap::const_iterator NTV2RegValueMapConstIter
A const iterator that iterates over NTV2RegisterValueMap entries.
bool is_legal_decimal_number(const std::string &inStr, size_t inMaxLength)
Definition: common.cpp:526
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:6939
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:1043
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:1181
#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:5730
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:4711
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:7011
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.