コード例 #1
0
ファイル: ManagerService.cs プロジェクト: ioxuy/TSE
        private Result FindAllCaDescriptor(DataStore section, ref Int64 bitoffset, List <CaDescriptor> descriptorList, ref Int64 descriptorLoopLength)
        {
            Result result           = new Result();
            Int64  descriptorTag    = 0;
            Int64  descriptorLength = 0;
            Int64  caSystemId       = 0;
            Int64  caPid            = 0;


            while (descriptorLoopLength > 0)
            {
                result = section.ReadBits(ref bitoffset, 8, ref descriptorTag);

                if (result.Fine)
                {
                    result = section.ReadBits(ref bitoffset, 8, ref descriptorLength);
                }

                if (result.Fine)
                {
                    if (descriptorTag == 0x09)
                    {
                        result = section.ReadBits(ref bitoffset, 16, ref caSystemId);

                        if (result.Fine)
                        {
                            result = section.SkipBits(ref bitoffset, 3);
                        }

                        if (result.Fine)
                        {
                            result = section.ReadBits(ref bitoffset, 13, ref caPid);
                        }

                        if (result.Fine)
                        {
                            result = section.SkipBits(ref bitoffset, (descriptorLength - 4) * 8);
                        }

                        if (result.Fine)
                        {
                            //Add it into the program level descriptor.

                            CaDescriptor caDescriptor = new CaDescriptor();
                            caDescriptor.CaPid      = (UInt16)caPid;
                            caDescriptor.CaSystemId = (UInt16)caSystemId;

                            descriptorList.Add(caDescriptor);
                        }
                    }
                    else
                    {
                        //Skip the payload.
                        result = section.SkipBits(ref bitoffset, descriptorLength * 8);
                    }
                }

                if (result.Fine)
                {
                    descriptorLoopLength -= (2 + descriptorLength);//Decrease by the length of the whole descriptor.
                }
                else
                {
                    break;
                }
            }

            if (result.Fine)
            {
                if (descriptorLoopLength != 0)
                {
                    //We expect no data left at the end.
                    result.SetResult(ResultCode.INVALID_DATA);
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: Service.cs プロジェクト: ioxuy/TSE
 public void AddProgramLevelCaDescriptor(CaDescriptor caDescriptor)
 {
     programLevelCaDescriptorList.Add(caDescriptor);
 }