|
AJA NTV2 SDK
17.0.1.1246
NTV2 SDK 17.0.1.1246
|
Go to the documentation of this file.
14 #if defined (AJALinux)
17 #if defined(AJAANCLISTIMPL_VECTOR)
23 #define LOGMYERROR(__x__) AJA_sERROR (AJA_DebugUnit_AJAAncList, AJAFUNC << ": " << __x__)
24 #define LOGMYWARN(__x__) AJA_sWARNING(AJA_DebugUnit_AJAAncList, AJAFUNC << ": " << __x__)
25 #define LOGMYNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_AJAAncList, AJAFUNC << ": " << __x__)
26 #define LOGMYINFO(__x__) AJA_sINFO (AJA_DebugUnit_AJAAncList, AJAFUNC << ": " << __x__)
27 #define LOGMYDEBUG(__x__) AJA_sDEBUG (AJA_DebugUnit_AJAAncList, AJAFUNC << ": " << __x__)
29 #define RCVFAIL(__x__) AJA_sERROR (AJA_DebugUnit_Anc2110Rcv, AJAFUNC << ": " << __x__)
30 #define RCVWARN(__x__) AJA_sWARNING(AJA_DebugUnit_Anc2110Rcv, AJAFUNC << ": " << __x__)
31 #define RCVNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_Anc2110Rcv, AJAFUNC << ": " << __x__)
32 #define RCVINFO(__x__) AJA_sINFO (AJA_DebugUnit_Anc2110Rcv, AJAFUNC << ": " << __x__)
33 #define RCVDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_Anc2110Rcv, AJAFUNC << ": " << __x__)
35 #define XMTFAIL(__x__) AJA_sERROR (AJA_DebugUnit_Anc2110Xmit, AJAFUNC << ": " << __x__)
36 #define XMTWARN(__x__) AJA_sWARNING(AJA_DebugUnit_Anc2110Xmit, AJAFUNC << ": " << __x__)
37 #define XMTNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_Anc2110Xmit, AJAFUNC << ": " << __x__)
38 #define XMTINFO(__x__) AJA_sINFO (AJA_DebugUnit_Anc2110Xmit, AJAFUNC << ": " << __x__)
39 #define XMTDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_Anc2110Xmit, AJAFUNC << ": " << __x__)
41 #if defined(AJAHostIsBigEndian)
43 #define AJA_ENDIAN_16NtoH(__val__) (__val__)
44 #define AJA_ENDIAN_16HtoN(__val__) (__val__)
45 #define AJA_ENDIAN_32NtoH(__val__) (__val__)
46 #define AJA_ENDIAN_32HtoN(__val__) (__val__)
47 #define AJA_ENDIAN_64NtoH(__val__) (__val__)
48 #define AJA_ENDIAN_64HtoN(__val__) (__val__)
51 #define AJA_ENDIAN_16NtoH(__val__) AJA_ENDIAN_SWAP16(__val__)
52 #define AJA_ENDIAN_16HtoN(__val__) AJA_ENDIAN_SWAP16(__val__)
53 #define AJA_ENDIAN_32NtoH(__val__) AJA_ENDIAN_SWAP32(__val__)
54 #define AJA_ENDIAN_32HtoN(__val__) AJA_ENDIAN_SWAP32(__val__)
55 #define AJA_ENDIAN_64NtoH(__val__) AJA_ENDIAN_SWAP64(__val__)
56 #define AJA_ENDIAN_64HtoN(__val__) AJA_ENDIAN_SWAP64(__val__)
64 unsigned numPrinted (0);
65 inOutStream <<
DECN(inData.size(),3) <<
" U32s: ";
70 if (++iter != inData.end())
72 if (numPrinted > inMaxNum)
73 {inOutStream <<
"...";
break;}
89 unsigned rtpPktNum(0);
92 inOutStream <<
"RTP PKT " <<
DEC0N(rtpPktNum,3) <<
":";
102 { inOutStream <<
xHEX0N(*it,4);
103 if (++it != inSet.end())
149 m_rcvMultiRTP (
true),
150 m_xmitMultiRTP (
false),
173 m_xmitMultiRTP = inRHS.m_xmitMultiRTP;
174 m_rcvMultiRTP = inRHS.m_rcvMultiRTP;
175 m_ignoreCS = inRHS.m_ignoreCS;
189 if (!m_ancList.empty() && inIndex < m_ancList.size())
193 for (uint32_t i(0); i < inIndex; i++)
227 if (matchType == ancType)
244 if (matchType == ancType)
306 if (result.find(pktDIDSID) == result.end())
307 result.insert(pktDIDSID);
315 if (&inPackets ==
this)
325 m_ancList.push_back(pNewPkt);
339 const bool wasEmpty (m_ancList.empty());
346 m_ancList.push_back(pData);
348 LOGMYDEBUG(
DEC(m_ancList.size()) <<
" packet(s) stored" << (wasEmpty ?
" from" :
" after appending") <<
" packet " << pData->
AsString(32));
355 uint32_t numDeleted (0);
356 const uint32_t oldSize (uint32_t(m_ancList.size()));
368 if (oldSize || numDeleted)
369 LOGMYDEBUG(numDeleted <<
" packet(s) deleted -- list emptied");
379 #if defined(AJAANCLISTIMPL_VECTOR)
381 for (it = m_ancList.begin(); it != m_ancList.end(); ++it)
384 if (it == m_ancList.end())
388 m_ancList.remove(pAncData);
391 LOGMYDEBUG(
DEC(m_ancList.size()) <<
" packet(s) remain after removing packet " << pAncData->
AsString(32));
412 return lhs->GetDID() < rhs->GetDID();
418 return lhs->GetSID() < rhs->GetSID();
425 return locLHS < locRHS;
433 #if defined(AJAANCLISTIMPL_VECTOR)
434 std::sort(m_ancList.begin(), m_ancList.end(),
SortByDID);
444 #if defined(AJAANCLISTIMPL_VECTOR)
445 std::sort(m_ancList.begin(), m_ancList.end(),
SortBySID);
454 #if defined(AJAANCLISTIMPL_VECTOR)
490 const string info (pPkt->
CompareWithInfo(*pPktRHS, inIgnoreLocation, inIgnoreChecksum));
508 outDiffInfo.push_back(oss.str());
516 const string info (pPkt->CompareWithInfo(*pPktRHS, inIgnoreLocation, inIgnoreChecksum));
521 <<
"LHS " << pPkt->AsString(250) << endl
522 <<
"RHS " << pPktRHS->AsString(250) << endl
524 outDiffInfo.push_back(oss.str());
527 return outDiffInfo.empty();
539 const uint32_t dataSize,
540 const uint32_t inFrameNum)
544 if (!pRcvData || !dataSize)
550 int32_t remainingSize (int32_t(dataSize + 0));
551 const uint8_t * pInputData (pRcvData);
552 bool bMoreData (
true);
556 bool bInsertNew (
false);
558 uint32_t packetSize (0);
562 status = newAncData.
InitWithReceivedData (pInputData,
size_t(remainingSize), defaultLoc, packetSize);
568 else if (packetSize == 0)
572 if (newAncData.IsDigital())
579 else if (newAncData.IsRaw())
593 const uint64_t desiredLocation (newAncData.GetDataLocation().OrdinalValue());
596 if ((*pRaw)->GetDataLocation().OrdinalValue() == desiredLocation)
600 pContinuationPkt = *pRaw;
605 if (!pContinuationPkt)
627 rawPkts.push_back(pData);
629 m_ancList.push_back(pData);
633 if (inFrameNum && !pData->GetFrameID())
640 remainingSize -= packetSize;
641 pInputData += packetSize;
642 if (remainingSize <= 0)
651 m_ancList.push_back(rawPkts.back());
669 if (inReceivedData.empty())
677 {
LOGMYERROR(
"AJARTPAncPayloadHeader::ReadULWordVector failed, " <<
DEC(4*inReceivedData.size()) <<
" header bytes");
return AJA_STATUS_FAIL;}
683 const size_t predictedPayloadSize (RTPheader.GetPayloadLength() /
sizeof(uint32_t));
684 const size_t actualPayloadSize (inReceivedData.size() - AJARTPAncPayloadHeader::GetHeaderWordCount());
685 const uint32_t numPackets (RTPheader.GetAncPacketCount());
686 uint32_t pktsAdded (0);
689 if (actualPayloadSize < predictedPayloadSize)
693 if (!actualPayloadSize)
701 for (; pktNum < numPackets &&
AJA_SUCCESS(status); pktNum++)
714 pNewPkt->
SetFrameID(RTPheader.GetTimeStamp());
717 try {m_ancList.push_back(pNewPkt); pktsAdded++;}
726 LOGMYWARN(
DEC(pktsAdded) <<
" of " <<
DEC(numPackets) <<
" anc pkt(s) decoded from RTP pkt");
728 LOGMYINFO(
DEC(numPackets) <<
" pkts added from RTP pkt: " << *
this);
742 if (inPacketWords.size () < 7)
762 outGumpPkt.reserve (outGumpPkt.size() + inPacketWords.size());
763 const UByteSequence::size_type dataByte1Ndx (outGumpPkt.size()+1);
764 outGumpPkt.push_back(0xFF);
765 outGumpPkt.push_back(0x80);
766 outGumpPkt[dataByte1Ndx] |= (inLoc.GetLineNumber() >> 7) & 0x0F;
767 if (inLoc.IsLumaChannel())
768 outGumpPkt[dataByte1Ndx] |= 0x20;
770 outGumpPkt[dataByte1Ndx] |= 0x10;
771 outGumpPkt.push_back (inLoc.GetLineNumber() & 0x7F);
773 while (iter != inPacketWords.end())
775 outGumpPkt.push_back(*iter & 0xFF);
806 try {m_ancList.push_back(pData);}
809 if (inFrameNum && pData->GetDID())
825 const uint32_t inFrameNum)
829 if (inFrameBuffer.
IsNULL())
831 LOGMYERROR(
"AJA_STATUS_NULL: NULL frame buffer pointer");
836 LOGMYERROR(
"AJA_STATUS_BAD_PARAM: bad NTV2FormatDescriptor");
839 if (!inFormatDesc.IsVANC())
841 LOGMYERROR(
"AJA_STATUS_BAD_PARAM: format descriptor has no VANC lines");
850 LOGMYERROR(
"AJA_STATUS_FAIL: " << inFrameBuffer.
GetByteCount() <<
"-byte frame buffer smaller than " << vancBytes <<
"-byte VANC region");
870 inFormatDesc, uwords);
873 uwords, inFormatDesc.GetRasterWidth());
881 NTV2_ASSERT(ycPackets.size() == ycHOffsets.size());
883 for (AJAAncillaryData::U16Packets::const_iterator it(ycPackets.begin()); it != ycPackets.end(); ++it, ndx++)
899 for (AJAAncillaryData::U16Packets::const_iterator it(yPackets.begin()); it != yPackets.end(); ++it, ndxx++)
903 for (AJAAncillaryData::U16Packets::const_iterator it(cPackets.begin()); it != cPackets.end(); ++it, ndxx++)
914 const uint32_t inFrameNum)
916 uint32_t RTPPacketCount (0);
931 size_t ULWordCount (0);
932 size_t ULWordOffset (0);
933 unsigned retries (0);
934 const unsigned MAX_RETRIES (4);
936 while (ancBuffer && retries++ < MAX_RETRIES)
948 RCVWARN(
"On RTP pkt " <<
DEC(RTPPacketCount) <<
", RTP hdr ReadFromBuffer failed at: " << ancBuffer.
AsString(40));
952 ULWordCount = rtpHeader.GetPayloadLength() /
sizeof(uint32_t)
953 + AJARTPAncPayloadHeader::GetHeaderWordCount();
956 if (!ancBuffer.
GetU32s (U32s, 0, ULWordCount))
958 RCVFAIL(
"On RTP pkt " <<
DEC(RTPPacketCount) <<
", GetU32s(" <<
DEC(ULWordCount) <<
") at: " << ancBuffer.
AsString(40));
976 ULWordOffset += ULWordCount;
978 inAncBuffer.
GetByteCount() - ULWordOffset *
sizeof(uint32_t));
979 RCVDBG(
"Moved buffer " << inAncBuffer <<
" forward by " <<
DEC(ULWordCount) <<
" U32s: " << ancBuffer.
AsString(20));
997 const uint32_t inFrameNum)
1016 const uint8_t * pBytes (
reinterpret_cast <const uint8_t*
>(inBuffer.
GetHostPointer()));
1019 return *pBytes == 0xFF;
1029 const bool inIsProgressive,
const uint32_t inF2StartLine)
1032 uint32_t actF1PktCnt (0);
1033 uint32_t actF2PktCnt (0);
1034 uint32_t pktNdx (0);
1035 size_t oldPktLengthWords (0);
1036 unsigned countOverflows (0);
1037 size_t overflowWords (0);
1042 outF1AncCounts.clear(); outF2AncCounts.clear();
1046 if (!inIsProgressive)
1048 F1U32s.clear(); F2U32s.clear();
1064 if (inIsProgressive || pkt.GetLocationLineNumber() < inF2StartLine)
1072 oldPktLengthWords = F1U32s.size();
1078 overflowWords += F1U32s.size() - oldPktLengthWords;
1080 while (F1U32s.size() > oldPktLengthWords)
1087 outF1U32Pkts.push_back(F1U32s);
1088 outF1AncCounts.push_back(1);
1101 oldPktLengthWords = F2U32s.size();
1107 overflowWords += F2U32s.size() - oldPktLengthWords;
1109 while (F2U32s.size() > oldPktLengthWords)
1116 outF2U32Pkts.push_back(F2U32s);
1117 outF2AncCounts.push_back(1);
1128 outF1U32Pkts.push_back(F1U32s);
1129 outF1AncCounts.push_back(uint8_t(actF1PktCnt));
1130 outF2U32Pkts.push_back(F2U32s);
1131 outF2AncCounts.push_back(uint8_t(actF2PktCnt));
1133 if (overflowWords && countOverflows)
1134 LOGMYWARN(
"Overflow: " <<
DEC(countOverflows) <<
" pkts skipped, " <<
DEC(overflowWords) <<
" U32s dropped");
1135 else if (overflowWords)
1136 LOGMYWARN(
"Data overflow: " <<
DEC(overflowWords) <<
" U32s dropped");
1137 else if (countOverflows)
1138 LOGMYWARN(
"Packet overflow: " <<
DEC(countOverflows) <<
" pkts skipped");
1139 XMTDBG(
"F1 (Content Only): " << outF1U32Pkts);
1140 XMTDBG(
"F2 (Content Only): " << outF2U32Pkts);
1154 uint32_t f1Size (0);
1155 uint32_t f2Size (0);
1160 uint32_t packetSize (0);
1165 if (bProgressive || pAncData->GetLocationLineNumber () < f2StartLine)
1166 f1Size += packetSize;
1168 f2Size += packetSize;
1179 NTV2Buffer F1Buffer(pF1AncData, inMaxF1Data), F2Buffer(pF2AncData, inMaxF2Data);
1180 if (!F1Buffer.IsNULL())
1184 return GetTransmitData(F1Buffer, F2Buffer, bProgressive, f2StartLine);
1189 const bool inIsProgressive,
const uint32_t inF2StartLine)
1194 uint8_t * pF1AncData (
reinterpret_cast<uint8_t*
>(F1Buffer.
GetHostPointer()));
1195 uint8_t * pF2AncData (
reinterpret_cast<uint8_t*
>(F2Buffer.
GetHostPointer()));
1197 F1Buffer.
Fill(uint64_t(0)); F2Buffer.
Fill(uint64_t(0));
1205 uint32_t pktSize(0);
1210 if (inIsProgressive || pPkt->GetLocationLineNumber() < inF2StartLine)
1212 if (pF1AncData && maxF1Data)
1218 pF1AncData += pktSize;
1219 maxF1Data -= pktSize;
1222 else if (pF2AncData && maxF2Data)
1228 pF2AncData += pktSize;
1229 maxF2Data -= pktSize;
1238 if (inFrameBuffer.
IsNULL())
1240 LOGMYERROR(
"AJA_STATUS_NULL: null frame buffer");
1245 LOGMYERROR(
"AJA_STATUS_BAD_PARAM: Invalid format descriptor");
1248 if (!inFormatDesc.IsVANC())
1250 LOGMYERROR(
"AJA_STATUS_BAD_PARAM: Not a VANC geometry");
1255 LOGMYERROR(
"AJA_STATUS_UNSUPPORTED: unsupported pixel format: " << inFormatDesc);
1268 const bool isSD (inFormatDesc.IsSD());
1270 set <uint16_t> lineOffsetsWritten;
1275 ULWord smpteLine (0);
bool isF2 (
false);
1281 bool muxedOK (
false);
1292 if (loc.GetLineNumber() != smpteLine)
1299 LOGMYWARN(
"Skipped packet with invalid data channel " << loc);
1312 for (
unsigned ndx(0); ndx < u16PktComponents.size(); ndx++)
1313 pLine[ndx] = uint8_t(u16PktComponents[ndx] & 0xFF);
1318 for (
unsigned srcNdx(0); srcNdx < u16PktComponents.size(); srcNdx++)
1319 pLine[dstNdx + 2*srcNdx] = uint8_t(u16PktComponents[srcNdx] & 0x00FF);
1326 while (u16PktComponents.size() < 12 || u16PktComponents.size() % 12)
1327 u16PktComponents.push_back(0x040);
1341 for (
unsigned srcNdx(0); srcNdx < u16PktComponents.size(); srcNdx++)
1342 YUV16Line[dstNdx + 2*srcNdx] = u16PktComponents[srcNdx] & 0x03FF;
1348 while (YUV16Line.size() < 12 || YUV16Line.size() % 12)
1349 YUV16Line.push_back(0x040);
1360 lineOffsetsWritten.insert(uint16_t(fbLineOffset));
1371 bool success (inFormatDesc.IsSD());
1375 if (!ancData.IsRaw())
1380 if (success && lineOffsetsWritten.find(uint16_t(lineOffset)) != lineOffsetsWritten.end())
1397 lineOffsetsWritten.insert(uint16_t(lineOffset));
1418 const bool inIsF2,
const bool inIsProgressive)
1421 const string sFld (inIsF2 ?
" F2" :
" F1");
1422 const string sPrg (inIsProgressive ?
" Prg" :
" Int");
1423 ULWord u32offset(0), pktNum(1);
1425 outBytesWritten = 0;
1426 if (inRTPPkts.size() != inAncCounts.size())
1430 for (
AJAU32PktsConstIter RTPPktIter(inRTPPkts.begin()); RTPPktIter != inRTPPkts.end(); pktNum++)
1435 const bool isLastRTPPkt (++RTPPktIter == inRTPPkts.end());
1436 const size_t totalRTPPktBytes(AJARTPAncPayloadHeader::GetHeaderByteCount()
1437 + origRTPPkt.size() *
sizeof(uint32_t));
1438 ostringstream pktNumInfo;
1439 pktNumInfo <<
" for RTP pkt " <<
DEC(pktNum) <<
" of " <<
DEC(totPkts);
1442 if (inIsProgressive)
1450 RTPHeader.
SetPayloadLength(uint16_t(origRTPPkt.size() *
sizeof(uint32_t)));
1456 NTV2_ASSERT(RTPHeaderU32s.size() == AJARTPAncPayloadHeader::GetHeaderWordCount());
1461 if (!theBuffer.
PutU32s(RTPHeaderU32s, u32offset))
1462 {
LOGMYERROR(
"RTP hdr WriteBuffer failed for buffer " << theBuffer <<
" at u32offset=" <<
DEC(u32offset)
1465 u32offset +=
ULWord(RTPHeaderU32s.size());
1470 if (!theBuffer.
PutU32s(origRTPPkt, u32offset))
1471 {
LOGMYERROR(
"PutU32s failed writing " <<
DEC(origRTPPkt.size()) <<
" U32s in buffer " << theBuffer <<
" at u32offset=" <<
DEC(u32offset)
1473 LOGMYDEBUG(
"PutU32s OK @u32offset=" <<
xHEX0N(u32offset,4) <<
": " << RTPHeader << pktNumInfo.str());
1477 u32offset +=
ULWord(origRTPPkt.size());
1484 outBytesWritten = u32offset *
ULWord(
sizeof(uint32_t));
1486 LOGMYDEBUG(
DEC(totPkts) <<
" RTP pkt(s), " <<
DEC(u32offset) <<
" U32s (" <<
DEC(outBytesWritten)
1487 <<
" bytes) written for" << sFld << sPrg);
1493 const bool inIsProgressive,
const uint32_t inF2StartLine)
1498 uint32_t byteCount(0);
1501 F1Buffer.
Fill(uint64_t(0)); F2Buffer.
Fill(uint64_t(0));
1505 result =
GetRTPPackets (F1U32Pkts, F2U32Pkts, F1AncCounts, F2AncCounts, inIsProgressive, inF2StartLine);
1516 result =
WriteRTPPackets (F1Buffer, byteCount, F1U32Pkts, F1AncCounts,
false, inIsProgressive);
1521 if (!inIsProgressive)
1522 result =
WriteRTPPackets (F2Buffer, byteCount, F2U32Pkts, F2AncCounts,
true, inIsProgressive);
1530 const bool inIsProgressive,
const uint32_t inF2StartLine)
1532 outF1ByteCount = outF2ByteCount = 0;
1537 AJAStatus result (
GetRTPPackets (F1U32Pkts, F2U32Pkts, F1AncCounts, F2AncCounts, inIsProgressive, inF2StartLine));
1542 result =
WriteRTPPackets (nullBuffer, outF1ByteCount, F1U32Pkts, F1AncCounts,
false, inIsProgressive);
1544 result =
WriteRTPPackets (nullBuffer, outF2ByteCount, F2U32Pkts, F2AncCounts,
true, inIsProgressive);
1557 inOutStream <<
"Pkt" <<
DEC0N(++num,3) <<
": " << pPkt->
AsString(inDumpPayload ? 16 : 0);
1558 if (++it != m_ancList.end())
1559 inOutStream << endl;
1617 AJAAncillaryAnalogTypeMap::const_iterator it (
gAnalogTypeMap.find (inLineNum));
1619 ancType = it->second;
static AJALock gGlobalLock
virtual bool AllowMultiRTPReceive(void) const
Answers true if multiple RTP packets are allowed for capture/receive. The default behavior is to proc...
UByteSequence AJAAncPktCounts
Ordered sequence of SMPTE Anc packet counts.
@ AJAAncBufferFormat_FBVANC
Frame buffer VANC line.
@ AJA_STATUS_BADBUFFERSIZE
static string ULWordSequenceToStringBE(const ULWordSequence &inData, const size_t inMaxNum=32)
static bool SortByDID(AJAAncillaryData *lhs, AJAAncillaryData *rhs)
std::vector< AJAAncillaryData * > AJAAncillaryDataList
ULWordSequence::const_iterator ULWordSequenceConstIter
A handy const iterator for iterating over a ULWordSequence.
static AJAStatus ClearAnalogAncillaryDataTypeMap(void)
Clears my global Analog Ancillary Data Type map.
static bool BufferHasGUMPData(const NTV2Buffer &inBuffer)
virtual AJAStatus GetRawPacketSize(uint32_t &outPacketSize) const
Returns the number of "raw" ancillary data bytes that will be generated by AJAAncillaryData::Generate...
Defines where the ancillary data can be found within a video stream.
static AJAStatus AppendUWordPacketToGump(UByteSequence &outGumpPkt, const UWordSequence &inPacketWords, const AJAAncDataLoc inLoc=AJAAncDataLoc(AJAAncDataLink_A, AJAAncDataChannel_Y, AJAAncDataSpace_VANC, 0))
virtual AJAStatus AddVANCData(const UWordSequence &inPacketWords, const AJAAncillaryDataLocation &inLocation, const uint32_t inFrameNum=0)
Adds the packet that originated in the VANC lines of an NTV2 frame buffer to my list.
bool GetU32s(ULWordSequence &outU32s, const size_t inU32Offset=0, const size_t inMaxSize=32, const bool inByteSwap=false) const
Answers with my contents as a vector of unsigned 32-bit values.
virtual AJAStatus Compare(const AJAAncillaryList &inCompareList, const bool inIgnoreLocation=true, const bool inIgnoreChecksum=true) const
Compares me with another list.
virtual AJAStatus GetAncillaryDataTransmitData(const bool inIsProgressive, const uint32_t inF2StartLine, uint8_t *pOutF1AncData, const uint32_t inF1ByteCountMax, uint8_t *pOutF2AncData, const uint32_t inF2ByteCountMax)
Builds one or two ancillary data buffers (one for field 1, one for field 2) with the anc data inserte...
@ AJAAncDataType_Unknown
Includes data that is valid, but we don't recognize.
static AJAStatus SetAnalogAncillaryDataTypeMap(const AJAAncillaryAnalogTypeMap &inMap)
Copies the given map to the global Analog Ancillary Data Type map.
virtual AJAStatus RemoveAncillaryData(AJAAncillaryData *pInAncData)
Removes all copies of the AJAAncillaryData object from me.
static AJAStatus SetFromDeviceAncBuffers(const NTV2Buffer &inF1AncBuffer, const NTV2Buffer &inF2AncBuffer, AJAAncillaryList &outPackets, const uint32_t inFrameNum=0)
Returns all ancillary data packets found in the given F1 and F2 ancillary data buffers.
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
#define ToAJAAncPktDIDSID(_d_, _s_)
ULWord GetByteCount(void) const
#define NTV2_ASSERT(_expr_)
bool IsProvidedByClient(void) const
virtual AJAStatus GetIPTransmitData(NTV2Buffer &F1Buffer, NTV2Buffer &F2Buffer, const bool inIsProgressive=true, const uint32_t inF2StartLine=0)
Explicitly encodes my AJAAncillaryData packets into the given buffers in RTP Anc Buffer Data Format ....
std::vector< uint8_t > UByteSequence
An ordered sequence of UByte (uint8_t) values.
std::set< AJAAncPktDIDSID > AJAAncPktDIDSIDSet
Set of distinct packet DID/SIDs (New in SDK 16.0)
@ AncChannelSearch_C
Only look in chroma samples.
Declares the AJAAncillaryList class.
bool YUVComponentsTo10BitYUVPackedBuffer(const std::vector< uint16_t > &inYCbCrLine, NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inDescriptor, const UWord inLineOffset)
Packs up to one raster line of uint16_t YUV components into an NTV2_FBF_10BIT_YCBCR frame buffer.
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.
AJAU32Pkts::const_iterator AJAU32PktsConstIter
Handy const iterator over AJAU32Pkts.
AJAAncDataType
Identifies the ancillary data types that are known to this module.
virtual uint32_t CountAncillaryDataWithType(const AJAAncDataType inMatchType) const
Answers with the number of AJAAncillaryData objects having the given type.
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 Fo...
virtual AJAStatus ParseAllAncillaryData(void)
Sends a "ParsePayloadData" command to all of my AJAAncillaryData objects.
#define DEC0N(__x__, __n__)
virtual AJAAncillaryData * GetAncillaryDataWithID(const uint8_t inDID, const uint8_t inSID, const uint32_t inIndex=0) const
Answers with the AJAAncillaryData object having the given DataID and SecondaryID, at the given index.
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
Declaration of the AJAAncillaryDataFactory class.
bool PutU32s(const ULWordSequence &inU32s, const size_t inU32Offset=0, const bool inByteSwap=false)
Copies a vector of unsigned 32-bit values into me.
virtual AJAAncPktDIDSIDSet GetAncillaryPacketIDs(void) const
virtual AJAAncillaryData * GetAncillaryDataWithType(const AJAAncDataType inMatchType, const uint32_t inIndex=0) const
Answers with the AJAAncillaryData object having the given type and index.
static uint32_t ENDIAN_32NtoH(const uint32_t inValue)
#define AJA_ENDIAN_32NtoH(__val__)
I am an ordered collection of AJAAncillaryData instances which represent one or more SMPTE 291 data p...
virtual AJAStatus SortListBySID(void)
Sort the AncillaryDataList by Secondary ID (SID) value.
#define LOGMYDEBUG(__x__)
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 seque...
static void SetIncludeZeroLengthPackets(const bool inExclude)
Sets whether or not zero-length packets are included or not.
static AJAAncillaryData * Create(const AJAAncDataType inAncType, const AJAAncillaryData &inAncData)
Creates a new particular subtype of AJAAncillaryData object.
bool IsLumaChannel(void) const
static AJAStatus GetAnalogAncillaryDataTypeMap(AJAAncillaryAnalogTypeMap &outMap)
Returns a copy of the global Analog Ancillary Data Type map.
AJAAncillaryDataList::const_iterator AJAAncDataListConstIter
Handy const iterator for iterating over members of an AJAAncillaryDataList.
std::map< uint16_t, AJAAncDataType > AJAAncillaryAnalogTypeMap
Associates certain frame line numbers with specific types of "raw" or "analog" ancillary data....
AJAAncillaryDataList::iterator AJAAncDataListIter
Handy non-const iterator for iterating over members of an AJAAncillaryDataList.
Declares the AJALock class.
virtual AJAStatus Compare(const AJAAncillaryData &inRHS, const bool inIgnoreLocation=true, const bool inIgnoreChecksum=true) const
Compares me with another packet.
static AJALock gAnalogTypeMapMutex
virtual AJAStatus AddReceivedAncillaryData(const uint8_t *pInReceivedData, const uint32_t inByteCount, const uint32_t inFrameNum=0)
Parse "raw" ancillary data bytes received from hardware (ingest) – see SDI Anc Buffer Data Format – i...
I am the principal class that stores a single SMPTE-291 SDI ancillary data packet OR the digitized co...
virtual AJAStatus SortListByDID(void)
Sort the AncillaryDataList by DataID (DID) value.
@ AJAAncDataChannel_Y
The ancillary data is associated with the luminance (Y) channel of the video stream.
static uint32_t GetExcludedZeroLengthPacketCount(void)
virtual const uint8_t * GetPayloadData(void) const
UWordSequence::const_iterator UWordSequenceConstIter
A handy const iterator for iterating over a UWordSequence.
std::vector< uint16_t > UWordSequence
An ordered sequence of UWord (uint16_t) values.
static const size_t MAX_RTP_PKT_LENGTH_BYTES(0x0000FFFF)
static AJAStatus SetAnalogAncillaryDataTypeForLine(const uint16_t inLineNum, const AJAAncDataType inType)
Sets (or changes) the map entry for the designated line to the designated type.
bool UnpackLine_10BitYUVtoU16s(std::vector< uint16_t > &outYCbCrLine, const NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inDescriptor, const UWord inLineOffset)
Unpacks up to one raster line of an NTV2_FBF_10BIT_YCBCR frame buffer into an array of uint16_t value...
virtual AJAStatus DeleteAncillaryData(AJAAncillaryData *pInAncData)
Removes all copies of the AJAAncillaryData object from me and deletes the object itself.
static bool SortBySID(AJAAncillaryData *lhs, AJAAncillaryData *rhs)
const uint8_t AJAAncillaryDataWildcard_DID
static bool IsIncludingZeroLengthPackets(void)
virtual AJAStatus AppendPayload(const AJAAncillaryData &inAncData)
Appends payload data from another AJAAncillaryData object to my existing payload.
@ NTV2_FBF_8BIT_YCBCR
See 8-Bit YCbCr Format.
Declares numerous NTV2 utility functions.
std::vector< ULWordSequence > AJAU32Pkts
Ordered sequence of U32 RTP packets (U32s in network byte order)
#define AJA_SUCCESS(_status_)
virtual AJAAncillaryData * GetAncillaryDataAtIndex(const uint32_t inIndex) const
Answers with the AJAAncillaryData object at the given index.
virtual std::string AsString(const uint16_t inDumpMaxBytes=0) const
virtual AJAAncillaryData & SetBufferFormat(const AJAAncBufferFormat inFmt)
Sets my originating buffer format.
static void BumpZeroLengthPacketCount(void)
@ AJAAncBufferFormat_SDI
SDI ("GUMP").
virtual AJAStatus AddAncillaryData(const AJAAncillaryList &inPackets)
Appends a copy of the given list's packets to me.
#define LOGMYERROR(__x__)
struct AJAAncDataLoc AJAAncDataLoc
Defines where the ancillary data can be found within a video stream.
virtual std::ostream & Print(std::ostream &inOutStream, const bool inDetailed=true) const
Dumps a human-readable description of every packet in my list to the given output stream.
virtual bool AllowMultiRTPTransmit(void) const
Answers true if multiple RTP packets will be transmitted/encoded. The default behavior is to transmit...
virtual uint32_t CountAncillaryData(void) const
Answers with the number of AJAAncillaryData objects I contain (any/all types).
static AJAStatus WriteRTPPackets(NTV2Buffer &theBuffer, uint32_t &outBytesWritten, const AJAU32Pkts &inRTPPkts, const AJAAncPktCounts &inAncCounts, const bool inIsF2, const bool inIsProgressive)
Fills the buffer with the given RTP packets.
#define IS_VALID_AJAAncDataChannel(_x_)
static AJAAncDataType GetAnalogAncillaryDataTypeForLine(const uint16_t inLineNum)
Answers with the ancillary data type associated with the designated line.
virtual AJAStatus GetAncillaryDataTransmitSize(const bool inIsProgressive, const uint32_t inF2StartLine, uint32_t &outF1ByteCount, uint32_t &outF2ByteCount)
Answers with the sizes of the buffers (one for field 1, one for field 2) needed to hold the anc data ...
virtual ~AJAAncillaryList()
My destructor.
virtual std::string CompareWithInfo(const AJAAncillaryList &inCompareList, const bool inIgnoreLocation=true, const bool inIgnoreChecksum=true) const
Compares me with another list and returns a std::string that contains a human-readable explanation of...
AJAAncDataLoc & SetHorizontalOffset(uint16_t inHOffset)
Specifies the horizontal packet position in the raster.
AJAAncDataLink
Identifies which link of a video stream the ancillary data is associated with.
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
virtual AJAStatus GetVANCTransmitData(NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inFormatDesc)
Writes my AJAAncillaryData objects into the given tall/taller frame buffer having the given raster/fo...
void * GetHostPointer(void) const
std::string AsString(UWord inDumpMaxBytes=0) const
virtual uint32_t CountAncillaryDataWithID(const uint8_t inDID, const uint8_t inSID) const
Answers with the number of AncillaryData objects having the given DataID and SecondaryID.
virtual AJAAncillaryData & SetFrameID(const uint32_t inFrameID)
Sets my originating frame identifier.
@ NTV2_FBF_10BIT_YCBCR
See 10-Bit YCbCr Format.
static int32_t Increment(int32_t volatile *pTarget)
static bool gIncludeZeroLengthPackets(false)
ostream & operator<<(ostream &inOutStream, const AJAU32Pkts &inPkts)
static const size_t MAX_RTP_PKT_LENGTH_WORDS((MAX_RTP_PKT_LENGTH_BYTES+1)/sizeof(uint32_t) - 1)
virtual void Clear(void)
Frees my allocated memory, if any, and resets my members to their default values.
static ostream & PrintULWordsBE(ostream &inOutStream, const ULWordSequence &inData, const size_t inMaxNum=32)
static AJAAncillaryAnalogTypeMap gAnalogTypeMap
@ AJAAncDataChannel_C
The ancillary data is associated with the chrominance (C) channel of the video stream.
#define NTV2_IS_SD_STANDARD(__s__)
#define HEX0N(__x__, __n__)
std::string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay=false)
virtual AJAStatus ParsePayloadData(void)
Parses (interprets) the "local" ancillary data from my payload data.
static void ResetExcludedZeroLengthPacketCount(void)
Resets my tally of excluded zero-length packets to zero.
virtual AJAStatus GetTransmitData(NTV2Buffer &F1Buffer, NTV2Buffer &F2Buffer, const bool inIsProgressive=true, const uint32_t inF2StartLine=0)
Encodes my AJAAncillaryData packets into the given buffers in the default SDI Anc Buffer Data Format ...
const uint8_t AJAAncillaryDataWildcard_SID
std::string AJAStatusToString(const AJAStatus inStatus, const bool inDetailed)
virtual AJAStatus SortListByLocation(void)
Sort the AncillaryDataList by "location", i.e. where in the video (field, line num,...
std::vector< uint32_t > ULWordSequence
An ordered sequence of ULWord (uint32_t) values.
static AJAAncDataType GuessAncillaryDataType(const AJAAncillaryData &inAncData)
Given a generic AJAAncillaryData object, attempts to guess what kind of specific AJAAncillaryData obj...
Declares the AJAAtomic class.
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 F...
static bool SortByLocation(AJAAncillaryData *lhs, AJAAncillaryData *rhs)
virtual AJAAncillaryList & operator=(const AJAAncillaryList &inRHS)
Assignment operator – replaces my contents with the right-hand-side value.
virtual AJAAncillaryData * Clone(void) const
@ AJAAncDataCoding_Digital
The ancillary data is in the form of a SMPTE-291 Ancillary Packet.
static uint32_t gExcludedZeroLengthPackets(0)
virtual AJAAncDataType GetAnalogAncillaryDataType(const AJAAncillaryData &inAncData)
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.
AJAAncillaryList()
Instantiate and initialize with a default set of values.
@ AJAAncBufferFormat_RTP
RTP/IP.
bool Fill(const T &inValue)
Fills me with the given scalar value.
@ AJAAncDataSpace_VANC
Ancillary data found between SAV and EAV (.
virtual AJAStatus Clear(void)
Removes and frees all of my AJAAncillaryData objects.
virtual AJAStatus GetIPTransmitDataLength(uint32_t &outF1ByteCount, uint32_t &outF2ByteCount, const bool inIsProgressive=true, const uint32_t inF2StartLine=0)
Answers with the number of bytes required to store IP/RTP for my AJAAncillaryData packets in RTP Anc ...
@ AJA_STATUS_BADBUFFERCOUNT
virtual bool IgnoreChecksumErrors(void) const
Answers if checksum errors are to be ignored or not. The default behavior is to not ignore them.
#define xHEX0N(__x__, __n__)
#define AJA_FAILURE(_status_)
@ AJAAncDataType_Cea608_Line21
CEA608 SD Closed Captioning ("Line 21" waveform)
static AJAStatus AddFromDeviceAncBuffer(const NTV2Buffer &inAncBuffer, AJAAncillaryList &outPacketList, const uint32_t inFrameNum=0)
Appends whatever can be decoded from the given device Anc buffer to the AJAAncillaryList.
#define IS_VALID_AJAAncDataType(_x_)
virtual AJAStatus GetRTPPackets(AJAU32Pkts &outF1U32Pkts, AJAU32Pkts &outF2U32Pkts, AJAAncPktCounts &outF1AncCounts, AJAAncPktCounts &outF2AncCounts, const bool inIsProgressive, const uint32_t inF2StartLine)
Answers with my F1 & F2 SMPTE anc packets encoded as RTP ULWordSequences. The returned ULWords are al...
AJAAncPktDIDSIDSet::const_iterator AJAAncPktDIDSIDSetConstIter
Handy const iterator for AJAAncPktDIDSIDSet (New in SDK 16.0)
static const uint32_t MAX_ANC_PKTS_PER_RTP_PKT(0x000000FF)
@ AJAAncDataLink_A
The ancillary data is associated with Link A of the video stream.
@ AJAAncDataChannel_Both
SD ONLY – The ancillary data is associated with both the chroma and luma channels.
std::vector< U16Packet > U16Packets
An ordered sequence of zero or more U16Packet values.
Declares the AJADebug class.
@ AncChannelSearch_Both
Look both luma and chroma samples (SD only)
bool Set(const void *pInUserPointer, const size_t inByteCount)
Sets (or resets) me from a client-supplied address and size.
static AJAStatus SetFromVANCData(const NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inFormatDesc, AJAAncillaryList &outPackets, const uint32_t inFrameNum=0)
Returns all packets found in the VANC lines of the given NTV2 frame buffer.
#define DECN(__x__, __n__)
AJAAncDataSpace GetDataSpace(void) const
@ AncChannelSearch_Y
Only look in luma samples.