AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
ntv2captiondecoder608.h
Go to the documentation of this file.
1 
7 #ifndef __NTV2_CEA608_DECODER_
8 #define __NTV2_CEA608_DECODER_
9 
12 #include "ntv2formatdescriptor.h"
14 #include <string>
15 #include <vector>
16 
17 #ifdef AJAMac
18  #define odprintf printf
19 #endif // AJAMac
20 
21 #ifdef MSWindows
22  #include "windows.h"
23  #include "stdio.h"
24 #endif
25 
26 
66 
68 {
69  // Class Methods
70  public:
76  static bool Create (CNTV2CaptionDecoder608Ptr & outEncoder);
77 
83  static const int CharacterFlashCycleFrames = 30;
84 
85  // Instance Methods
86  public:
90 
95  virtual void Reset (void);
96 
102  virtual bool SetDisplayChannel (const NTV2Line21Channel inChannel);
103 
108  virtual inline NTV2Line21Channel GetDisplayChannel (void) const {return mDisplayChannel;}
109 
110 
117  virtual void IdleFrame (void);
118 
119 
128  virtual bool ProcessNew608FrameData (const CaptionData & inCC608Data);
130 
134 
146  virtual UByte GetOnAirCharacterWithAttributes (const UWord inRow,
147  const UWord inCol,
148  NTV2Line21Attrs & outAttrs) const;
149 
161  virtual UWord GetOnAirUTF16CharacterWithAttributes (const UWord inRow,
162  const UWord inCol,
163  NTV2Line21Attrs & outAttrs) const;
164 
165 
177  virtual std::string GetOnAirCharacter (const UWord inRow,
178  const UWord inCol,
179  NTV2Line21Attrs & outAttrs) const;
180 
191  virtual inline std::string GetOnAirCharacter (const UWord inRow, const UWord inCol) const
192  {NTV2Line21Attrs atrs; return GetOnAirCharacter(inRow, inCol, atrs);}
193 
205  virtual std::string GetOnAirCharacters (const UWord inRowNumber = 0) const;
207 
211 
219  virtual bool BurnCaptions (NTV2Buffer & inFB, const NTV2FormatDesc & inFD); // New in SDK 16.0
221 
225 
231  virtual UWord GetTextModeDisplayRowCount (const NTV2Line21Channel inChannel);
232 
240  virtual bool SetTextModeDisplayRowCount (const NTV2Line21Channel inChannel, const UWord inNumRows);
241 
248  virtual const NTV2Line21Attrs & GetTextModeDisplayAttributes (const NTV2Line21Channel inChannel) const;
249 
257  virtual bool SetTextModeDisplayAttributes (const NTV2Line21Channel inChannel,
258  const NTV2Line21Attrs & inAttrs);
260 
261 
265 
274  virtual bool SubscribeChangeNotification (NTV2Caption608Changed * pInCallback,
275  void * pInUserData = AJA_NULL);
276 
283  virtual bool UnsubscribeChangeNotification (NTV2Caption608Changed * pInCallback,
284  void * pInUserData = AJA_NULL);
286 
291  virtual inline bool IsFlashCycleOff (void) const {return mFlashCount > CharacterFlashCycleFrames / 2;}
292 
296  virtual ~CNTV2CaptionDecoder608 ();
297 
298  virtual NTV2CaptionLogMask SetLogMask (const NTV2CaptionLogMask inLogMask);
299 
300 
301 #if !defined(NTV2_DEPRECATE_16_0)
302  virtual NTV2_DEPRECATED_f(bool BurnCaptions (UByte* pBuf, const NTV2FrameDimensions fd, const NTV2PixelFormat pf, const UWord rb));
303 #endif // !defined(NTV2_DEPRECATE_16_0)
304 #if !defined(NTV2_DEPRECATE_16_2)
305  static NTV2_DEPRECATED_f(CaptionData DecodeCaptionData (const UByte* pFB, const NTV2PixelFormat pf, const NTV2VideoFormat vf, const NTV2FrameGeometry fg = NTV2_FG_720x486));
306 #endif // !defined(NTV2_DEPRECATE_16_2)
307 
308 
309  // PRIVATE INSTANCE METHODS
310  private:
311  virtual bool New608FieldData (const UByte inCharP1, const UByte inCharP2, const NTV2Line21Field inField);
312  virtual bool ParseCaptionData (const UByte inCharP1, const UByte inCharP2, const NTV2Line21Field inField, const NTV2Line21Channel inChannel);
313  virtual bool ParseXDSData (const UByte inCharP1, const UByte inCharP2, const NTV2Line21Field inField, const NTV2Line21Channel inChannel);
314 
315  virtual NTV2Line21Channel GetCaptionChannel (const UByte inCharP1, const UByte inCharP2, const NTV2Line21Field inField);
316 
317  // Hidden constructors & assignment operators
318  explicit CNTV2CaptionDecoder608 ();
319  explicit inline CNTV2CaptionDecoder608 (const CNTV2CaptionDecoder608 & inDecoderToCopy);
320  virtual CNTV2CaptionDecoder608 & operator = (const CNTV2CaptionDecoder608 & inDecoderToCopy);
321  public:
325  virtual void DebugPrintCurrentScreen (const bool inAllChannels = false, const bool inShowChars = true, const bool inShowTextChannels = false);
327  virtual void SetDebugRowsOfInterest (const NTV2Line21Channel inChannel, const UWord inFromRow, const UWord inToRow, const bool inAdd = false);
328  virtual void SetDebugColumnsOfInterest (const NTV2Line21Channel inChannel, const UWord inFromCol, const UWord inToCol, const bool inAdd = false);
330  virtual CNTV2CaptionDecodeChannel608Ptr Get608ChannelDecoder (const NTV2Line21Channel inChannel) const;
331 
335  static bool UseNewBurnCaptionsMethod;
337  static bool RenderPrePostSpaces;
338  static bool AutoCallIdleFrame;
339  static bool AutoFlashOnAirChars;
340 
342  private:
343  virtual void Handle608ChangeNotification (const NTV2Caption608ChangeInfo & inChangeInfo) const;
344  static void NTV2Caption608ChangeHandler (void * pInstance, const NTV2Caption608ChangeInfo & inChangeInfo);
345 
346 
347  // INSTANCE DATA
348  private:
349  typedef std::vector <CNTV2CaptionDecodeChannel608Ptr> ChannelDecoderArray;
350 
351  NTV2Line21Channel mDisplayChannel;
352  NTV2Line21Channel mCurrXmitChannel [2];
353 
354  ChannelDecoderArray mChannelDecoders;
355 
357  CNTV2XDSDecodeChannel608Ptr mXDSDecode;
358 
359  unsigned short mLastControlCode [2];
360  UWord mRollOffset;
361  UWord mFlashCount;
362  NTV2Caption608Changed * mpChangeSubscriber;
363  void * mpSubscriberData;
364  #if defined (AJA_DEBUG)
365  public:
366  static bool ClassTest (void);
367  protected:
368  bool InstanceTest (void);
369  #endif // AJA_DEBUG
370 
371 }; // CNTV2CaptionDecoder608
372 
373 #endif // __NTV2_CEA608_DECODER_
CNTV2CaptionDecoder608::AutoCallIdleFrame
static bool AutoCallIdleFrame
Default is false. If true, ProcessNew608FrameData will automatically call IdleFrame.
Definition: ntv2captiondecoder608.h:338
NTV2FrameDimensions
Describes the horizontal and vertical size dimensions of a raster, bitmap, frame or image.
Definition: ntv2publicinterface.h:5658
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:5993
AJARefPtr< CNTV2CaptionDecoder608 >
CNTV2CaptionDecoder608::IsFlashCycleOff
virtual bool IsFlashCycleOff(void) const
Definition: ntv2captiondecoder608.h:291
CNTV2CaptionDecoder608::AutoFlashOnAirChars
static bool AutoFlashOnAirChars
Default is false. If true, GetOnAir... functions will automatically "flash" (periodically return spac...
Definition: ntv2captiondecoder608.h:339
NTV2FrameBufferFormat
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
Definition: ntv2enums.h:207
CNTV2CaptionDecoder608Ptr
AJARefPtr< CNTV2CaptionDecoder608 > CNTV2CaptionDecoder608Ptr
Definition: ntv2captiondecoder608.h:64
NTV2_FG_720x486
@ NTV2_FG_720x486
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:341
ntv2xdscaptiondecodechannel608.h
Declares the CNTV2XDSDecodeChannel608 class.
NTV2Caption608ChangeInfo
This class is used to respond to dynamic events that occur during CEA-608 caption decoding.
Definition: ntv2caption608types.h:779
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
UWord
uint16_t UWord
Definition: ajatypes.h:251
CNTV2CaptionDecoder608::RenderPrePostSpaces
static bool RenderPrePostSpaces
Default is true. If true, BurnCaptions leads & follows character runs with blank space.
Definition: ntv2captiondecoder608.h:337
ntv2captiondecodechannel608.h
Declares the CNTV2CaptionDecodeChannel608 class.
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:197
ntv2formatdescriptor.h
Declares the NTV2FormatDescriptor class.
NTV2Caption608Changed
void() NTV2Caption608Changed(void *pInstance, const NTV2Caption608ChangeInfo &inChangeInfo)
This callback is used to respond to dynamic events that occur during CEA-608 caption decoding.
Definition: ntv2caption608types.h:872
NTV2_DEPRECATED_f
#define NTV2_DEPRECATED_f(__f__)
Definition: ajatypes.h:553
UByte
uint8_t UByte
Definition: ajatypes.h:248
NTV2Line21Channel
NTV2Line21Channel
The CEA-608 caption channels: CC1 thru CC4, TX1 thru TX4, plus XDS.
Definition: ntv2caption608types.h:82
AJAExport
#define AJAExport
Definition: export.h:33
NTV2VideoFormat
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
NTV2FrameGeometry
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:336
NTV2CaptionLogMask
uint64_t NTV2CaptionLogMask
Selectors to control what information is logged.
Definition: ntv2captionlogging.h:38
CNTV2CaptionLogConfig
Definition: ntv2captionlogging.h:77
NTV2Line21Field
NTV2Line21Field
The two CEA-608 interlace fields.
Definition: ntv2caption608types.h:56
NTV2Line21Attributes
CEA-608 Character Attributes.
Definition: ntv2caption608types.h:357
CaptionData
This structure encapsulates all possible CEA-608 caption data bytes that may be associated with a giv...
Definition: ntv2caption608types.h:655
CNTV2CaptionDecoder608
Definition: ntv2captiondecoder608.h:67
ajarefptr.h
Defines the AJARefPtr template class.
CNTV2CaptionDecoder608::GetOnAirCharacter
virtual std::string GetOnAirCharacter(const UWord inRow, const UWord inCol) const
Retrieves the "on-air" character at the given on-screen row and column position.
Definition: ntv2captiondecoder608.h:191
CNTV2CaptionDecoder608::GetDisplayChannel
virtual NTV2Line21Channel GetDisplayChannel(void) const
Answers with the caption channel that I'm currently focused on (or that I'm currently "burning" into ...
Definition: ntv2captiondecoder608.h:108