AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2captionlogging.h
Go to the documentation of this file.
1 
7 #ifndef __NTV2_CAPTIONLOGGING_
8 #define __NTV2_CAPTIONLOGGING_
9 
10 #include "ajatypes.h"
11 #include "ntv2publicinterface.h"
12 #ifdef MSWindows
13  #include "windows.h"
14  #include "stdio.h"
15 #else
16  #include <stdint.h>
17 #endif
18 #include <string>
19 #include <iostream>
20 #include <set>
21 
22 #if !defined(NULL)
23  #define NULL 0
24 #endif
25 
26 
27 // The 'ajacc' library can use whatever 'assert' facility is desired.
28 #define AJACC_ASSERT NTV2_ASSERT
29 
30 // For debugging...
31 #define UHEX2(_c_) HEX0N(uint16_t(_c_),2)
32 #define HEX4(_uword_) HEX0N((_uword_),4)
33 
34 
38 typedef uint64_t NTV2CaptionLogMask;
39 
40 const uint64_t kCaptionLog_All (0xFFFFFFFFFFFFFFFF);
41 const uint64_t kCaptionLog_Off (0x0000000000000000);
42 const uint64_t kCaptionLog_Decode608 (0x0000000000000001);
43 const uint64_t kCaptionLog_DecodeXDS (0x0000000000000002);
44 const uint64_t kCaptionLog_Line21DetectSuccess (0x0000000000000100);
45 const uint64_t kCaptionLog_Line21DetectFail (0x0000000000000200);
46 const uint64_t kCaptionLog_Line21DecodeSuccess (0x0000000000000400);
47 const uint64_t kCaptionLog_Line21DecodeFail (0x0000000000000800);
48 const uint64_t kCaptionLog_608ShowScreen (0x0000000000008000);
49 const uint64_t kCaptionLog_608ShowAllScreens (0x0000000000010000);
50 const uint64_t kCaptionLog_608ShowScreenAttrs (0x0000000000020000);
51 const uint64_t kCaptionLog_DecodeVANC (0x0000000000100000);
52 const uint64_t kCaptionLog_DecodeCDP (0x0000000000200000);
53 
54 // For debugging rows/columns-of-interest:
55 typedef std::set <int> Line21RowSet;
57 typedef Line21RowSet::const_iterator Line21RowSetConstIter;
59 
60 AJAExport std::string Line21RowSetToString (const Line21RowSet & inRowSet); // std::ostream & operator << (std::ostream & inOutStream, const Line21RowSet & inData);
61 #define Line21ColumnSetToString Line21RowSetToString
62 
69 
75 
76 
78 {
79  // CLASS METHODS
80  public:
97  static std::ostream & DumpMemory (const void * pInStartAddress,
98  const size_t inByteCount,
99  std::ostream & inOutputStream = std::cout,
100  const size_t inRadix = 16,
101  const size_t inBytesPerGroup = 4,
102  const size_t inGroupsPerLine = 8,
103  const size_t inAddressRadix = 16,
104  const bool inShowAscii = true,
105  const size_t inAddrOffset = 0);
106 
113  static std::string HexDump32Bytes (const void * pInStartAddress, const size_t inByteCount, const size_t inLimitBytes = 32);
114 
134  static std::ostream & DumpYBytes_2vuy (const UByte * pInVideoLine,
135  std::ostream & inOutputStream,
136  const unsigned inFromPixel = 0,
137  const unsigned inToPixel = 719,
138  const bool inShowRuler = true,
139  const unsigned inHiliteRangeFrom = 9999,
140  const unsigned inHiliteRangeTo = 9999);
141 
161  static std::ostream & DumpYBytes_2vuy (const std::vector<uint8_t> & inVideoLine,
162  std::ostream & inOutputStream,
163  const size_t inFromPixel = 0,
164  const size_t inToPixel = 719,
165  const bool inShowRuler = true,
166  const size_t inHiliteRangeFrom = 9999,
167  const size_t inHiliteRangeTo = 9999);
168 
169  static std::string GetSeverityLabel(const unsigned inSeverity);
170 
171 
172  // INSTANCE METHODS
173  public:
178  CNTV2CaptionLogConfig (const std::string inLogLabel = std::string ());
179 
180  virtual ~CNTV2CaptionLogConfig ();
181 
182  // Debug Output Control
187  virtual inline NTV2CaptionLogMask SetLogMask (const NTV2CaptionLogMask inLogMask) {const NTV2CaptionLogMask tmp (mLogMask); mLogMask = inLogMask; return tmp;}
188 
193  virtual inline NTV2CaptionLogMask GetLogMask (void) const {return mLogMask;}
194 
202  virtual inline bool TestLogMask (const NTV2CaptionLogMask inLogMask, const bool inExact = false) const {if (inExact) return (GetLogMask() & inLogMask) == inLogMask; else return (GetLogMask() & inLogMask) ? true : false;}
203 
208  virtual void SetLogLabel (const std::string & inNewLabel);
209 
214  virtual void AppendToLogLabel (const std::string & inString);
215 
220  virtual const std::string & GetLogLabel (void) const;
221 
222 
223  // OBSOLETE FUNCTIONS
224  virtual void SetLogStream (std::ostream & inOutputStream);
225  virtual std::ostream & LogIf (const NTV2CaptionLogMask inLogMask) const;
226  virtual std::ostream & Log (void) const;
227 
228 
229  // INSTANCE DATA
230  protected:
232  std::string mLogLabel;
233  mutable void * mpLabelLock;
234 
235 }; // CNTV2CaptionLogConfig
236 
237 
238 // OBSOLETE
239 AJAExport void SetDefaultCaptionLogOutputStream (std::ostream & inOutputStream);
240 AJAExport std::ostream & GetDefaultCaptionLogOutputStream (void);
241 
242 #endif // __NTV2_CAPTIONLOGGING_
const uint64_t kCaptionLog_DecodeXDS(0x0000000000000002)
Log decode (input) XDS info.
const uint64_t kCaptionLog_Line21DecodeSuccess(0x0000000000000400)
Log line 21 waveform decode successes.
const uint64_t kCaptionLog_Off(0x0000000000000000)
Don&#39;t log anything.
Line21RowSet::const_iterator Line21RowSetConstIter
A const iterator for a Line21RowSet.
virtual NTV2CaptionLogMask GetLogMask(void) const
Answers with my current caption logging bit mask.
void * mpLabelLock
Protects my debug label from simultaneous access by more than one thread.
const uint64_t kCaptionLog_DecodeVANC(0x0000000000100000)
Log decode (input) VANC data.
const uint64_t kCaptionLog_Line21DetectFail(0x0000000000000200)
Log line 21 waveform detect failures.
uint64_t NTV2CaptionLogMask
Selectors to control what information is logged.
#define true
const uint64_t kCaptionLog_608ShowScreen(0x0000000000008000)
Log screen for 608 channel of interest.
std::string mLogLabel
My debug label.
std::string Line21RowSetToString(const Line21RowSet &inRowSet)
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
const uint64_t kCaptionLog_DecodeCDP(0x0000000000200000)
Log decode (input) CDP data.
Line21RowSetConstIter Line21ColumnSetConstIter
A const iterator for a Line21ColumnSet.
const uint64_t kCaptionLog_608ShowAllScreens(0x0000000000010000)
Log screens for all 608 channels.
const uint64_t kCaptionLog_Line21DetectSuccess(0x0000000000000100)
Log line 21 waveform detect successes.
uint8_t UByte
Definition: ajatypes.h:218
NTV2CaptionLogMask GetDefaultCaptionLogMask(void)
Answers with the default log mask used when creating new objects in the caption library.
void SetDefaultCaptionLogMask(const NTV2CaptionLogMask inMask)
Sets the default log mask that will be used by newly-created objects in the caption library...
#define AJAExport
Definition: export.h:33
std::ostream & GetDefaultCaptionLogOutputStream(void)
const uint64_t kCaptionLog_Line21DecodeFail(0x0000000000000800)
Log line 21 waveform decode failures.
const uint64_t kCaptionLog_Decode608(0x0000000000000001)
Log decode (input) 608 events.
const uint64_t kCaptionLog_608ShowScreenAttrs(0x0000000000020000)
Log screen attributes for 608 channel of interest.
void SetDefaultCaptionLogOutputStream(std::ostream &inOutputStream)
virtual NTV2CaptionLogMask SetLogMask(const NTV2CaptionLogMask inLogMask)
Specifies what, if any, debug information I will write to my log stream.
Line21RowSet Line21ColumnSet
A set of caption column numbers.
virtual bool TestLogMask(const NTV2CaptionLogMask inLogMask, const bool inExact=false) const
Answers true if the given log mask bits are set in my current log mask.
Declares enums and structs used by all platform drivers and the SDK.
std::set< int > Line21RowSet
A set of caption row numbers.
const uint64_t kCaptionLog_All(0xFFFFFFFFFFFFFFFF)
Log everything possible.
NTV2CaptionLogMask mLogMask
Determines what messages are logged.