AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
CNTV2Line21Captioner Class Reference

Instances of me can encode two ASCII characters into a "line 21" closed-captioning waveform. Conversely, my CNTV2Line21Captioner::DecodeLine class method can decode a "line 21" waveform to the two characters it contains. More...

#include <ntv2line21captioner.h>

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

Public Member Functions

 CNTV2Line21Captioner ()
 720 pixels x 2 bytes per pixel More...
 
virtual ~CNTV2Line21Captioner ()
 My default destructor. More...
 
virtual UByteEncodeLine (const UByte inByte1, const UByte inByte2)
 Encodes the two given characters as an EIA-608-compliant "line 21" waveform into my private line data buffer. Client applications will probably want to copy this waveform data into their own host frame buffer for eventual transmission to an SDI output. Returns the starting address of my private line buffer. More...
 
- Public Member Functions inherited from CNTV2CaptionLogConfig
 CNTV2CaptionLogConfig (const std::string inLogLabel=std::string())
 Default constructor. More...
 
virtual ~CNTV2CaptionLogConfig ()
 
virtual NTV2CaptionLogMask SetLogMask (const NTV2CaptionLogMask inLogMask)
 Specifies what, if any, debug information I will write to my log stream. More...
 
virtual NTV2CaptionLogMask GetLogMask (void) const
 Answers with my current caption logging bit mask. More...
 
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. More...
 
virtual void SetLogLabel (const std::string &inNewLabel)
 Specifies my logging label. More...
 
virtual void AppendToLogLabel (const std::string &inString)
 Appends the given string to my current log label. More...
 
virtual const std::string & GetLogLabel (void) const
 Answers with my current logging label. More...
 
virtual void SetLogStream (std::ostream &inOutputStream)
 
virtual std::ostream & LogIf (const NTV2CaptionLogMask inLogMask) const
 
virtual std::ostream & Log (void) const
 

Static Public Member Functions

static bool DecodeLine (const UByte *pLineData, UByte &outChar1, UByte &outChar2)
 Decodes the supplied line of 8-bit uncompressed ('2vuy') data and, if successful, returns the two 8-bit characters. More...
 
static bool DecodeLine (const std::vector< uint8_t > &inLineData, std::vector< uint8_t > &outData)
 Decodes the supplied line of 8-bit uncompressed ('2vuy') data and, if successful, returns the 8-bit decoded data. More...
 
static const UByteFindFirstDataBit_NTSC (const void *pInVideoLine)
 Searches for a valid captioning clock run-in in the given 8-bit uncompressed ('2vuy') line. More...
 
static std::vector< uint8_t >::size_type FindFirstDataBit_NTSC (const std::vector< uint8_t > &in2VUYLine)
 Searches for a valid captioning clock run-in in the given 8-bit uncompressed ('2vuy') line. More...
 
- Static Public Member Functions inherited from CNTV2CaptionLogConfig
static std::ostream & DumpMemory (const void *pInStartAddress, const size_t inByteCount, std::ostream &inOutputStream=std::cout, const size_t inRadix=16, const size_t inBytesPerGroup=4, const size_t inGroupsPerLine=8, const size_t inAddressRadix=16, const bool inShowAscii=true, const size_t inAddrOffset=0)
 Dumps a contiguous chunk of memory in hex, octal, decimal, with or without ascii, to the given output stream. More...
 
static std::string HexDump32Bytes (const void *pInStartAddress, const size_t inByteCount, const size_t inLimitBytes=32)
 
static std::ostream & DumpYBytes_2vuy (const UByte *pInVideoLine, std::ostream &inOutputStream, const unsigned inFromPixel=0, const unsigned inToPixel=719, const bool inShowRuler=true, const unsigned inHiliteRangeFrom=9999, const unsigned inHiliteRangeTo=9999)
 Dumps the luma values in hexadecimal from the given line of '2vuy' video to the given output stream. More...
 
static std::ostream & DumpYBytes_2vuy (const std::vector< uint8_t > &inVideoLine, std::ostream &inOutputStream, const size_t inFromPixel=0, const size_t inToPixel=719, const bool inShowRuler=true, const size_t inHiliteRangeFrom=9999, const size_t inHiliteRangeTo=9999)
 Dumps the luma values in hexadecimal from the given line of '2vuy' video to the given output stream. More...
 
static std::string GetSeverityLabel (const unsigned inSeverity)
 

Static Public Attributes

static const UWord CC_LINE_WIDTH_PIXELS = 720
 
static const UWord ENCODE_LINE_LENGTH_BYTES = CC_LINE_WIDTH_PIXELS * 2
 Standard-Definition only – assume fixed line width of 720 pixels. More...
 

Additional Inherited Members

- Protected Attributes inherited from CNTV2CaptionLogConfig
NTV2CaptionLogMask mLogMask
 Determines what messages are logged. More...
 
std::string mLogLabel
 My debug label. More...
 
void * mpLabelLock
 Protects my debug label from simultaneous access by more than one thread. More...
 

Detailed Description

Instances of me can encode two ASCII characters into a "line 21" closed-captioning waveform. Conversely, my CNTV2Line21Captioner::DecodeLine class method can decode a "line 21" waveform to the two characters it contains.

