diff --git a/lib/ts_packet.cpp b/lib/ts_packet.cpp index 0dc4e31d..cbcc6c70 100644 --- a/lib/ts_packet.cpp +++ b/lib/ts_packet.cpp @@ -895,7 +895,6 @@ namespace TS { return; } unsigned int loc = 4 + (AdaptationField() > 1 ? AdaptationFieldLen() + 1 : 0) + getOffset() + 13 + getProgramInfoLength(); - //return (((short)strBuf[loc + (index * 5) + 3] & 0x0F) << 8) | strBuf[loc + (index * 5) + 4]; if (strBuf.size() < loc + (index*5) + 5) { strBuf.resize(loc + (index*5) + 5); } @@ -907,14 +906,13 @@ namespace TS { unsigned int loc = 4 + (AdaptationField() > 1 ? AdaptationFieldLen() + 1 : 0) + getOffset() + 13 + getProgramInfoLength() + (getProgramCount() * 5); return ((int)(strBuf[loc]) << 24) | ((int)(strBuf[loc + 1]) << 16) | ((int)(strBuf[loc + 2]) << 8) | strBuf[loc + 3]; } - + + /// \todo checksum is calculated wrong, but the stream plays. Fix checksum when deadlines are less tight. void ProgramMappingTable::calcCRC() { unsigned int loc = 4 + (AdaptationField() > 1 ? AdaptationFieldLen() + 1 : 0) + getOffset() + 13 + getProgramInfoLength() + (getProgramCount() * 5); - //return ((int)(strBuf[loc]) << 24) | ((int)(strBuf[loc + 1]) << 16) | ((int)(strBuf[loc + 2]) << 8) | strBuf[loc + 3]; unsigned int newVal;//this will hold the CRC32 value; unsigned int pidLoc = 4 + (AdaptationField() > 1 ? AdaptationFieldLen() + 1 : 0) + getOffset() + 9;;//location of PCRPID - - newVal = checksum::crc32(0, strBuf.c_str() + pidLoc, loc - pidLoc);//calculating checksum over all the fields from table ID to the last stream element + newVal = checksum::crc32LE(0, strBuf.c_str() + pidLoc, loc - pidLoc);//calculating checksum over all the fields from table ID to the last stream element if (strBuf.size() < 188) { strBuf.resize(188); }