public static string ToTextualConvention(TransportStreamReader reader, byte[] identifier) { TransportStreamUnit.PacketIdentifier result = TransportStreamUnit.GetPacketIdentifier(identifier, reader.UnitOverhead); if (TransportStreamUnit.IsReserved(result)) { return("Reserved"); } if (TransportStreamUnit.IsDVBMetaData(result)) { return("DVBMetaData"); } if (TransportStreamUnit.IsUserDefined(result)) { return("UserDefined"); } return(result.ToString()); }
public static bool HasPayloadUnitStartIndicator(TransportStreamReader reader, Container.Node tsUnit) { return(TransportStreamUnit.HasPayloadUnitStartIndicator(tsUnit.Identifier, reader.UnitOverhead)); }
//Static and take reader? //Maps from Program to PacketIdentifer? internal protected virtual void ParseProgramAssociationTable(Container.Node node) { int offset = ReadPointerField(node); //Get the table id TransportStreamUnit.TableIdentifier tableId = (TransportStreamUnit.TableIdentifier)node.Data[offset++]; if (tableId != TransportStreamUnit.TableIdentifier.ProgramAssociation) { return; } /* * Program Association Table (PAT) section syntax * syntax bit index # of bits mnemonic * table_id 0 8 uimsbf * section_syntax_indicator 8 1 bslbf * '0' 9 1 bslbf * reserved 10 2 bslbf * section_length 12 12 uimsbf * transport_stream_id 24 16 uimsbf * reserved 40 2 bslbf * version_number 42 5 uimsbf * current_next_indicator 47 1 bslbf * section_number 48 8 bslbf * last_section_number 56 8 bslbf * for i = 0 to N * program_number 56 + (i * 4) 16 uimsbf * reserved 72 + (i * 4) 3 bslbf * if program_number = 0 * network_PID 75 + (i * 4) 13 uimsbf * else * program_map_pid 75 + (i * 4) 13 uimsbf * end if * next * CRC_32 88 + (i * 4) 32 rpchof * Table section legend */ //section syntax indicator, 0 bit, and 2 reserved bits. //Section Length The number of bytes that follow for the syntax section (with CRC value) and/or table data. These bytes must not exceed a value of 1021. // section_length field is a 12-bit field that gives the length of the table section beyond this field //Since it is carried starting at bit index 12 in the section (the second and third bytes), the actual size of the table section is section_length + 3. ushort sectionLength = (ushort)(Common.Binary.ReadU16(node.Data, ref offset, Common.Binary.IsLittleEndian) & 0x0FFF); //transport_stream_id 24 16 uimsbf ushort transportStreamId = (ushort)(Common.Binary.ReadU16(node.Data, ref offset, Common.Binary.IsLittleEndian) & 0x0FFF); //Skip reserved, version number and current/next indicator. ++offset; //Skip section number ++offset; //Skip last section number ++offset; //Determine where to end (don't count the crc) int end = (sectionLength + 3) - 4; //4 bytes per ProgramInfo in node.Data while (offset < end) { //2 Bytes ProgramNumber ushort programNumber = Common.Binary.ReadU16(node.Data, offset, Common.Binary.IsLittleEndian); //3 bits reserved //2 Bytes ProgramID TransportStreamUnit.PacketIdentifier pid = TransportStreamUnit.GetPacketIdentifier(node.Data, offset + 2); //Add or update the entry m_ProgramAssociations.AddOrUpdate(programNumber, pid, (id, old) => pid); //Move the offset offset += 4; } //CRC }
public static int GetContinuityCounter(TransportStreamReader reader, Container.Node tsUnit) { return(TransportStreamUnit.GetContinuityCounter(tsUnit.Identifier, reader.UnitOverhead)); }
public static TransportStreamUnit.ScramblingControl GetScramblingControl(TransportStreamReader reader, Container.Node tsUnit) { return(TransportStreamUnit.GetScramblingControl(tsUnit.Identifier, reader.UnitOverhead)); }
public static bool HasAdaptationField(TransportStreamReader reader, Container.Node tsUnit) { return(TransportStreamUnit.GetAdaptationFieldControl(tsUnit.Identifier, reader.UnitOverhead) > TransportStreamUnit.AdaptationFieldControl.None); }
public static TransportStreamUnit.PacketIdentifier GetPacketIdentifier(TransportStreamReader reader, byte[] identifier) { return(TransportStreamUnit.GetPacketIdentifier(identifier, reader.UnitOverhead)); }
public static bool HasTransportPriority(TransportStreamReader reader, Container.Node tsUnit) { return(TransportStreamUnit.HasTransportPriority(tsUnit.Identifier, reader.UnitOverhead)); }