In either use case, I assume a 720-pixel line (e.g. Standard Definition "NTSC"), and the closed captioning is represented by an EIA-608 waveform. I do not handle other forms of closed captioning transmission (e.g., EIA-708, digital ancillary packets, etc.).

Note
This implementation only handles conversion to/from 8-bit uncompressed ('2vuy') video.
This implementation makes a simplifying assumption that all captioning bits are 27 pixels wide. The actual bit duration should be (H / 32), which for NTSC video is 858 pixels / 32 = 26.8125 pixels per bit. This difference should be within the tolerance of most captioning receivers. (In PAL, the line width is 864 pixels, which is exactly 27.0 pixels per bit.)

Definition at line 34 of file ntv2line21captioner.h.

Constructor & Destructor Documentation

◆ CNTV2Line21Captioner()

CNTV2Line21Captioner::CNTV2Line21Captioner ( )

720 pixels x 2 bytes per pixel

My default constructor.

◆ ~CNTV2Line21Captioner()

virtual CNTV2Line21Captioner::~CNTV2Line21Captioner ( )
virtual

My default destructor.

Member Function Documentation

◆ DecodeLine() [1/2]

static bool CNTV2Line21Captioner::DecodeLine ( const std::vector< uint8_t > &  inLineData,
std::vector< uint8_t > &  outData 
)
static

Decodes the supplied line of 8-bit uncompressed ('2vuy') data and, if successful, returns the 8-bit decoded data.

Parameters
[in]inLineDataA line of 8-bit uncompressed '2vuy' data that contains the "line 21" waveform data to be decoded.
[out]outDataReceives the data bytes (including parity) decoded from the line.
Returns
True if the given line appears to contain valid data; otherwise, false.
Note
Character analysis, including parity checks, are the caller's responsibility. However, this method WILL make a reasonable attempt to discover whether captioning data is present or not.

◆ DecodeLine() [2/2]

static bool CNTV2Line21Captioner::DecodeLine ( const UByte pLineData,
UByte outChar1,
UByte outChar2 
)
static

Decodes the supplied line of 8-bit uncompressed ('2vuy') data and, if successful, returns the two 8-bit characters.

Parameters
[in]pLineDataSpecifies a valid, non-NULL pointer to the first byte in a frame buffer that contains the "line 21" waveform data to be decoded.
[out]outChar1Receives the first caption data byte decoded from the line.
[out]outChar2Receives the second caption data byte decoded from the line.
Returns
True if the given line appears to contain valid caption data; otherwise, false.
Note
Character analysis, including parity checks, are the caller's responsibility. However, this method WILL make a reasonable attempt to discover whether captioning data is present or not.

◆ EncodeLine()

virtual UByte* CNTV2Line21Captioner::EncodeLine ( const UByte  inByte1,
const UByte  inByte2 
)
virtual

Encodes the two given characters as an EIA-608-compliant "line 21" waveform into my private line data buffer. Client applications will probably want to copy this waveform data into their own host frame buffer for eventual transmission to an SDI output. Returns the starting address of my private line buffer.

Parameters
[in]inByte1The first character to be encoded. The data byte MUST include parity.
[in]inByte2The second character to be encoded. The data byte MUST include parity.
Returns
A pointer to the first byte of my private buffer, which contains the encoded "line 21" waveform.
Note
My private line data buffer has a single line containing 720 pixels of '2vuy' (8-bit YCbCr) SD video data.

◆ FindFirstDataBit_NTSC() [1/2]

static std::vector<uint8_t>::size_type CNTV2Line21Captioner::FindFirstDataBit_NTSC ( const std::vector< uint8_t > &  in2VUYLine)
static

Searches for a valid captioning clock run-in in the given 8-bit uncompressed ('2vuy') line.

Parameters
[in]in2VUYLineA buffer containing the line of 8-bit '2vuy' video to be searched.
Returns
in2VUYLine.max_size() if unsuccessful; otherwise an index/offset to the middle of the first data bit (i.e. the one following the last '1' start bit).

◆ FindFirstDataBit_NTSC() [2/2]

static const UByte* CNTV2Line21Captioner::FindFirstDataBit_NTSC ( const void *  pInVideoLine)
static

Searches for a valid captioning clock run-in in the given 8-bit uncompressed ('2vuy') line.

Parameters
[in]pInVideoLineA valid pointer to a buffer containing the line of 8-bit '2vuy' video to be searched. Must be at least 1440 bytes in length.
Returns
NULL if unsuccessful; otherwise a pointer to the middle of the first data bit (i.e. the one following the last '1' start bit).

Member Data Documentation

◆ CC_LINE_WIDTH_PIXELS

const UWord CNTV2Line21Captioner::CC_LINE_WIDTH_PIXELS = 720
static

Definition at line 82 of file ntv2line21captioner.h.

◆ ENCODE_LINE_LENGTH_BYTES

const UWord CNTV2Line21Captioner::ENCODE_LINE_LENGTH_BYTES = CC_LINE_WIDTH_PIXELS * 2
static

Standard-Definition only – assume fixed line width of 720 pixels.

Definition at line 83 of file ntv2line21captioner.h.


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