Beispiel #1
0
        public override void Parse(byte[] data)
        {
            base.Parse(data);

            this.originalNetworkId = (ushort)(data[8] << 8 | data[9]);
            this.reserved3         = data[10];

            int offset = 11;

            while (offset < SectionLength - 1)
            {
                Data sdtData = new Data();
                sdtData.ServiceId               = (ushort)((data[offset] << 8) + data[offset + 1]);
                sdtData.Reserved                = (byte)(data[offset + 2] >> 2);
                sdtData.EitScheduleFlag         = ((data[offset + 2] & 0x02) != 0);
                sdtData.EitPresentFollowingFlag = ((data[offset + 2] & 0x01) != 0);
                sdtData.RunningStatus           = (Data.RUNNING_STATUS)((data[offset + 3] >> 5) & 0x07);
                sdtData.FreeCaMode              = (((data[offset + 3] >> 4) & 0x01) != 0);
                sdtData.DescriptorsLoopLength   = (ushort)(((data[offset + 3] & 0x0F) << 8) | data[offset + 4]);
                sdtData.Descriptors             = PSIDescriptor.ParseDescriptors(data, offset + 5, sdtData.DescriptorsLoopLength);

                this.services.Add(sdtData);
                offset += sdtData.DescriptorsLoopLength + 5;
            }
        }
Beispiel #2
0
        public override void Parse(byte[] data)
        {
            base.Parse(data);

            this.reserved3         = (byte)(data[8] >> 5);
            this.pcrPid            = (ushort)((data[8] & 0x1F) << 8 | data[9]);
            this.reserved4         = (byte)(data[10] >> 4);
            this.programInfoLength = (byte)((data[10] & 0x0F) << 8 | data[11]);
            int offset = 12;

            if (this.programInfoLength > 0)
            {
                // Parse program descriptors
                this.descriptors = PSIDescriptor.ParseDescriptors(data, offset, this.programInfoLength);
            }


            offset += this.programInfoLength;
            int streamLen = data.Length - this.programInfoLength - 16;

            while (streamLen >= 5)
            {
                Data pmtData = new Data();
                pmtData.StreamType  = (STREAM_TYPES)data[offset];
                pmtData.Pid         = (ushort)(((data[offset + 1] & 0x1F) << 8) + data[offset + 2]);
                pmtData.EsInfoLen   = (ushort)(((data[offset + 3] & 0x0F) << 8) + data[offset + 4]);
                pmtData.Descriptors = PSIDescriptor.ParseDescriptors(data, offset + 5, pmtData.EsInfoLen);

                this.streams.Add(pmtData);
                this.streamsByType[pmtData.StreamType] = pmtData;
                offset    += pmtData.EsInfoLen + 5;
                streamLen -= pmtData.EsInfoLen + 5;
            }
        }
Beispiel #3
0
        public override void Parse(byte[] data)
        {
            base.Parse(data);
            this.reserved3 = (byte)(data[8] >> 4);
            this.networkDescriptorLength = (byte)(((data[8] & 0x0F) << 8) | (data[9]));

            int offset = 10;             //taille de l'entete de la table

            if (this.NetworkDescriptorLength > 0)
            {
                // Parse program descriptors
                this.descriptors = PSIDescriptor.ParseDescriptors(data, offset, this.NetworkDescriptorLength);
            }

            offset        += this.NetworkDescriptorLength; // rajout la taille du tableau de descriptors
            this.reserved4 = (byte)(data[offset] >> 4);
            this.transportStreamLoopLength = (ushort)(((data[offset] & 0x0F) << 8) | (data[offset + 1]));

            offset += 2;             //rajout de la taille de reserved4 et de transportStreamLoopLength
            int streamLen = data.Length - this.NetworkDescriptorLength - 14;

            //int streamLen = this.transportStreamLoopLength;
            while (streamLen >= 6)
            {
                Data nitData = new Data();
                nitData.TransportStreamId         = (ushort)(((data[offset]) << 8) | (data[offset + 1]));
                nitData.OriginalNetworkId         = (ushort)(((data[offset + 2]) << 8) | (data[offset + 3]));;
                nitData.Reserved1                 = (byte)(data[offset + 4] >> 4);
                nitData.TransportDescriptorLenght = (ushort)((((data[offset + 4]) & 0x0F) << 8) | (data[offset + 5]));
                nitData.Descriptors               = PSIDescriptor.ParseDescriptors(data, offset + 6, nitData.TransportDescriptorLenght);

                this.streams.Add(nitData);
                offset    += nitData.TransportDescriptorLenght + 6;             //offset increnté de la taille de la loop
                streamLen -= nitData.TransportDescriptorLenght + 6;             // taille de la loop restante décrémenté
            }
        }