AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
AJAAncillaryData_Cea608 Class Reference

This is the base class for handling CEA-608 caption data packets. More...

#include <ancillarydata_cea608.h>

Inheritance diagram for AJAAncillaryData_Cea608:
[legend]
Collaboration diagram for AJAAncillaryData_Cea608:
[legend]

Public Member Functions

 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...
 
virtual void Clear (void)
 Frees my allocated memory, if any, and resets my members to their default values. More...
 
AJAAncillaryData_Cea608operator= (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 AJAAncillaryDataClone (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...
 
AJAAncillaryDataoperator= (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 AJAAncillaryDataSetFrameID (const uint32_t inFrameID)
 Sets my originating frame identifier. More...
 
virtual AJAAncillaryDataSetBufferFormat (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 AJAStatus ParsePayloadData (void)
 Parses (interprets) the "local" ancillary data from my payload data. More...
 
virtual bool GotValidReceiveData (void) const
 
virtual AJAStatus GeneratePayloadData (void)
 Generates the payload data from the "local" ancillary data. More...
 
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 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)
 
- 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
 

Protected Attributes

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< U16PacketU16Packets
 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
 
- Static Protected Member Functions inherited from AJAAncillaryData
static uint8_t GetGUMPHeaderByte1 (void)
 

Detailed Description

This is the base class for handling CEA-608 caption data packets.

Definition at line 18 of file ancillarydata_cea608.h.

Constructor & Destructor Documentation

◆ AJAAncillaryData_Cea608() [1/4]

AJAAncillaryData_Cea608::AJAAncillaryData_Cea608 ( )

My default constructor.

Definition at line 15 of file ancillarydata_cea608.cpp.

◆ AJAAncillaryData_Cea608() [2/4]

AJAAncillaryData_Cea608::AJAAncillaryData_Cea608 ( const AJAAncillaryData_Cea608 inClone)

My copy constructor.

Parameters
[in]inCloneThe object to be cloned.

Definition at line 21 of file ancillarydata_cea608.cpp.

◆ AJAAncillaryData_Cea608() [3/4]

AJAAncillaryData_Cea608::AJAAncillaryData_Cea608 ( const AJAAncillaryData_Cea608 pInClone)

My copy constructor.

Parameters
[in]pInCloneA valid pointer to the object to be cloned.

Definition at line 29 of file ancillarydata_cea608.cpp.

◆ AJAAncillaryData_Cea608() [4/4]

AJAAncillaryData_Cea608::AJAAncillaryData_Cea608 ( const AJAAncillaryData pInData)

My copy constructor.

Parameters
[in]pInDataA valid pointer to the object to be cloned.

Definition at line 38 of file ancillarydata_cea608.cpp.

◆ ~AJAAncillaryData_Cea608()

AJAAncillaryData_Cea608::~AJAAncillaryData_Cea608 ( )
virtual

My destructor.

Definition at line 44 of file ancillarydata_cea608.cpp.

Member Function Documentation

◆ AddOddParity()

uint8_t AJAAncillaryData_Cea608::AddOddParity ( const uint8_t  inValue)
static

Set/Clear bit 7 of a byte to make odd parity.

Parameters
[in]inValueSpecifies the 7-bit input value.
Returns
The least-significant 7 bits of the input byte with bit 7 set or cleared to make odd parity.

Definition at line 109 of file ancillarydata_cea608.cpp.

◆ Clear()

void AJAAncillaryData_Cea608::Clear ( void  )
virtual

Frees my allocated memory, if any, and resets my members to their default values.

Reimplemented from AJAAncillaryData.

Reimplemented in AJAAncillaryData_Cea608_Line21, and AJAAncillaryData_Cea608_Vanc.

Definition at line 71 of file ancillarydata_cea608.cpp.

◆ GetCEA608Bytes()

AJAStatus AJAAncillaryData_Cea608::GetCEA608Bytes ( uint8_t &  outByte1,
uint8_t &  outByte2,
bool &  outIsValid 
) const
virtual

Answers with the CEA608 payload bytes.

Parameters
[out]outByte1Receives the first byte of the pair (includes parity).
[out]outByte2Receives the second byte of the pair (includes parity).
[out]outIsValidReceives 'true' if returned data is valid.
Returns
AJA_STATUS_SUCCESS if successful.

Definition at line 89 of file ancillarydata_cea608.cpp.

◆ GetCEA608Characters()

AJAStatus AJAAncillaryData_Cea608::GetCEA608Characters ( uint8_t &  outChar1,
uint8_t &  outChar2,
bool &  outIsValid 
) const
virtual

Answers with the CEA608 payload characters.

Parameters
[out]outChar1Receives the first character of the pair (after stripping odd parity).
[out]outChar2Receives the second character of the pair (after stripping odd parity).
[out]outIsValidReceives 'true' if the returned characters are valid; otherwise 'false'.
Returns
AJA_STATUS_SUCCESS if successful.

Definition at line 132 of file ancillarydata_cea608.cpp.

◆ Init()

void AJAAncillaryData_Cea608::Init ( void  )
protected

Definition at line 50 of file ancillarydata_cea608.cpp.

◆ operator=()

AJAAncillaryData_Cea608 & AJAAncillaryData_Cea608::operator= ( const AJAAncillaryData_Cea608 inRHS)

Assignment operator – replaces my contents with the right-hand-side value.

Parameters
[in]inRHSThe value to be assigned to me.
Returns
A reference to myself.

Definition at line 57 of file ancillarydata_cea608.cpp.

◆ Print()

ostream & AJAAncillaryData_Cea608::Print ( std::ostream &  inOutStream,
const bool  inDetailed = false 
) const
virtual

Streams a human-readable representation of me to the given output stream.

Parameters
inOutStreamSpecifies the output stream.
[in]inDetailedSpecify 'true' for a detailed representation; otherwise use 'false' for a brief one.
Returns
The given output stream.

Reimplemented from AJAAncillaryData.

Reimplemented in AJAAncillaryData_Cea608_Vanc.

Definition at line 149 of file ancillarydata_cea608.cpp.

◆ RecognizeThisAncillaryData()

AJAAncDataType AJAAncillaryData_Cea608::RecognizeThisAncillaryData ( const AJAAncillaryData pInAncData)
static
Parameters
[in]pInAncDataA valid pointer to a base AJAAncillaryData object that contains the Anc data to inspect.
Returns
AJAAncDataType if I recognize this Anc data (or AJAAncDataType_Unknown if unrecognized).

Definition at line 141 of file ancillarydata_cea608.cpp.

◆ SetCEA608Bytes()

AJAStatus AJAAncillaryData_Cea608::SetCEA608Bytes ( const uint8_t  inByte1,
const uint8_t  inByte2 
)
virtual

Set the CEA608 payload bytes.

Note
This function assumes the caller has already added parity.
Parameters
[in]inByte1Specifies the first byte of the pair.
[in]inByte2Specifies the second byte of the pair.
Returns
AJA_STATUS_SUCCESS if successful.

Definition at line 81 of file ancillarydata_cea608.cpp.

◆ SetCEA608Characters()

AJAStatus AJAAncillaryData_Cea608::SetCEA608Characters ( const uint8_t  inChar1,
const uint8_t  inChar2 
)
virtual

Sets the CEA608 payload characters. Uses the least significant 7 bits of the input values and adds odd parity.

Parameters
[in]inChar1Specifies the first character of the pair.
[in]inChar2Specifies the second character of the pair.
Returns
AJA_STATUS_SUCCESS if successful.

Definition at line 101 of file ancillarydata_cea608.cpp.

Member Data Documentation

◆ m_char1

uint8_t AJAAncillaryData_Cea608::m_char1
protected

Definition at line 118 of file ancillarydata_cea608.h.

◆ m_char2

uint8_t AJAAncillaryData_Cea608::m_char2
protected

Definition at line 119 of file ancillarydata_cea608.h.


The documentation for this class was generated from the following files: