bool CExtradataParser::NextMPEGStartCode(BYTE &code) { BitByteAlign(); DWORD dw = (DWORD)-1; do { if(!Remaining()) return false; dw = (dw << 8) | (BYTE)BitRead(8); } while((dw&0xffffff00) != 0x00000100); code = (BYTE)(dw&0xff); return true; }
bool CDSMSplitterFile::Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit) { BitByteAlign(); limit += DSMSW_SIZE; for (UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8)) { if (limit-- <= 0 || GetRemaining() <= 2) { return false; } } syncpos = GetPos() - (DSMSW_SIZE<<3); type = (dsmp_t)BitRead(5); len = BitRead(((int)BitRead(3)+1)<<3); return true; }