Beispiel #1
0
        public static PSISection ParseTable(int tableId, byte[] data)
        {
            PSISection table;

            switch ((TABLE_IDS)tableId)
            {
            case TABLE_IDS.PAT:
                table = new PSIPAT(); break;

            case TABLE_IDS.SDT_ACTUAL:
                table = new PSISDT(); break;

            case TABLE_IDS.PMT:
                table = new PSIPMT(); break;

            case TABLE_IDS.NIT_ACTUAL:
                table = new PSINIT(); break;

            default:
                table = new PSISection();
                break;
            }
            table.Parse(data);
            return(table);
        }
Beispiel #2
0
        public override string ToStringDescriptorOnly(string prefix)
        {
            string result = "";

            result += base.ToStringDescriptorOnly(prefix);
            result += prefix + "DataBroadcastId: " + string.Format(" 0x{0:x4} ({1})\r\n", this.dataBroadcastId, this.dataBroadcastId);
            result += PSISection.ToStringByteArray(this.idSelectorBytes, 0, this.idSelectorBytes.Length, 8, prefix);
            return(result);
        }
Beispiel #3
0
        public override string ToStringDescriptorOnly(string prefix)
        {
            string result = "";

            result += base.ToStringDescriptorOnly(prefix);
            result += prefix + "CaSystemId: " + string.Format(" 0x{0:x4} ({1})\r\n", this.caSystemId, this.caSystemId);
            result += prefix + "Reserved: " + string.Format(" 0x{0:x4} ({1})\r\n", this.reserved, this.reserved);
            result += prefix + "CaPid: " + string.Format(" 0x{0:x4} ({1})\r\n", this.caPid, this.caPid);
            result += PSISection.ToStringByteArray(this.privateDataBytes, 0, this.privateDataBytes.Length, 8, prefix);
            return(result);
        }
Beispiel #4
0
        public virtual string ToStringDescriptorOnly(string prefix)
        {
            string result = "";

            result += prefix + "DescriptorTag: " + this.descriptorTag + string.Format(" 0x{0:x4} ({1})\r\n", (uint)this.descriptorTag, (uint)this.descriptorTag);
            result += prefix + "DescriptorLength: " + this.descriptorLength + "\r\n";
            if (this.unparseData != null)
            {
                result += PSISection.ToStringByteArray(this.unparseData, 0, this.unparseData.Length, 8, prefix);
            }
            return(result);
        }
Beispiel #5
0
        public static PSISection[] GetPSITable(int pid, int tableId, IMpeg2Data mpeg2Data)
        {
            ArrayList    al = new ArrayList();
            ISectionList ppSectionList;
            int          hr = mpeg2Data.GetTable((short)pid, (byte)tableId, null, 5000, out ppSectionList);

            if (ppSectionList != null)
            {
                short pidFound = -1;
                ppSectionList.GetProgramIdentifier(out pidFound);
                if (pidFound == (short)pid)
                {
                    byte tableIdFound = 0;
                    ppSectionList.GetTableIdentifier(out tableIdFound);
                    if (tableIdFound == (byte)tableId)
                    {
                        short sectionCount = -1;
                        ppSectionList.GetNumberOfSections(out sectionCount);

                        short sectionNumber = 0;
                        for (; sectionNumber < sectionCount; sectionNumber++)
                        {
                            int    pdwRawPacketLength;
                            IntPtr ppSection;
                            ppSectionList.GetSectionData(sectionNumber, out pdwRawPacketLength, out ppSection);

                            byte[] data = new byte[pdwRawPacketLength];
                            Marshal.Copy(ppSection, data, 0, pdwRawPacketLength);

                            PSISection table = ParseTable(tableId, data);
                            Marshal.ReleaseComObject(ppSectionList);

                            al.Add(table);
                        }
                    }
                }
                Marshal.ReleaseComObject(ppSectionList);
            }
            return((PSISection[])al.ToArray(typeof(PSISection)));
        }
Beispiel #6
0
 public static PSISection ParseTable(int tableId, byte[] data)
 {
     PSISection table;
     switch ((TABLE_IDS)tableId)
     {
         case TABLE_IDS.PAT:
             table = new PSIPAT(); break;
         case TABLE_IDS.SDT_ACTUAL:
             table = new PSISDT(); break;
         case TABLE_IDS.PMT:
             table = new PSIPMT(); break;
         case TABLE_IDS.NIT_ACTUAL:
             table = new PSINIT();break;
         default:
             table = new PSISection();
             break;
     }
     table.Parse(data);
     return table;
 }