예제 #1
0
        private void ClearProgram(TsProgramMapTable.ProgramMap program)
        {
            this._decoder.UnregisterHandler(program.Pid);
            TsPacketizedElementaryStream elementaryStream = program.Stream;

            if (null != elementaryStream)
            {
                elementaryStream.Clear();
            }
            Debug.Assert(this._programStreamMap.Remove(program.Pid));
        }
예제 #2
0
        protected override void ParseSection(TsPacket packet, int offset, int length)
        {
            if (length < 9)
            {
                return;
            }
            int index1 = offset;

            byte[] buffer = packet.Buffer;
            int    num1   = (int)buffer[index1] << 8 | (int)buffer[index1 + 1];
            int    num2   = index1 + 2;

            byte[] numArray1 = buffer;
            int    index2    = num2;
            int    num3      = 1;
            int    num4      = index2 + num3;
            byte   num5      = numArray1[index2];
            bool   flag      = 0 != ((int)num5 & 1);
            byte   num6      = (byte)((uint)(byte)((uint)num5 >> 1) & 31U);

            byte[] numArray2 = buffer;
            int    index3    = num4;
            int    num7      = 1;
            int    num8      = index3 + num7;
            byte   num9      = numArray2[index3];

            byte[] numArray3 = buffer;
            int    index4    = num8;
            int    num10     = 1;
            int    index5    = index4 + num10;
            byte   num11     = numArray3[index4];

            if ((int)num11 < (int)num9)
            {
                return;
            }
            uint num12  = (uint)buffer[index5] << 8 | (uint)buffer[index5 + 1];
            int  index6 = index5 + 2;

            this._pcrPid = num12 & 8191U;
            int num13   = (int)buffer[index6] << 8 | (int)buffer[index6 + 1];
            int offset1 = index6 + 2;
            int length1 = num13 & 4095;

            if (offset1 - offset + length1 >= length)
            {
                return;
            }
            TsDescriptor[] tsDescriptorArray1 = (TsDescriptor[])null;
            if (length1 > 0)
            {
                tsDescriptorArray1 = Enumerable.ToArray <TsDescriptor>(TsDescriptors.Parse(this._descriptorFactory, buffer, offset1, length1));
            }
            this._newProgramDescriptors = tsDescriptorArray1;
            int num14 = offset1 + length1;
            int num15 = offset + length;

            while (num14 + 5 <= num15)
            {
                byte[] numArray4   = buffer;
                int    index7      = num14;
                int    num16       = 1;
                int    index8      = index7 + num16;
                byte   streamType1 = numArray4[index7];
                uint   num17       = (uint)buffer[index8] << 8 | (uint)buffer[index8 + 1];
                int    index9      = index8 + 2;
                uint   index10     = num17 & 8191U;
                int    num18       = (int)buffer[index9] << 8 | (int)buffer[index9 + 1];
                int    offset2     = index9 + 2;
                int    length2     = num18 & 4095;
                if (offset2 + length2 > num15)
                {
                    return;
                }
                TsDescriptor[] tsDescriptorArray2 = (TsDescriptor[])null;
                if (length2 > 0)
                {
                    tsDescriptorArray2 = Enumerable.ToArray <TsDescriptor>(TsDescriptors.Parse(this._descriptorFactory, buffer, offset2, length2));
                }
                num14 = offset2 + length2;
                TsStreamType streamType2 = TsStreamType.FindStreamType(streamType1);
                TsProgramMapTable.ProgramMap programMap = new TsProgramMapTable.ProgramMap()
                {
                    Pid               = index10,
                    StreamType        = streamType2,
                    StreamDescriptors = tsDescriptorArray2
                };
                this._newProgramStreams[index10] = programMap;
            }
            if ((int)num9 != (int)num11)
            {
                return;
            }
            this.MapProgramStreams();
        }