AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2caption608message.h
Go to the documentation of this file.
1 
7 #ifndef __NTV2_CAPTION608MESSAGE__
8 #define __NTV2_CAPTION608MESSAGE__
9 
10 #include "ntv2captionlogging.h"
11 #include "ntv2caption608types.h"
13 #include <string>
14 #include <iostream>
15 
16 
18 {
19  NTV2_CC608_CaptionMsgType_Data = 0, // message contains data to be transmitted
20  NTV2_CC608_CaptionMsgType_Delay = 1 // message contains frame count
21 
23 
24 
35 
37 {
38  friend class CNTV2CaptionEncoder608;
40 
41  // Class Data
42  protected:
43  static const UWord NTV2_CC608_CaptionMsgMaxBytes = 256;
44 
45 
46  // Class Methods
47  protected:
48  static bool Create (CNTV2Caption608MessagePtr & outNewInstance,
49  const NTV2Line21Channel inChannel,
51 
52 
53  // Instance Methods
54  protected:
55  // Construction & Destruction
56  explicit CNTV2Caption608Message (const NTV2Line21Channel inChannel,
58  public: virtual inline ~CNTV2Caption608Message () {}
59 
60  public:
66  virtual std::ostream & Print (std::ostream & inOutStream) const;
67 
68  protected:
69  // Inquiry
70  virtual inline NTV2_CC608_CaptionMessageType GetType (void) const {return mType;}
71  virtual inline NTV2Line21Channel GetChannel (void) const {return mChannel;}
72  virtual inline bool HasData (void) const {return GetLength () > 0;}
73  virtual inline bool IsData (void) const {return GetType () == NTV2_CC608_CaptionMsgType_Data;}
74  virtual inline bool IsDelay (void) const {return GetType () == NTV2_CC608_CaptionMsgType_Delay;}
75  virtual inline bool IsLowPriority (void) const {return !IsLine21CaptionChannel (GetChannel ());}
76  virtual inline bool IsHighPriority (void) const {return IsLine21CaptionChannel (GetChannel ());}
77  virtual inline UWord GetLength (void) const {return mLength;}
78  virtual inline UWord GetBytesRemaining (void) const {return IsPastEnd () ? 0 : GetLength () - GetReadPosition ();}
79  virtual inline UWord GetRemainingByteCapacity (void) const {return NTV2_CC608_CaptionMsgMaxBytes - GetLength ();}
80 
81 
82  // Readers
83 
88  virtual UByte ReadNext (void);
89 
90 
94  virtual inline void SkipNext (void) {if (mReadPosition < mLength) mReadPosition++;}
95 
96 
100  virtual inline UWord GetReadPosition (void) const {return mReadPosition;}
101 
102 
106  virtual inline bool IsPastEnd (void) const {return GetReadPosition () >= GetLength ();}
107 
108 
109  // Writers
110 
116  virtual bool Add608Command (const UWord inCommand);
117 
124  virtual bool Add608String (const std::string & inMessageStr);
125 
132  virtual bool AddBytePair (const UByte inByte1, const UByte inByte2);
133 
134 
135  private:
136  virtual CNTV2Caption608Message & operator = (const CNTV2Caption608Message & inRHS);
137 
138 
139  // Instance Data
140  private:
142  UWord mLength;
143  UWord mReadPosition;
144  UByte mData [NTV2_CC608_CaptionMsgMaxBytes];
145  const NTV2Line21Channel mChannel;
146 
147 }; // CNTV2Caption608Message
148 
149 
150 // Output stream operators:
151 inline std::ostream & operator << (std::ostream & inOutStream, const CNTV2Caption608Message & inMsg) {return inMsg.Print (inOutStream);}
152 std::ostream & operator << (std::ostream & inOutStream, CNTV2Caption608MessagePtr inMsgPtr);
153 
154 
155 // Backward compatibility
158 
159 
160 #endif // __NTV2_CAPTION608MESSAGE__
NTV2_CC608_CaptionMessageType
virtual bool IsPastEnd(void) const
Returns "true" if my internal read position is past the end; otherwise returns "false".
AJARefPtr< CNTV2Caption608Message > CNTV2Caption608MessagePtr
virtual bool IsHighPriority(void) const
I am a thread-safe queue of caption messages. Internally, I maintain two queues: one for high-priorit...
I am a reference-counted pointer template class. I am intended to be a proxy for an underlying object...
Definition: ajarefptr.h:89
virtual UWord GetRemainingByteCapacity(void) const
Defines the AJARefPtr template class.
#define IsLine21CaptionChannel(_chan_)
std::ostream & operator<<(std::ostream &inOutStream, const CNTV2Caption608Message &inMsg)
virtual bool IsLowPriority(void) const
virtual UWord GetBytesRemaining(void) const
virtual void SkipNext(void)
Increments my internal read position (if not already past end).
CNTV2Caption608Message NTV2CaptionMessage
Declares the NTV2CaptionLogMask, and the CNTV2CaptionLogConfig class.
uint8_t UByte
Definition: ajatypes.h:218
virtual bool IsData(void) const
virtual std::ostream & Print(std::ostream &inOutStream) const
Prints a human-readable representation of me to the given output stream.
#define AJAExport
Definition: export.h:33
virtual UWord GetLength(void) const
virtual bool HasData(void) const
uint16_t UWord
Definition: ajatypes.h:221
CNTV2Caption608MessagePtr CNTV2608MsgPtr
virtual bool IsDelay(void) const
virtual std::ostream & Print(std::ostream &inOutStream, const bool inDumpMessages=true) const
Prints a human-readable representation of me to the given output stream in oldest-to-newest order...
virtual UWord GetReadPosition(void) const
Returns my internal read position.
CNTV2Caption608MessagePtr NTV2CaptionMessagePtr
virtual NTV2Line21Channel GetChannel(void) const
NTV2Line21Channel
The CEA-608 caption channels: CC1 thru CC4, TX1 thru TX4, plus XDS.
Declares several data types used with 608/SD captioning.
virtual NTV2_CC608_CaptionMessageType GetType(void) const