AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
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_
CNTV2CaptionLogConfig::mpLabelLock
void * mpLabelLock
Protects my debug label from simultaneous access by more than one thread.
Definition: ntv2captionlogging.h:233
Line21ColumnSetConstIter
Line21RowSetConstIter Line21ColumnSetConstIter
A const iterator for a Line21ColumnSet.
Definition: ntv2captionlogging.h:58
SetDefaultCaptionLogMask
void SetDefaultCaptionLogMask(const NTV2CaptionLogMask inMask)
Sets the default log mask that will be used by newly-created objects in the caption library.
kCaptionLog_608ShowAllScreens
const uint64_t kCaptionLog_608ShowAllScreens(0x0000000000010000)
Log screens for all 608 channels.
kCaptionLog_Line21DetectSuccess
const uint64_t kCaptionLog_Line21DetectSuccess(0x0000000000000100)
Log line 21 waveform detect successes.
GetDefaultCaptionLogMask
NTV2CaptionLogMask GetDefaultCaptionLogMask(void)
Answers with the default log mask used when creating new objects in the caption library.
kCaptionLog_Line21DecodeFail
const uint64_t kCaptionLog_Line21DecodeFail(0x0000000000000800)
Log line 21 waveform decode failures.
kCaptionLog_608ShowScreenAttrs
const uint64_t kCaptionLog_608ShowScreenAttrs(0x0000000000020000)
Log screen attributes for 608 channel of interest.
GetDefaultCaptionLogOutputStream
std::ostream & GetDefaultCaptionLogOutputStream(void)
kCaptionLog_Decode608
const uint64_t kCaptionLog_Decode608(0x0000000000000001)
Log decode (input) 608 events.
CNTV2CaptionLogConfig::mLogLabel
std::string mLogLabel
My debug label.
Definition: ntv2captionlogging.h:232
SetDefaultCaptionLogOutputStream
void SetDefaultCaptionLogOutputStream(std::ostream &inOutputStream)
ajatypes.h
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
Line21ColumnSet
Line21RowSet Line21ColumnSet
A set of caption column numbers.
Definition: ntv2captionlogging.h:56
CNTV2CaptionLogConfig::GetLogMask
virtual NTV2CaptionLogMask GetLogMask(void) const
Answers with my current caption logging bit mask.
Definition: ntv2captionlogging.h:193
Line21RowSet
std::set< int > Line21RowSet
A set of caption row numbers.
Definition: ntv2captionlogging.h:55
CNTV2CaptionLogConfig::SetLogMask
virtual NTV2CaptionLogMask SetLogMask(const NTV2CaptionLogMask inLogMask)
Specifies what, if any, debug information I will write to my log stream.
Definition: ntv2captionlogging.h:187
kCaptionLog_All
const uint64_t kCaptionLog_All(0xFFFFFFFFFFFFFFFF)
Log everything possible.
kCaptionLog_DecodeXDS
const uint64_t kCaptionLog_DecodeXDS(0x0000000000000002)
Log decode (input) XDS info.
kCaptionLog_Line21DecodeSuccess
const uint64_t kCaptionLog_Line21DecodeSuccess(0x0000000000000400)
Log line 21 waveform decode successes.
UByte
uint8_t UByte
Definition: ajatypes.h:241
kCaptionLog_Off
const uint64_t kCaptionLog_Off(0x0000000000000000)
Don't log anything.
Line21RowSetConstIter
Line21RowSet::const_iterator Line21RowSetConstIter
A const iterator for a Line21RowSet.
Definition: ntv2captionlogging.h:57
kCaptionLog_Line21DetectFail
const uint64_t kCaptionLog_Line21DetectFail(0x0000000000000200)
Log line 21 waveform detect failures.
AJAExport
#define AJAExport
Definition: export.h:33
NTV2CaptionLogMask
uint64_t NTV2CaptionLogMask
Selectors to control what information is logged.
Definition: ntv2captionlogging.h:38
true
#define true
Definition: ntv2devicefeatures.h:26
kCaptionLog_DecodeVANC
const uint64_t kCaptionLog_DecodeVANC(0x0000000000100000)
Log decode (input) VANC data.
CNTV2CaptionLogConfig
Definition: ntv2captionlogging.h:77
ntv2publicinterface.h
Declares enums and structs used by all platform drivers and the SDK.
CNTV2CaptionLogConfig::TestLogMask
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.
Definition: ntv2captionlogging.h:202
kCaptionLog_608ShowScreen
const uint64_t kCaptionLog_608ShowScreen(0x0000000000008000)
Log screen for 608 channel of interest.
CNTV2CaptionLogConfig::mLogMask
NTV2CaptionLogMask mLogMask
Determines what messages are logged.
Definition: ntv2captionlogging.h:231
Line21RowSetToString
std::string Line21RowSetToString(const Line21RowSet &inRowSet)
kCaptionLog_DecodeCDP
const uint64_t kCaptionLog_DecodeCDP(0x0000000000200000)
Log decode (input) CDP data.