コード例 #1
0
        public void ParseServiceMultiplexConfigTable(int offset, Stream _stream)
        {
            // 开始解析复用配置表
            _stream.Seek(offset, SeekOrigin.Begin);
            _stream.Seek(3, SeekOrigin.Current);

            // 读取Multiplex frame number, (6 bit)
            byte[] tmp = new byte[4];
            _stream.Read(tmp, 0, 1);
            _msConfigTable                = new ContinualServiceConfigTable();
            _msConfigTable.mpFameNum      = (uint)BitTools.MaskBits(tmp, 2, 6);
            _msConfigTable.mfConfigTables = new List <MUXConfigTable>();

            for (int i = 0; i < _msConfigTable.mpFameNum; i++)
            {
                //读取每个MF的信息配置表,RS, LDPC, mode
                MUXConfigTable mftmp = new MUXConfigTable();

                _stream.Read(tmp, 0, 1);
                mftmp.RSCodec = (uint)BitTools.MaskBits(tmp, 6, 2);
                _stream.Read(tmp, 0, 2);

                mftmp.LDPC   = (uint)BitTools.MaskBits(tmp, 2, 2);
                mftmp.mode   = (uint)BitTools.MaskBits(tmp, 4, 2);
                mftmp.TS_num = (uint)BitTools.MaskBits(tmp, 10, 6);

                _msConfigTable.mfConfigTables.Add(mftmp);

                for (int j = 0; j < mftmp.TS_num; j++)
                {
                    // skip 时隙号 和 保留,1 byte
                    _stream.Seek(1, SeekOrigin.Current);
                }

                //读复用子帧数
                _stream.Read(tmp, 0, 1);
                int subnumber = BitTools.MaskBits(tmp, 4, 4);

                for (int m = 0; m < subnumber; m++)
                {
                    // skip 子帧号,。。。3 bytes
                    _stream.Seek(3, SeekOrigin.Current);
                }
            }
            // skip CRC_32
            _stream.Seek(CRC_Size, SeekOrigin.Current);
        }
コード例 #2
0
ファイル: CmmbDemux.cs プロジェクト: yspxman/CMTVDemo
        public void ParseServiceMultiplexConfigTable(int offset, Stream _stream)
        {
            // 开始解析复用配置表
            _stream.Seek(offset, SeekOrigin.Begin);
            _stream.Seek(3, SeekOrigin.Current);

            // 读取Multiplex frame number, (6 bit)
            byte[] tmp = new byte[4];
            _stream.Read(tmp, 0, 1);
            _msConfigTable = new ContinualServiceConfigTable();
            _msConfigTable.mpFameNum = (uint)BitTools.MaskBits(tmp, 2, 6);
            _msConfigTable.mfConfigTables = new List<MUXConfigTable>();

            for (int i = 0; i < _msConfigTable.mpFameNum; i++)
            {
                //读取每个MF的信息配置表,RS, LDPC, mode
                MUXConfigTable mftmp = new MUXConfigTable();

                _stream.Read(tmp, 0, 1);
                mftmp.RSCodec = (uint)BitTools.MaskBits(tmp, 6, 2);
                _stream.Read(tmp, 0, 2);

                mftmp.LDPC = (uint)BitTools.MaskBits(tmp, 2, 2);
                mftmp.mode = (uint)BitTools.MaskBits(tmp, 4, 2);
                mftmp.TS_num = (uint)BitTools.MaskBits(tmp, 10, 6);

                _msConfigTable.mfConfigTables.Add(mftmp);

                for (int j = 0; j < mftmp.TS_num; j++)
                {
                    // skip 时隙号 和 保留,1 byte
                    _stream.Seek(1, SeekOrigin.Current);
                }

                //读复用子帧数
                _stream.Read(tmp, 0, 1);
                int subnumber = BitTools.MaskBits(tmp, 4, 4);

                for (int m = 0; m < subnumber; m++)
                {
                    // skip 子帧号,。。。3 bytes
                    _stream.Seek(3, SeekOrigin.Current);
                }
            }
            // skip CRC_32
            _stream.Seek(CRC_Size, SeekOrigin.Current);
        }