AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
This class handles "analog" (Line 21) based CEA-608 caption data packets. More...
#include <ancillarydata_cea608_line21.h>
Public Member Functions | |
AJAAncillaryData_Cea608_Line21 () | |
My default constructor. More... | |
AJAAncillaryData_Cea608_Line21 (const AJAAncillaryData_Cea608_Line21 &inClone) | |
My copy constructor. More... | |
AJAAncillaryData_Cea608_Line21 (const AJAAncillaryData_Cea608_Line21 *pInClone) | |
My copy constructor. More... | |
AJAAncillaryData_Cea608_Line21 (const AJAAncillaryData *pInData) | |
My copy constructor. More... | |
virtual | ~AJAAncillaryData_Cea608_Line21 () |
My destructor. More... | |
virtual void | Clear (void) |
Frees my allocated memory, if any, and resets my members to their default values. More... | |
virtual AJAAncillaryData_Cea608_Line21 & | operator= (const AJAAncillaryData_Cea608_Line21 &inRHS) |
Assignment operator – replaces my contents with the right-hand-side value. More... | |
virtual AJAStatus | ParsePayloadData (void) |
Parses out (interprets) the "local" ancillary data from my payload data. More... | |
virtual AJAStatus | GeneratePayloadData (void) |
Generate the payload data from the "local" ancillary data. More... | |
Public Member Functions inherited from AJAAncillaryData_Cea608 | |
AJAAncillaryData_Cea608 () | |
My default constructor. More... | |
AJAAncillaryData_Cea608 (const AJAAncillaryData_Cea608 &inClone) | |
My copy constructor. More... | |
AJAAncillaryData_Cea608 (const AJAAncillaryData_Cea608 *pInClone) | |
My copy constructor. More... | |
AJAAncillaryData_Cea608 (const AJAAncillaryData *pInData) | |
My copy constructor. More... | |
virtual | ~AJAAncillaryData_Cea608 () |
My destructor. More... | |
AJAAncillaryData_Cea608 & | operator= (const AJAAncillaryData_Cea608 &inRHS) |
Assignment operator – replaces my contents with the right-hand-side value. More... | |
virtual AJAStatus | SetCEA608Bytes (const uint8_t inByte1, const uint8_t inByte2) |
Set the CEA608 payload bytes. More... | |
virtual AJAStatus | GetCEA608Bytes (uint8_t &outByte1, uint8_t &outByte2, bool &outIsValid) const |
Answers with the CEA608 payload bytes. More... | |
virtual AJAStatus | SetCEA608Characters (const uint8_t inChar1, const uint8_t inChar2) |
Sets the CEA608 payload characters. Uses the least significant 7 bits of the input values and adds odd parity. More... | |
virtual AJAStatus | GetCEA608Characters (uint8_t &outChar1, uint8_t &outChar2, bool &outIsValid) const |
Answers with the CEA608 payload characters. More... | |
virtual std::ostream & | Print (std::ostream &inOutStream, const bool inDetailed=false) const |
Streams a human-readable representation of me to the given output stream. More... | |
Public Member Functions inherited from AJAAncillaryData | |
AJAAncillaryData () | |
My default constructor. More... | |
AJAAncillaryData (const AJAAncillaryData &inClone) | |
My copy constructor (from reference). More... | |
AJAAncillaryData (const AJAAncillaryData *pInClone) | |
My copy constructor (from pointer). More... | |
virtual | ~AJAAncillaryData () |
My destructor. More... | |
virtual AJAAncillaryData * | Clone (void) const |
virtual uint16_t | GetStreamInfo (void) const |
virtual bool | HasStreamInfo (void) const |
virtual bool | isHDMIAuxInfoFrame (void) const |
Returns whether or not this is an HDMI Aux Info Frame Packet. More... | |
virtual uint8_t | Calculate8BitChecksum (void) const |
Generates an 8-bit checksum from the DID + SID + DC + payload data. More... | |
virtual uint16_t | Calculate9BitChecksum (void) const |
Generates the official SMPTE 291 9-bit checksum from the DID + SID + DC + payload data. More... | |
virtual bool | ChecksumOK (void) const |
Compares the received 8-bit checksum with a newly calculated 8-bit checksum. Returns 'true' if they match. More... | |
AJAAncillaryData & | operator= (const AJAAncillaryData &inRHS) |
virtual bool | operator== (const AJAAncillaryData &inRHS) const |
virtual bool | operator!= (const AJAAncillaryData &inRHS) const |
virtual AJAStatus | Compare (const AJAAncillaryData &inRHS, const bool inIgnoreLocation=true, const bool inIgnoreChecksum=true) const |
Compares me with another packet. More... | |
virtual AJAStatus | SetDID (const uint8_t inDataID) |
Sets my Data ID (DID). More... | |
virtual AJAStatus | SetSID (const uint8_t inSID) |
Sets my Secondary Data ID (SID) - (aka the Data Block Number (DBN) for "Type 1" SMPTE-291 packets). More... | |
virtual AJAStatus | SetDIDSID (const AJAAncDIDSIDPair &inDIDSID) |
Sets both my Data ID (DID) and Secondary Data ID (SID). More... | |
virtual AJAStatus | SetChecksum (const uint8_t inChecksum8, const bool inValidate=false) |
Sets my 8-bit checksum. Note that it is not usually necessary to generate an 8-bit checksum, since the ANC Insertion hardware ignores this field and (for SMPTE-291 Anc packets) generates and inserts its own "proper" 9-bit SMPTE-291 checksum. More... | |
virtual AJAStatus | SetDataLocation (const AJAAncDataLoc &inLoc) |
Sets my ancillary data "location" within the video stream. More... | |
virtual AJAStatus | SetLocationVideoLink (const AJAAncDataLink inLink) |
Sets my ancillary data "location" within the video stream. More... | |
virtual AJAStatus | SetLocationDataStream (const AJAAncDataStream inStream) |
Sets my ancillary data "location" data stream value (DS1,DS2...). More... | |
virtual AJAStatus | SetLocationDataChannel (const AJAAncDataChannel inChannel) |
Sets my ancillary data "location" data channel value (Y or C). More... | |
virtual AJAStatus | SetLocationLineNumber (const uint16_t inLineNum) |
Sets my ancillary data "location" frame line number. More... | |
virtual AJAStatus | SetLocationHorizOffset (const uint16_t inOffset) |
Sets my ancillary data "location" horizontal offset. More... | |
virtual AJAStatus | SetDataCoding (const AJAAncDataCoding inCodingType) |
Sets my ancillary data coding type (e.g. digital or analog/raw waveform). More... | |
virtual AJAAncillaryData & | SetFrameID (const uint32_t inFrameID) |
Sets my originating frame identifier. More... | |
virtual AJAAncillaryData & | SetBufferFormat (const AJAAncBufferFormat inFmt) |
Sets my originating buffer format. More... | |
virtual uint8_t | GetPayloadByteAtIndex (const uint32_t inIndex0) const |
virtual const uint8_t * | GetPayloadData (void) const |
virtual AJAStatus | GetPayloadData (uint8_t *pBuffer, const uint32_t inByteCapacity) const |
Copies my payload data into an external buffer. More... | |
virtual AJAStatus | GetPayloadData (UWordSequence &outUDWs, const bool inAddParity=true) const |
Appends my payload data onto the given UDW vector as 10-bit User Data Words (UDWs), adding parity as needed. More... | |
virtual AJAStatus | SetPayloadByteAtIndex (const uint8_t inDataByte, const uint32_t inIndex0) |
virtual AJAStatus | SetPayloadData (const uint8_t *pInData, const uint32_t inByteCount) |
Copy data from external memory into my local payload memory. More... | |
virtual AJAStatus | AppendPayloadData (const uint8_t *pInBuffer, const uint32_t inByteCount) |
Appends data from an external buffer onto the end of my existing payload. More... | |
virtual AJAStatus | AppendPayload (const AJAAncillaryData &inAncData) |
Appends payload data from another AJAAncillaryData object to my existing payload. More... | |
virtual AJAStatus | AppendPayload (const AJAAncillaryData *pInAncData) |
virtual AJAStatus | SetFromSMPTE334 (const uint16_t *pInData, const uint32_t inNumWords, const AJAAncDataLoc &inLocInfo) |
Copies payload data from an external 16-bit source into local payload memory. More... | |
virtual bool | GotValidReceiveData (void) const |
virtual AJAStatus | InitWithReceivedData (const uint8_t *pInData, const size_t inMaxBytes, const AJAAncDataLoc &inLocationInfo, uint32_t &outPacketByteCount) |
Initializes me from "raw" ancillary data received from hardware (ingest) – see SDI Anc Buffer Data Format. More... | |
virtual AJAStatus | InitAuxWithReceivedData (const uint8_t *pInData, const size_t inMaxBytes, uint32_t &outPacketByteCount) |
Initializes me from "raw" ancillary data received from hardware (ingest) – see SDI Anc Buffer Data Format. More... | |
virtual AJAStatus | InitWithReceivedData (const std::vector< uint8_t > &inData, const AJAAncDataLoc &inLocationInfo) |
Initializes me from "raw" ancillary data received from hardware (ingest) – see SDI Anc Buffer Data Format. More... | |
virtual AJAStatus | InitWithReceivedData (const ULWordSequence &inData, uint16_t &inOutStartIndex, const bool inIgnoreChecksum=false) |
Initializes me from the given 32-bit IP packet words received from hardware (ingest). More... | |
virtual AJAStatus | GetRawPacketSize (uint32_t &outPacketSize) const |
Returns the number of "raw" ancillary data bytes that will be generated by AJAAncillaryData::GenerateTransmitData (for playback mode). More... | |
virtual AJAStatus | GenerateTransmitData (uint8_t *pBuffer, const size_t inMaxBytes, uint32_t &outPacketSize) |
Generates "raw" ancillary data from my internal ancillary data (playback) – see SDI Anc Buffer Data Format. More... | |
virtual AJAStatus | GenerateTransmitData (UWordSequence &outData) |
Generates "raw" 10-bit ancillary packet component data from my internal ancillary data (playback). More... | |
virtual AJAStatus | GenerateTransmitData (ULWordSequence &outData) |
Generates the 32-bit IP packet words necessary for constructing an outgoing IP/RTP stream. More... | |
virtual std::ostream & | DumpPayload (std::ostream &inOutStream) const |
Dumps a human-readable representation of my payload bytes into the given output stream. More... | |
virtual std::string | CompareWithInfo (const AJAAncillaryData &inRHS, const bool inIgnoreLocation=true, const bool inIgnoreChecksum=true) const |
Compares me with another packet and returns a string that describes what's different. More... | |
virtual std::string | IDAsString (void) const |
virtual std::string | AsString (const uint16_t inDumpMaxBytes=0) const |
Static Public Member Functions | |
static AJAAncDataType | RecognizeThisAncillaryData (const AJAAncillaryData *pInAncData) |
Static Public Member Functions inherited from AJAAncillaryData_Cea608 | |
static uint8_t | AddOddParity (const uint8_t inValue) |
Set/Clear bit 7 of a byte to make odd parity. More... | |
static AJAAncDataType | RecognizeThisAncillaryData (const AJAAncillaryData *pInAncData) |
Static Public Member Functions inherited from AJAAncillaryData | |
static uint16_t | AddEvenParity (const uint8_t inDataByte) |
static bool | GetAncPacketsFromVANCLine (const UWordSequence &inYUV16Line, const AncChannelSearchSelect inChanSelect, U16Packets &outRawPackets, U16Packet &outWordOffsets) |
Extracts whatever VANC packets are found inside the given 16-bit YUV line buffer. More... | |
static bool | Unpack8BitYCbCrToU16sVANCLine (const void *pInYUV8Line, U16Packet &outU16YUVLine, const uint32_t inNumPixels) |
Converts a single line of NTV2_FBF_8BIT_YCBCR data from the given source buffer into an ordered sequence of uint16_t values that contain the resulting 10-bit even-parity data. More... | |
static bool | Unpack8BitYCbCrToU16sVANCLineSD (const void *pInYUV8Line, UWordSequence &outU16YUVLine, const uint32_t inNumPixels) |
SD version of Unpack8BitYCbCrToU16sVANCLine. More... | |
static void | GetInstanceCounts (uint32_t &outConstructed, uint32_t &outDestructed) |
static uint32_t | GetNumActiveInstances (void) |
static uint32_t | GetNumConstructed (void) |
static uint32_t | GetNumDestructed (void) |
static void | ResetInstanceCounts (void) |
static std::string | DIDSIDToString (const uint8_t inDID, const uint8_t inSDID) |
static std::string | AuxPacketTypeToString (const uint8_t inAuxPktType) |
static bool | AuxPacketTypeIsValid (const uint8_t inAuxPktType) |
Protected Member Functions | |
void | Init (void) |
virtual AJAStatus | AllocEncodeBuffer (void) |
virtual AJAStatus | InitEncodeBuffer (const uint32_t inLineStartOffset, uint32_t &outDataStartOffset) |
Initializes the payload buffer with all of the "static" pixels, e.g. run-in clock, pre- and post- black, etc. More... | |
virtual AJAStatus | EncodeLine (const uint8_t inChar1, const uint8_t inChar2, const uint32_t inDataStartOffset) |
Encode and insert the given 8-bit characters into the (already initialized) payload buffer. More... | |
virtual uint8_t * | EncodeCharacter (uint8_t *ptr, const uint8_t inChar) |
Encodes a single 8-bit character from just after the transition to the first bit until just before the transition from the last bit. More... | |
virtual uint8_t * | EncodeTransition (uint8_t *ptr, const uint8_t inStartLevel, const uint8_t inEndLevel) |
Encodes a single bit transition from the "from" level to the "to" level. More... | |
virtual AJAStatus | DecodeLine (uint8_t &outChar1, uint8_t &outChar2, bool &outGotClock) const |
Decodes the payload to extract the two captioning characters. The caller must check outGotClock to determine whether a valid CEA-608 ("Line 21") waveform was found: lack of captioning waveform does NOT return an error! More... | |
Protected Member Functions inherited from AJAAncillaryData_Cea608 | |
void | Init (void) |
Protected Member Functions inherited from AJAAncillaryData | |
void | Init (void) |
AJAStatus | AllocDataMemory (const uint32_t inNumBytes) |
AJAStatus | FreeDataMemory (void) |
virtual uint8_t | GetGUMPHeaderByte2 (void) const |
virtual uint8_t | GetGUMPHeaderByte3 (void) const |
Static Protected Member Functions | |
static const uint8_t * | CheckDecodeClock (const uint8_t *pInLine, bool &outGotClock) |
Checks for the existence of a CEA-608 "analog" waveform and, if found, returns a pointer to the start of the data bits. More... | |
static AJAStatus | DecodeCharacters (const uint8_t *ptr, uint8_t &outChar1, uint8_t &outChar2) |
Decodes the two CEA-608 data characters for this line. More... | |
Static Protected Member Functions inherited from AJAAncillaryData | |
static uint8_t | GetGUMPHeaderByte1 (void) |
Protected Attributes | |
bool | m_bEncodeBufferInitialized |
Set 'true' after successfully allocating and initializing the m_payload buffer for encoding. More... | |
uint32_t | m_dataStartOffset |
Offset into the encode buffer where data starts. More... | |
Protected Attributes inherited from AJAAncillaryData_Cea608 | |
uint8_t | m_char1 |
uint8_t | m_char2 |
Protected Attributes inherited from AJAAncillaryData | |
uint8_t | m_DID |
Official SMPTE ancillary packet ID (w/o parity) More... | |
uint8_t | m_SID |
Official SMPTE secondary ID (or DBN - w/o parity) More... | |
uint8_t | m_checksum |
My 8-bit checksum: DID + SID + DC + payload (w/o parity) [note: NOT the same as the 9-bit checksum in a SMPTE-291 packet!]. More... | |
AJAAncDataLoc | m_location |
Location of the ancillary data in the video stream (Y or C, HANC or VANC, etc.) More... | |
AJAAncDataCoding | m_coding |
Analog or digital data. More... | |
ByteVector | m_payload |
My payload data (DC = size) More... | |
bool | m_rcvDataValid |
This is set true (or not) by ParsePayloadData() More... | |
AJAAncDataType | m_ancType |
One of a known set of ancillary data types (or "Custom" if not identified) More... | |
AJAAncBufferFormat | m_bufferFmt |
My originating buffer format, if known. More... | |
uint32_t | m_frameID |
ID of my originating frame, if known. More... | |
uint64_t | m_userData |
User data (for client use) More... | |
uint8_t | m_auxType |
HDMI Aux Header Byte 0 (Packet Type) More... | |
uint8_t | m_auxHB1 |
HDMI Aux Header Byte 1 (Header Data) More... | |
uint8_t | m_auxHB2 |
HDMI Aux Header Byte 2 (Header Data) More... | |
Additional Inherited Members | |
Public Types inherited from AJAAncillaryData | |
typedef UWordSequence | U16Packet |
An ordered sequence of 10-bit packet words stored in uint16_t values. More... | |
typedef std::vector< U16Packet > | U16Packets |
An ordered sequence of zero or more U16Packet values. More... | |
Protected Types inherited from AJAAncillaryData | |
typedef std::vector< uint8_t > | ByteVector |
typedef ByteVector::size_type | ByteVectorIndex |
typedef ByteVector::const_iterator | ByteVectorConstIter |
This class handles "analog" (Line 21) based CEA-608 caption data packets.
Definition at line 27 of file ancillarydata_cea608_line21.h.
AJAAncillaryData_Cea608_Line21::AJAAncillaryData_Cea608_Line21 | ( | ) |
My default constructor.
Definition at line 15 of file ancillarydata_cea608_line21.cpp.
AJAAncillaryData_Cea608_Line21::AJAAncillaryData_Cea608_Line21 | ( | const AJAAncillaryData_Cea608_Line21 & | inClone | ) |
My copy constructor.
[in] | inClone | The object to be cloned. |
Definition at line 21 of file ancillarydata_cea608_line21.cpp.
AJAAncillaryData_Cea608_Line21::AJAAncillaryData_Cea608_Line21 | ( | const AJAAncillaryData_Cea608_Line21 * | pInClone | ) |
My copy constructor.
[in] | pInClone | A valid pointer to the object to be cloned. |
Definition at line 29 of file ancillarydata_cea608_line21.cpp.
AJAAncillaryData_Cea608_Line21::AJAAncillaryData_Cea608_Line21 | ( | const AJAAncillaryData * | pInData | ) |
My copy constructor.
[in] | pInData | A valid pointer to the object to be cloned. |
Definition at line 38 of file ancillarydata_cea608_line21.cpp.
|
virtual |
My destructor.
Definition at line 44 of file ancillarydata_cea608_line21.cpp.
|
protectedvirtual |
Definition at line 130 of file ancillarydata_cea608_line21.cpp.
|
staticprotected |
Checks for the existence of a CEA-608 "analog" waveform and, if found, returns a pointer to the start of the data bits.
[in] | pInLine | The start of the payload buffer. |
[out] | outGotClock | Receives 'true' if a valid CEA-608 ("Line 21") clock waveform was found. |
Definition at line 374 of file ancillarydata_cea608_line21.cpp.
|
virtual |
Frees my allocated memory, if any, and resets my members to their default values.
Reimplemented from AJAAncillaryData_Cea608.
Definition at line 76 of file ancillarydata_cea608_line21.cpp.
|
staticprotected |
Decodes the two CEA-608 data characters for this line.
[in] | ptr | Points to the middle of the first data bit in the waveform (i.e. the one following the '1' start bit). |
[out] | outChar1 | Receives data byte 1. |
[out] | outChar2 | Receives data byte 2. |
Definition at line 470 of file ancillarydata_cea608_line21.cpp.
|
protectedvirtual |
Decodes the payload to extract the two captioning characters. The caller must check outGotClock
to determine whether a valid CEA-608 ("Line 21") waveform was found: lack of captioning waveform does NOT return an error!
[out] | outChar1 | Receives data byte 1 (set to 0xFF if no clock or data is found). |
[out] | outChar2 | Receives data byte 2 (set to 0xFF if no clock or data is found). |
[out] | outGotClock | Receives 'true' if a valid CEA-608 ("Line 21") clock waveform was found. |
Definition at line 351 of file ancillarydata_cea608_line21.cpp.
|
protectedvirtual |
Encodes a single 8-bit character from just after the transition to the first bit until just before the transition from the last bit.
[in] | ptr | Pointer to the location in buffer where the encoding should start. |
[in] | inChar | Specifies the 8-bit character to encode. |
Definition at line 289 of file ancillarydata_cea608_line21.cpp.
|
protectedvirtual |
Encode and insert the given 8-bit characters into the (already initialized) payload buffer.
[in] | inChar1 | Specifies the 8-bit "1st" character on the line. |
[in] | inChar2 | Specifies the 8-bit "2nd" character on the line. |
[in] | inDataStartOffset | Specifies the pixel count from beginning of line (buffer) to the first data pixel. |
Definition at line 261 of file ancillarydata_cea608_line21.cpp.
|
protectedvirtual |
Encodes a single bit transition from the "from" level to the "to" level.
[in] | ptr | ptr to the location in buffer where the encoding should start |
[in] | inStartLevel | Specifies the beginning level (0=low, >0=high). |
[in] | inEndLevel | Specifies the ending level (0=low, >0=high). |
Definition at line 315 of file ancillarydata_cea608_line21.cpp.
|
virtual |
Generate the payload data from the "local" ancillary data.
Reimplemented from AJAAncillaryData.
Definition at line 108 of file ancillarydata_cea608_line21.cpp.
|
protected |
Definition at line 49 of file ancillarydata_cea608_line21.cpp.
|
protectedvirtual |
Initializes the payload buffer with all of the "static" pixels, e.g. run-in clock, pre- and post- black, etc.
[in] | inLineStartOffset | Pixel count from beginning of line (buffer) to the start of the waveform. |
[out] | outDataStartOffset | Receives the pixel count from beginning of line (buffer) to the first data pixel (required by the AJAAncillaryData_Cea608_Line21::EncodeLine function). |
Definition at line 205 of file ancillarydata_cea608_line21.cpp.
|
virtual |
Assignment operator – replaces my contents with the right-hand-side value.
[in] | inRHS | The value to be assigned to me. |
Definition at line 62 of file ancillarydata_cea608_line21.cpp.
|
virtual |
Parses out (interprets) the "local" ancillary data from my payload data.
Reimplemented from AJAAncillaryData.
Definition at line 83 of file ancillarydata_cea608_line21.cpp.
|
static |
[in] | pInAncData | A valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect. |
Definition at line 144 of file ancillarydata_cea608_line21.cpp.
|
protected |
Set 'true' after successfully allocating and initializing the m_payload buffer for encoding.
Definition at line 167 of file ancillarydata_cea608_line21.h.
|
protected |
Offset into the encode buffer where data starts.
Definition at line 168 of file ancillarydata_cea608_line21.h.