public Smpte291M(byte[] bytes) { DataId = bytes[0]; SecondaryDataId = bytes[1]; DataCount = bytes[2]; CaptionDistributionPacketId = (bytes[3] << 8) + bytes[4]; CaptionDistributionPacketDataCount = bytes[5]; CaptionDistributionPacketFramingRate = (bytes[6] >> 4); CaptionDistributionPacketTimeCodeAdded = (bytes[7] & 0b10000000) > 0; CaptionDistributionPacketDataBlockAdded = (bytes[7] & 0b01000000) > 0; CaptionDistributionPacketServiceInfoAdded = (bytes[7] & 0b00100000) > 0; CaptionDistributionPacketServiceInfoStart = (bytes[7] & 0b00010000) > 0; CaptionDistributionPacketServiceInfoChanged = (bytes[7] & 0b00001000) > 0; CaptionDistributionPacketServiceInfoEnd = (bytes[7] & 0b00000100) > 0; CaptionDistributionPacketContainsCaptions = (bytes[7] & 0b00000010) > 0; CaptionDistributionPacketHeaderSequenceCounter = (bytes[8] << 8) + bytes[9]; CaptionDistributionPacketDataSection = bytes[10]; CaptionDistributionPacketCcData = new CaptionDistributionPacket(bytes, 10); var idx = 9 + CaptionDistributionPacketCcData.GetLength(); if (CaptionDistributionPacketServiceInfoAdded) { CcServiceInfoSection = new CcServiceInfoSection(bytes, idx + 1); idx += CcServiceInfoSection.GetLength(); } CaptionDistributionPacketFooterSection = bytes[1 + idx]; CaptionDistributionPacketHeaderSequenceCounter2 = (bytes[2 + idx] << 8) + bytes[3 + idx]; CaptionDistributionPacketChecksum = bytes[4 + idx]; _state = new CommandState(); }
public Smpte291M(int sequenceCount, int ccDataCount, byte[] bytes) { DataId = 0x61; SecondaryDataId = 1; DataCount = 0x59; CaptionDistributionPacketId = 0x9669; CaptionDistributionPacketDataCount = 0x59; CaptionDistributionPacketFramingRate = 4; // 29.97 CaptionDistributionPacketTimeCodeAdded = false; CaptionDistributionPacketDataBlockAdded = true; CaptionDistributionPacketServiceInfoAdded = true; CaptionDistributionPacketServiceInfoStart = true; CaptionDistributionPacketServiceInfoChanged = true; CaptionDistributionPacketServiceInfoEnd = true; CaptionDistributionPacketContainsCaptions = true; CaptionDistributionPacketHeaderSequenceCounter = sequenceCount; CcDataSectionCcData = new CcDataSection(ccDataCount, bytes); CcServiceInfoSection = new CcServiceInfoSection(); }