Пример #1
0
 public TsProgram(ushort programNumber, TableStream programMapStream)
 {
     ProgramNumber    = programNumber;
     ProgramMapStream = programMapStream;
     ProgramMapStream.UnitReceived += ProgramMapTableReceived;
     Streams = Portability.CreateList <TsStream>();
 }
Пример #2
0
        public DescriptionTable(byte[] buffer, int offset, int length) : base(buffer, offset, length)
        {
            Descriptors = Portability.CreateList <TsDescriptor>();

            while (_position < _sectionLengthStartOffset + SectionLength - 4 && _position < offset + length - 4)
            {
                var descriptor = new UnknownDescriptor(buffer, _position);
                Descriptors.Add(descriptor);
                _position += descriptor.Length;
            }
        }
Пример #3
0
        public ProgramMap(byte[] buffer, int offset)
        {
            var position = offset;

            StreamType       = (StreamType)buffer[position++];
            PacketIdentifier = (ushort)(((buffer[position++] << 8) | buffer[position++]) & 0x1FFF);
            var streamInfoLength = (ushort)(((buffer[position++] << 8) | buffer[position++]) & 0x0FFF);

            StreamInfo = Portability.CreateList <TsDescriptor>();
            var descriptorEndPosition = position + streamInfoLength;

            while (position < descriptorEndPosition)
            {
                var descriptor = new UnknownDescriptor(buffer, position);
                StreamInfo.Add(descriptor);
                position += descriptor.Length;
            }
        }
Пример #4
0
        public TsDemuxer()
        {
            Programs = Portability.CreateList <TsProgram>();

            var programAssociationStream = new TableStream()
            {
                PacketIdentifier = (ushort)PacketIdentifier.ProgramAssociationTable
            };

            programAssociationStream.UnitReceived += ProgramAssociationTableReceived;
            _streams.Add((ushort)PacketIdentifier.ProgramAssociationTable, programAssociationStream);

            var descriptionStream = new TableStream()
            {
                PacketIdentifier = (ushort)PacketIdentifier.TsDescriptionTable
            };

            descriptionStream.UnitReceived += DescriptionTableReceived;
            _streams.Add((ushort)PacketIdentifier.TsDescriptionTable, descriptionStream);
        }
Пример #5
0
        public ProgramMapTable(byte[] buffer, int offset, int length)
            : base(buffer, offset, length)
        {
            _programClockReferencePid = (ushort)((buffer[_position++] << 8) | buffer[_position++]);
            _programInfoLength        = (ushort)((buffer[_position++] << 8) | buffer[_position++]);

            ProgramInfo = Portability.CreateList <TsDescriptor>();
            var descriptorEndPosition = _position + ProgramInfoLength;

            while (_position < descriptorEndPosition)
            {
                var descriptor = new UnknownDescriptor(buffer, _position);
                ProgramInfo.Add(descriptor);
                _position += descriptor.Length;
            }

            while (_position < _sectionLengthStartOffset + SectionLength - 4 && _position < offset + length - 4)
            {
                var row = new ProgramMap(buffer, _position);
                _position += row.Length;
                Rows.Add(row);
            }
        }
Пример #6
0
 public TsUnit(IEnumerable <TsPacket> packets)
 {
     _packets = Portability.CreateList(packets);
     _payload = new TsUnitPayload(_packets);
 }
Пример #7
0
 public TsUnit(int capacity)
 {
     _packets = Portability.CreateList <TsPacket>(capacity);
     _payload = new TsUnitPayload(_packets);
 }