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