AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2democommon.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #ifndef _NTV2DEMOCOMMON_H
10 #define _NTV2DEMOCOMMON_H
11 
12 #include "ntv2rp188.h"
13 #include "ntv2publicinterface.h"
14 #include "ntv2card.h"
15 #include "ntv2utils.h" // for NTV2ACFrameRange
20 #include "ajabase/system/debug.h"
21 #include "ajabase/system/info.h"
22 #include "ajabase/system/systemtime.h" // for AJATime
23 #include "ajabase/common/common.h" // for aja::strip & etc.
24 #include <algorithm>
25 #include <string>
26 
27 // Convenience macros for EZ logging:
28 #define CAPFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_DemoCapture, AJAFUNC << ": " << _expr_)
29 #define CAPWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_DemoCapture, AJAFUNC << ": " << _expr_)
30 #define CAPDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_DemoCapture, AJAFUNC << ": " << _expr_)
31 #define CAPNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_DemoCapture, AJAFUNC << ": " << _expr_)
32 #define CAPINFO(_expr_) AJA_sINFO (AJA_DebugUnit_DemoCapture, AJAFUNC << ": " << _expr_)
33 
34 #define PLFAIL(_xpr_) AJA_sERROR (AJA_DebugUnit_DemoPlayout, AJAFUNC << ": " << _xpr_)
35 #define PLWARN(_xpr_) AJA_sWARNING(AJA_DebugUnit_DemoPlayout, AJAFUNC << ": " << _xpr_)
36 #define PLNOTE(_xpr_) AJA_sNOTICE (AJA_DebugUnit_DemoPlayout, AJAFUNC << ": " << _xpr_)
37 #define PLINFO(_xpr_) AJA_sINFO (AJA_DebugUnit_DemoPlayout, AJAFUNC << ": " << _xpr_)
38 #define PLDBG(_xpr_) AJA_sDEBUG (AJA_DebugUnit_DemoPlayout, AJAFUNC << ": " << _xpr_)
39 
40 #define BURNFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
41 #define BURNWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
42 #define BURNDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
43 #define BURNNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
44 #define BURNINFO(_expr_) AJA_sINFO (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_)
45 
46 #define NTV2_AUDIOSIZE_MAX (401 * 1024)
47 #define NTV2_ANCSIZE_MAX (0x2000) // 8K
48 
49 
55 typedef struct
56 {
57  uint32_t * fVideoBuffer;
58  uint32_t * fVideoBuffer2;
59  uint32_t fVideoBufferSize;
60  uint32_t * fAudioBuffer;
61  uint32_t fAudioBufferSize;
62  uint32_t * fAncBuffer;
63  uint32_t fAncBufferSize;
64  uint32_t * fAncF2Buffer;
65  uint32_t fAncF2BufferSize;
66  uint32_t fAudioRecordSize;
67  uint32_t fAncRecordSize;
71  uint32_t fFrameFlags;
72 } AVDataBuffer;
73 
74 
80 {
81  public:
91  uint32_t fFrameFlags;
92  public:
93  explicit inline NTV2FrameData()
94  : fVideoBuffer (0),
95  fVideoBuffer2 (0),
96  fAudioBuffer (0),
97  fAncBuffer (0),
98  fAncBuffer2 (0),
99  fTimecodes (),
100  fNumAudioBytes (0),
101  fNumAncBytes (0),
102  fNumAnc2Bytes (0),
103  fFrameFlags(0) {}
104 
105  // Inquiry Methods
106  inline NTV2Buffer & VideoBuffer (void) {return fVideoBuffer;}
107  inline ULWord VideoBufferSize (void) const {return fVideoBuffer.GetByteCount();}
108 
109  inline NTV2Buffer & AudioBuffer (void) {return fAudioBuffer;}
110  inline ULWord AudioBufferSize (void) const {return fAudioBuffer.GetByteCount();}
111  inline ULWord NumCapturedAudioBytes (void) const {return fNumAudioBytes;}
112 
113  inline NTV2Buffer & AncBuffer (void) {return fAncBuffer;}
114  inline ULWord AncBufferSize (void) const {return fAncBuffer.GetByteCount();}
115  inline ULWord NumCapturedAncBytes (void) const {return fNumAncBytes;}
116 
117  inline NTV2Buffer & AncBuffer2 (void) {return fAncBuffer2;}
118  inline ULWord AncBuffer2Size (void) const {return fAncBuffer2.GetByteCount();}
119  inline ULWord NumCapturedAnc2Bytes (void) const {return fNumAnc2Bytes;}
120 
121  inline NTV2Buffer & VideoBuffer2 (void) {return fVideoBuffer2;}
122  inline ULWord VideoBufferSize2 (void) const {return fVideoBuffer2.GetByteCount();}
123 
124  inline bool IsNULL (void) const {return fVideoBuffer.IsNULL() && fVideoBuffer2.IsNULL()
125  && fAudioBuffer.IsNULL() && fAncBuffer.IsNULL()
126  && fAncBuffer2.IsNULL();}
127  inline bool HasTimecode (const NTV2TCIndex inTCNdx) const {return fTimecodes.find(inTCNdx) != fTimecodes.end();}
128  NTV2_RP188 Timecode (const NTV2TCIndex inTCNdx) const;
129  inline bool HasValidTimecode (const NTV2TCIndex inTCNdx) const {return Timecode(inTCNdx).IsValid();}
130 
131  // Modifier Methods
132  inline void ZeroBuffers (void) { if (fVideoBuffer)
133  fVideoBuffer.Fill(ULWord(0));
134  if (fVideoBuffer2)
135  fVideoBuffer2.Fill(ULWord(0));
136  if (fAudioBuffer)
137  fAudioBuffer.Fill(ULWord(0));
138  if (fAncBuffer)
139  fAncBuffer.Fill(ULWord(0));
140  if (fAncBuffer2)
141  fAncBuffer2.Fill(ULWord(0));
142  fNumAudioBytes = fNumAncBytes = fNumAnc2Bytes = 0;
143  }
144  bool LockAll (CNTV2Card & inDevice);
145  bool UnlockAll (CNTV2Card & inDevice);
146 
147  bool Reset (void) {return fVideoBuffer.Allocate(0) && fVideoBuffer2.Allocate(0)
148  && fAudioBuffer.Allocate(0) && fAncBuffer.Allocate(0)
149  && fAncBuffer2.Allocate(0);}
150 }; // NTV2FrameData
151 
152 typedef std::vector<NTV2FrameData> NTV2FrameDataArray;
153 typedef NTV2FrameDataArray::iterator NTV2FrameDataArrayIter;
154 typedef NTV2FrameDataArray::const_iterator NTV2FrameDataArrayConstIter;
156 
157 
158 
159 static const size_t CIRCULAR_BUFFER_SIZE (10);
160 static const ULWord kDemoAppSignature NTV2_FOURCC('D','E','M','O');
161 
162 
167 template <typename T> class Bouncer
168 {
169  public:
170  inline Bouncer (const T inUpperLimit, const T inLowerLimit = T(0), const T inStartValue = T(0), const bool inStartAscend = true)
171  : mMin (inLowerLimit),
172  mMax (inUpperLimit),
173  mValue (inStartValue),
174  mIncrement (T(1)),
175  mAscend (inStartAscend)
176  {
177  if (mMin > mMax)
178  std::swap (mMin, mMax);
179  else if (mMin == mMax)
180  mMax = mMin + mIncrement;
181  if (mValue < mMin)
182  {
183  mValue = mMin;
184  mAscend = true;
185  }
186  if (mValue > mMax)
187  {
188  mValue = mMax;
189  mAscend = false;
190  }
191  }
192 
193  inline T Next (void)
194  {
195  if (mAscend)
196  {
197  if (mValue < mMax)
198  mValue += mIncrement;
199  else
200  mAscend = false;
201  }
202  else
203  {
204  if (mValue > mMin)
205  mValue -= mIncrement;
206  else
207  mAscend = true;
208  }
209  return mValue;
210  }
211 
212  inline void SetIncrement (const T inValue) {mIncrement = inValue;}
213  inline T Value (void) const {return mValue;}
214 
215  private:
216  T mMin, mMax, mValue, mIncrement;
217  bool mAscend;
218 
219 }; // Bouncer
220 
221 
223 {
230 #if !defined(NTV2_DEPRECATE_17_5)
231  // Deprecated old ones:
237 #endif // !defined(NTV2_DEPRECATE_17_5)
239 
241 
242 
244 {
254 
256 
257 
258 typedef enum _NTV2TCIndexKinds
259 {
269 
270 
275 {
276  public:
277  std::string fDeviceSpec;
278  std::string fAncDataFilePath;
286  bool fWithAnc;
287  bool fWithAudio;
289 
293  inline explicit CaptureConfig (const std::string & inDeviceSpec = "0")
294  : fDeviceSpec (inDeviceSpec),
295  fAncDataFilePath (),
296  fInputChannel (NTV2_CHANNEL_INVALID),
297  fInputSource (NTV2_INPUTSOURCE_INVALID),
298  fFrames (7),
299  fPixelFormat (NTV2_FBF_8BIT_YCBCR),
300  fNumAudioLinks (1),
301  fDoABConversion (false),
302  fDoMultiFormat (false),
303  fWithAnc (false),
304  fWithAudio (true),
305  fDoTSIRouting (true)
306  {
307  }
308 
309  AJALabelValuePairs Get (const bool inCompact = false) const;
310 
311 }; // CaptureConfig
312 
313 AJAExport std::ostream & operator << (std::ostream & ioStrm, const CaptureConfig & inObj);
314 
315 
319 typedef struct PlayerConfig
320 {
321  public:
322  std::string fDeviceSpec;
323  std::string fAncDataFilePath;
340 
344  inline explicit PlayerConfig (const std::string & inDeviceSpecifier = "0")
345  : fDeviceSpec (inDeviceSpecifier),
346  fAncDataFilePath (),
349  fFrames (7),
353  fNumAudioLinks (1),
363  {
364  }
365 
366  inline bool WithAudio(void) const {return !fSuppressAudio && fNumAudioLinks > 0;}
367  inline bool WithVideo(void) const {return !fSuppressVideo;}
368 
374  AJALabelValuePairs Get (const bool inCompact = false) const;
375 
376 } PlayerConfig;
377 
378 AJAExport std::ostream & operator << (std::ostream & ioStrm, const PlayerConfig & inObj);
379 
383 typedef struct BurnConfig
384 {
385  public:
386  std::string fDeviceSpec;
387  std::string fDeviceSpec2;
400  bool fWithAnc;
402  bool fWithHanc;
403  bool fVerbose;
404 
408  inline explicit BurnConfig (const std::string & inDeviceSpecifier = "0")
409  : fDeviceSpec (inDeviceSpecifier),
410  fDeviceSpec2 (),
415  fInputFrames (7),
416  fOutputFrames (7),
423  fWithAnc (false),
425  fWithHanc (false),
426  fVerbose (false)
427  {
428  }
429 
430  inline bool WithAudio(void) const {return !fSuppressAudio;}
431  inline bool WithVideo(void) const {return !fSuppressVideo;}
432  inline bool WithAnc(void) const {return fWithAnc;}
433  inline bool WithTallVANC(void) const {return fWithTallFrames;}
434  inline bool WithHanc(void) const {return fWithHanc;}
435  inline bool WithTimecode(void) const {return NTV2_IS_VALID_TIMECODE_INDEX(fTimecodeSource);}
436  inline bool FieldMode(void) const {return fIsFieldMode;}
437  inline bool OutputSpecified(void) const {return NTV2_IS_VALID_OUTPUT_DEST(fOutputDest);}
438  inline bool IsVerbose(void) const {return fVerbose;}
439  inline std::string ISrcStr(void) const {return ::NTV2InputSourceToString(fInputSource, true);}
441  inline bool ISrcIsSDI(void) const {return NTV2_INPUT_SOURCE_IS_SDI(fInputSource);}
442  inline std::string ODstStr(void) const {return ::NTV2OutputDestinationToString(fOutputDest, true);}
444  inline std::string IChStr(void) const {std::ostringstream oss; oss << "Ch" << int(fInputChannel); return oss.str();}
445  inline std::string OChStr(void) const {std::ostringstream oss; oss << "Ch" << int(fOutputChannel); return oss.str();}
446  inline bool ODstIsSDI(void) const {return NTV2_OUTPUT_DEST_IS_SDI(fOutputDest);}
447 
453  AJALabelValuePairs Get (const bool inCompact = false) const;
454 
455 } BurnConfig;
456 
463 inline std::ostream & operator << (std::ostream & strm, const BurnConfig & inObj) {return strm << AJASystemInfo::ToString(inObj.Get());}
464 
465 
466 
473 {
474  public:
478 
483  static bool IsValidDevice (const std::string & inDeviceSpec);
485 
489 
494  static NTV2VideoFormatSet GetSupportedVideoFormats (const NTV2VideoFormatKinds inKinds = VIDEO_FORMATS_SDHD);
495 
504  static std::string GetVideoFormatStrings (const NTV2VideoFormatKinds inKinds = VIDEO_FORMATS_SDHD,
505  const std::string inDevSpec = std::string());
506 
516  static NTV2VideoFormat GetVideoFormatFromString (const std::string & inStr,
518  const std::string & inDevSpec = std::string());
519 
525  static bool Get4KInputFormat (NTV2VideoFormat & inOutVideoFormat);
526 
532  static bool Get8KInputFormat (NTV2VideoFormat & inOutVideoFormat);
534 
538 
543  static NTV2PixelFormats GetSupportedPixelFormats (const NTV2PixelFormatKinds inKinds = PIXEL_FORMATS_ALL);
544 
553  static std::string GetPixelFormatStrings (const NTV2PixelFormatKinds inKinds = PIXEL_FORMATS_ALL,
554  const std::string inDevSpec = std::string());
555 
564  static NTV2PixelFormat GetPixelFormatFromString (const std::string & inStr,
565  const NTV2PixelFormatKinds inKinds = PIXEL_FORMATS_ALL,
566  const std::string inDevSpec = std::string());
567 
572  static AJA_PixelFormat GetAJAPixelFormat (const NTV2PixelFormat inFormat);
574 
578 
583  static const NTV2InputSourceSet GetSupportedInputSources (const NTV2IOKinds inKinds = NTV2_IOKINDS_ALL);
584 
593  static std::string GetInputSourceStrings (const NTV2IOKinds inKinds = NTV2_IOKINDS_ALL,
594  const std::string inDevSpec = std::string ());
595 
604  static NTV2InputSource GetInputSourceFromString (const std::string & inStr,
605  const NTV2IOKinds inKinds = NTV2_IOKINDS_ALL,
606  const std::string inDevSpec = std::string());
608 
612 
617  static const NTV2OutputDestinations GetSupportedOutputDestinations (const NTV2IOKinds inKinds);
618 
628  static std::string GetOutputDestinationStrings (const NTV2IOKinds inKinds, const std::string inDevSpec = std::string ());
629 
638  static NTV2OutputDestination GetOutputDestinationFromString (const std::string & inStr,
639  const NTV2IOKinds inKinds = NTV2_IOKINDS_ALL,
640  const std::string inDevSpec = std::string());
642 
646 
651  static const NTV2TCIndexes GetSupportedTCIndexes (const NTV2TCIndexKinds inKinds);
652 
665  static std::string GetTCIndexStrings (const NTV2TCIndexKinds inKinds = TC_INDEXES_ALL,
666  const std::string inDeviceSpecifier = std::string(),
667  const bool inIsInputOnly = true);
668 
676  static NTV2TCIndex GetTCIndexFromString (const std::string & inStr,
677  const NTV2TCIndexKinds inKinds = TC_INDEXES_ALL,
678  const std::string inDevSpec = std::string());
680 
684 
692  static std::string GetAudioSystemStrings (const std::string inDeviceSpecifier = std::string ());
693 
699  static NTV2AudioSystem GetAudioSystemFromString (const std::string & inStr);
701 
705 
711  static std::string GetTestPatternStrings (void);
712 
717  static std::string GetTestPatternNameFromString (const std::string & inStr);
719 
723 
729  static std::string GetVANCModeStrings (void);
730 
735  static NTV2VANCMode GetVANCModeFromString (const std::string & inStr);
737 
741 
748  static bool GetInputRouting (NTV2XptConnections & outConnections,
749  const CaptureConfig & inConfig,
750  const bool isInputRGB = false);
751 
759  static bool GetInputRouting4K ( NTV2XptConnections & outConnections,
760  const CaptureConfig & inConfig,
761  const NTV2DeviceID inDevID = DEVICE_ID_INVALID,
762  const bool isInputRGB = false);
763 
772  static bool GetInputRouting8K ( NTV2XptConnections & outConnections,
773  const CaptureConfig & inConfig,
774  const NTV2VideoFormat inVidFormat,
775  const NTV2DeviceID inDevID = DEVICE_ID_INVALID,
776  const bool isInputRGB = false);
778 
782 
789  static std::string ToLower (const std::string & inStr);
790 
796  static std::string StripFormatString (const std::string & inStr);
797 
802  static char ReadCharacterPress (void);
803 
807  static void WaitForEnterKeyPress (void);
808 
813  static TimecodeFormat NTV2FrameRate2TimecodeFormat(const NTV2FrameRate inFrameRate);
814 
819  static AJA_FrameRate GetAJAFrameRate (const NTV2FrameRate inFrameRate);
820 
824  static const char * GetGlobalMutexName (void);
825 
832  static NTV2ChannelList GetTSIMuxesForFrameStore (CNTV2Card & inDevice, const NTV2Channel in1stFrameStore, const UWord inCount);
833 
841  static bool ConfigureAudioSystems (CNTV2Card & inDevice, const CaptureConfig & inConfig, const NTV2AudioSystemSet inAudioSystems);
842 
843  static size_t SetDefaultPageSize (void);
845 
847 
848  typedef struct poptOption PoptOpts;
850  {
851  public:
852  Popt (const int inArgc, const char ** pArgs, const PoptOpts * pInOptionsTable);
853  virtual ~Popt();
854  virtual inline int parseResult(void) const {return mResult;}
855  virtual inline bool isGood (void) const {return parseResult() == -1;}
856  virtual inline operator bool() const {return isGood();}
857  virtual inline const std::string & errorStr (void) const {return mError;}
858  virtual inline const NTV2StringList & otherArgs (void) const {return mOtherArgs;}
859  private:
860  poptContext mContext;
861  int mResult;
862  std::string mError;
863  NTV2StringList mOtherArgs;
864  };
865 
866  static bool BFT(void);
867 
868 }; // CNTV2DemoCommon
869 
870 
871 // These AJA_NTV2_AUDIO_RECORD* macros can, if enabled, record audio samples into a file in the current directory.
872 // Optionally used in the CNTV2Capture demo.
873 #if defined(AJA_RAW_AUDIO_RECORD)
874  #include "ntv2debug.h" // For NTV2DeviceString
875  #include <fstream> // For ofstream
876  // To open the raw audio file in Audacity -- see http://audacity.sourceforge.net/ ...
877  // 1) Choose File => Import => Raw Data...
878  // 2) Select "Signed 32 bit PCM", Little/No/Default Endian, "16 Channels" (or 8 if applicable), "48000" sample rate.
879  // 3) Click "Import"
880  #define AJA_NTV2_AUDIO_RECORD_BEGIN ostringstream _filename; \
881  _filename << ::NTV2DeviceString(mDeviceID) << "-" << mDevice.GetIndexNumber() \
882  << "." << ::NTV2ChannelToString(mConfig.fInputChannel,true) \
883  << "." << ::NTV2InputSourceToString(mConfig.fInputSource, true) \
884  << "." << ::NTV2VideoFormatToString(mVideoFormat) \
885  << "." << ::NTV2AudioSystemToString(mAudioSystem, true) \
886  << "." << AJAProcess::GetPid() \
887  << ".raw"; \
888  ofstream _ostrm(_filename.str(), ios::binary);
889 
890  #define AJA_NTV2_AUDIO_RECORD_DO if (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem)) \
891  if (pFrameData->fAudioBuffer) \
892  _ostrm.write(pFrameData->AudioBuffer(), \
893  streamsize(pFrameData->NumCapturedAudioBytes()));
894 
895  #define AJA_NTV2_AUDIO_RECORD_END
896 #elif defined(AJA_WAV_AUDIO_RECORD)
897  #include "ntv2debug.h" // For NTV2DeviceString
898  #include "ajabase/common/wavewriter.h" // For AJAWavWriter
899  #define AJA_NTV2_AUDIO_RECORD_BEGIN ostringstream _wavfilename; \
900  _wavfilename << ::NTV2DeviceString(mDeviceID) << "-" << mDevice.GetIndexNumber() \
901  << "." << ::NTV2ChannelToString(mConfig.fInputChannel,true) \
902  << "." << ::NTV2InputSourceToString(mConfig.fInputSource, true) \
903  << "." << ::NTV2VideoFormatToString(mVideoFormat) \
904  << "." << ::NTV2AudioSystemToString(mAudioSystem, true) \
905  << "." << AJAProcess::GetPid() \
906  << ".wav"; \
907  const int _wavMaxNumAudChls(mDevice.features().GetMaxAudioChannels()); \
908  AJAWavWriter _wavWriter (_wavfilename.str(), \
909  AJAWavWriterAudioFormat(_wavMaxNumAudChls, 48000, 32)); \
910  _wavWriter.open();
911 
912  #define AJA_NTV2_AUDIO_RECORD_DO if (NTV2_IS_VALID_AUDIO_SYSTEM(mAudioSystem)) \
913  if (pFrameData->fAudioBuffer) \
914  if (_wavWriter.IsOpen()) \
915  _wavWriter.write(pFrameData->AudioBuffer(), pFrameData->NumCapturedAudioBytes());
916 
917  #define AJA_NTV2_AUDIO_RECORD_END if (_wavWriter.IsOpen()) \
918  _wavWriter.close();
919 #else
920  #define AJA_NTV2_AUDIO_RECORD_BEGIN
921  #define AJA_NTV2_AUDIO_RECORD_DO
922  #define AJA_NTV2_AUDIO_RECORD_END
923 #endif
924 
925 // Optionally used in the CNTV2Capture4K demo.
926 #if defined(AJA_RECORD_MLAUDIO)
927  #include <fstream>
928  #define AJA_NTV2_MLAUDIO_RECORD_BEGIN ofstream ofs1, ofs2; \
929  if (mConfig.fNumAudioLinks > 1) \
930  { \
931  ofs1.open("temp1.raw", ios::out | ios::trunc | ios::binary); \
932  ofs2.open("temp2.raw", ios::out | ios::trunc | ios::binary); \
933  }
934 
935  #define AJA_NTV2_MLAUDIO_RECORD_DO if (mConfig.fNumAudioLinks > 1) \
936  { const ULWord halfBytes (pFrameData->NumCapturedAudioBytes() / 2); \
937  ofs1.write(pFrameData->AudioBuffer(), halfBytes); \
938  NTV2Buffer lastHalf (pFrameData->fAudioBuffer.GetHostAddress(halfBytes), halfBytes); \
939  ofs2.write(lastHalf, lastHalf.GetByteCount()); \
940  }
941 
942  #define AJA_NTV2_MLAUDIO_RECORD_END if (mConfig.fNumAudioLinks > 1) \
943  { \
944  ofs1.close(); \
945  ofs2.close(); \
946  }
947 #else
948  #define AJA_NTV2_MLAUDIO_RECORD_BEGIN
949  #define AJA_NTV2_MLAUDIO_RECORD_DO
950  #define AJA_NTV2_MLAUDIO_RECORD_END
951 #endif
952 
953 #endif // _NTV2DEMOCOMMON_H
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5047
AJALabelValuePairs Get(const bool inCompact=(0)) const
Renders a human-readable representation of me.
std::set< NTV2VideoFormat > NTV2VideoFormatSet
A set of distinct NTV2VideoFormat values.
enum _NTV2TCIndexKinds NTV2TCIndexKinds
The invalid video input.
Definition: ntv2enums.h:1277
bool fWithAnc
If true, capture & play anc data (LLBurn). Defaults to false.
T Next(void)
void ZeroBuffers(void)
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3895
std::set< NTV2TCIndex > NTV2TCIndexes
bool fSuppressAudio
If true, suppress audio; otherwise generate & xfer audio tone.
uint32_t fFrameFlags
Frame data flags.
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...
std::string ODstStr(void) const
bool IsNULL(void) const
AJA_PixelFormat
Definition: videotypes.h:121
bool IsNULL(void) const
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:219
ULWord AncBuffer2Size(void) const
ULWord NumCapturedAnc2Bytes(void) const
ULWord NumCapturedAncBytes(void) const
RP188_STRUCT fRP188Data2
For future use.
NTV2OutputDestination
Identifies a specific video output destination.
Definition: ntv2enums.h:1324
Declares the AJADebug class.
ULWord VideoBufferSize(void) const
NTV2VANCMode fVancMode
VANC mode to use.
bool fDoMultiFormat
If true, use multi-format/multi-channel mode, if device supports it; otherwise normal mode...
std::set< NTV2InputSource > NTV2InputSourceSet
A set of distinct NTV2InputSource values.
uint32_t fFrameFlags
Frame data flags.
std::string NTV2OutputDestinationToString(const NTV2OutputDestination inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7400
ULWord AudioBufferSize(void) const
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
std::string IChStr(void) const
ULWord GetByteCount(void) const
bool fDoLinkGrouping
If true, enables 6/12G output mode on IoX3/Kona5 (4K/8K)
std::vector< AJALabelValuePair > AJALabelValuePairs
An ordered sequence of label/value pairs.
Definition: info.h:71
bool fSuppressAudio
If true, suppress audio; otherwise include audio.
NTV2FrameDataArray::const_iterator NTV2FrameDataArrayConstIter
Handy const iterator.
struct BurnConfig BurnConfig
Configures an NTV2Burn or NTV2FieldBurn instance.
Declares the AJATime class.
bool fWithTallFrames
If true && fWithAnc, use "taller" VANC mode for anc. Defaults to false.
enum _NTV2PixelFormatKind NTV2PixelFormatKind
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
bool fWithAnc
If true, also capture Anc.
Specifies any/all input/output kinds.
Definition: ntv2enums.h:1295
#define NTV2_IS_VALID_OUTPUT_DEST(_dest_)
Definition: ntv2enums.h:1347
PlayerConfig(const std::string &inDeviceSpecifier="0")
Constructs a default Player configuration.
NTV2FrameBufferFormatSet NTV2PixelFormats
#define NTV2_IS_VALID_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3984
ULWord fNumAudioBytes
Actual number of captured audio bytes.
bool fDoABConversion
If true, do level-A/B conversion; otherwise don&#39;t.
std::set< NTV2OutputDestination > NTV2OutputDestinations
A set of distinct NTV2OutputDestination values.
std::string fDeviceSpec
The AJA device to use.
#define false
bool WithTimecode(void) const
uint32_t ULWord
Definition: ajatypes.h:223
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1357
std::string fDeviceSpec2
Second AJA device to use (Burn4KQuadrant or BurnBoardToBoard only)
AJALabelValuePairs Get(const bool inCompact=(0)) const
Renders a human-readable representation of me.
struct PlayerConfig PlayerConfig
Configures an NTV2Player instance.
uint8_t * fVideoBufferUnaligned
For future use.
uint32_t fAudioRecordSize
For future use.
bool fWithAudio
If true, also capture Audio.
NTV2ACFrameRange fOutputFrames
Playout frame count or range.
This struct replaces the old RP188_STRUCT.
std::ostream & operator<<(std::ostream &ioStrm, const CaptureConfig &inObj)
A handy class that makes it easy to "bounce" an unsigned integer value between a minimum and maximum ...
NTV2Channel fInputChannel
The device channel to use.
NTV2OutputDest fOutputDest
The device output connector to use (NTV2_OUTPUTDESTINATION_INVALID means unspecified) ...
NTV2Channel ISrcCh(void) const
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 WithAudio(void) const
AutoCirculate Frame Range.
Definition: ntv2utils.h:971
std::string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:7377
NTV2PixelFormat fPixelFormat
The pixel format to use.
NTV2Channel NTV2OutputDestinationToChannel(const NTV2OutputDestination inOutputDest)
Converts a given NTV2OutputDestination to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5155
NTV2Channel fOutputChannel
The output channel to use.
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:412
#define true
bool fTransmitLTC
If true, embed LTC; otherwise embed VITC.
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
std::string fAncDataFilePath
Optional path to Anc binary data file.
UWord fNumAudioLinks
The number of audio systems to control for multi-link audio (4K/8K)
This class is used to configure an NTV2Capture instance.
bool WithTallVANC(void) const
ULWord AncBufferSize(void) const
bool fIsFieldMode
True if Field Mode, otherwise Frame Mode.
NTV2Buffer & AncBuffer2(void)
_NTV2VideoFormatKind
virtual const NTV2StringList & otherArgs(void) const
NTV2ACFrameRange ACFrameRange
Declares the CRP188 class. See SMPTE RP188 standard for details.
NTV2Buffer & AncBuffer(void)
bool WithHanc(void) const
NTV2PixelFormat fPixelFormat
The pixel format to use.
T Value(void) const
std::vector< std::string > NTV2StringList
Definition: ntv2utils.h:1155
_NTV2PixelFormatKind
uint32_t * fAudioBuffer
Pointer to host audio buffer.
virtual const std::string & errorStr(void) const
bool FieldMode(void) const
virtual bool isGood(void) const
bool fDoABConversion
If true, do level-A/B conversion; otherwise don&#39;t.
ULWord NumCapturedAudioBytes(void) const
std::set< NTV2AudioSystem > NTV2AudioSystemSet
A set of distinct NTV2AudioSystem values. New in SDK 16.2.
NTV2VideoFormat fVideoFormat
The video format to use.
bool HasTimecode(const NTV2TCIndex inTCNdx) const
bool Reset(void)
NTV2Buffer & VideoBuffer(void)
Configures an NTV2Burn or NTV2FieldBurn instance.
NTV2Buffer fAncBuffer
Host ancillary data buffer.
bool fDoRGBOnWire
If true, produce RGB on the wire; otherwise output YUV.
ULWord fNumAnc2Bytes
Actual number of captured F2 anc bytes.
bool ISrcIsSDI(void) const
This structure encapsulates the video, audio and anc buffers used in the AutoCirculate demos...
NTV2OutputDest fOutputDest
The desired output connector to use.
bool IsVerbose(void) const
ULWord NTV2PixelFormatKinds
bool HasValidTimecode(const NTV2TCIndex inTCNdx) const
UWord fNumAudioLinks
Number of audio links to capture.
NTV2Buffer fAncBuffer2
Additional "F2" host anc buffer.
std::string fDeviceSpec
The AJA device to use.
CaptureConfig(const std::string &inDeviceSpec="0")
Constructs a default NTV2Capture configuration.
#define NTV2_OUTPUT_DEST_IS_SDI(_dest_)
Definition: ntv2enums.h:1346
NTV2Buffer & VideoBuffer2(void)
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.).
std::map< NTV2TCIndex, NTV2_RP188 > NTV2TimeCodes
A mapping of NTV2TCIndex enum values to NTV2_RP188 structures.
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
std::string OChStr(void) const
ULWord fNumAncBytes
Actual number of captured F1 anc bytes.
A set of common convenience functions used by the NTV2 Demonstration Applications. Most are used for converting a command line argument into NTV2VideoFormat, NTV2FrameBufferFormat, etc. types.
ULWord VideoBufferSize2(void) const
NTV2Buffer & AudioBuffer(void)
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1262
uint32_t * fVideoBuffer
Pointer to host video buffer.
std::vector< NTV2FrameData > NTV2FrameDataArray
A vector of NTV2FrameData elements.
virtual int parseResult(void) const
Declaration of AJACircularBuffer template class.
uint32_t fAudioBufferSize
Size of host audio buffer, in bytes.
Declares the AJAWavWriter class.
uint32_t * fVideoBuffer2
Pointer to an additional host video buffer, usually field 2.
NTV2InputSource fInputSource
The device input connector to use.
#define AJAExport
Definition: export.h:33
bool fDoTsiRouting
If true, enable TSI routing; otherwise route for square division (4K/8K)
bool WithAudio(void) const
NTV2Channel fOutputChannel
The device channel to use.
static const size_t CIRCULAR_BUFFER_SIZE(10)
Number of NTV2FrameData&#39;s in our ring.
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
Declares numerous NTV2 utility functions.
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
Declares the AJASystemInfo class.
bool fDoMultiFormat
If true, enables device-sharing; otherwise takes exclusive control of the device. ...
AJACircularBuffer< NTV2FrameData * > FrameDataRingBuffer
Buffer ring of NTV2FrameData&#39;s.
bool fVerbose
If true, emit explanatory messages to stdout/stderr. Defaults to false.
uint32_t * fAncF2Buffer
Pointer to "Field 2" ANC buffer.
uint32_t fAncF2BufferSize
Size of "Field 2" ANC buffer, in bytes.
bool WithAnc(void) const
NTV2ACFrameRange fInputFrames
Ingest frame count or range.
bool fSuppressVideo
If true, suppress video; otherwise include video.
uint16_t UWord
Definition: ajatypes.h:221
Specifies channel or FrameStore 1 (or the first item).
Definition: ntv2enums.h:1359
uint32_t fAncBufferSize
Size of ANC buffer, in bytes.
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
NTV2VANCMode
These enum values identify the available VANC modes.
Definition: ntv2enums.h:3797
TimecodeFormat
Definition: ntv2rp188.h:22
NTV2PixelFormat fPixelFormat
Pixel format to use.
bool OutputSpecified(void) const
NTV2Channel ODstCh(void) const
NTV2Buffer fVideoBuffer2
Additional host video buffer, usually F2.
Declares the AJAAncillaryData class.
ULWord NTV2VideoFormatKinds
Declares the CNTV2Card class.
I encapsulate the video, audio and anc host buffers used in the AutoCirculate demos. I&#39;m a more modern version of the AVDataBuffer.
NTV2Buffer fVideoBuffer
Host video buffer.
enum NTV2OutputDestination NTV2OutputDest
NTV2Channel fInputChannel
The input channel to use.
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
NTV2TCIndex fTimecodeSource
Timecode source to use.
Private include file for all ajabase sources.
Configures an NTV2Player instance.
std::vector< NTV2Channel > NTV2ChannelList
An ordered sequence of NTV2Channel values.
std::string ISrcStr(void) const
std::string fDeviceSpec
The AJA device to use.
std::map< NTV2InputXptID, NTV2OutputXptID > NTV2XptConnections
_NTV2TCIndexKinds
uint32_t fAncRecordSize
For future use.
uint32_t * fAncBuffer
Pointer to ANC buffer.
enum _NTV2VideoFormatKind NTV2VideoFormatKind
bool fWithHanc
If true, capture & play HANC data, including audio (LLBurn). Defaults to false.
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1283
bool WithVideo(void) const
BurnConfig(const std::string &inDeviceSpecifier="0")
Constructs a default Player configuration.
uint32_t fVideoBufferSize
Size of host video buffer, in bytes.
Declares the enumeration constants used in the ajabase library.
Declares enums and structs used by all platform drivers and the SDK.
NTV2FrameDataArray::iterator NTV2FrameDataArrayIter
Handy non-const iterator.
void SetIncrement(const T inValue)
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1269
AJA_FrameRate
Definition: videotypes.h:210
virtual void ToString(std::string &outAllLabelsAndValues) const
Answers with a multi-line string that contains the complete host system info table.
RP188_STRUCT fRP188Data
For future use.
NTV2TimeCodes fTimecodes
Map of TC indexes to NTV2_RP188 values.
NTV2Buffer fAudioBuffer
Host audio buffer.
SDI 1 embedded VITC.
Definition: ntv2enums.h:3954
bool fDoHDMIOutput
If true, enable HDMI output; otherwise, disable HDMI output.
bool fSuppressVideo
If true, suppress video; otherwise generate & xfer test patterns.
bool WithVideo(void) const
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3799
Bouncer(const T inUpperLimit, const T inLowerLimit=T(0), const T inStartValue=T(0), const bool inStartAscend=(!(0)))
Specifies channel or FrameStore 3 (or the 3rd item).
Definition: ntv2enums.h:1361
bool ODstIsSDI(void) const
ULWord NTV2IOKinds
Definition: ntv2enums.h:1310
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:223
bool fDoTSIRouting
If true, do TSI routing; otherwise squares.
std::string fAncDataFilePath
Optional path to Anc binary data file to playout.
NTV2InputSource fInputSource
The device input connector to use.