TS Packet Checker (2 Viewers)

KayDiefenthal

MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    @alexi

    habe das Project mal ein wenig angepasst

    Cleanup by Diefenthal · Pull Request #177 · MediaPortal/MediaPortal-1

    es gibt jetzt wieder eine vs2008.sln und eine vs2019 so sollten wir beide keine probleme haben
    den von vs 2019 erstellen backupordner habe ich mal entfernt sowie auch die UpgradeLog.htm

    zusätzlich gitignore und gitattributes hinzugefügt
    damit die solution sauber bleibt

    hoffer das es bei dir auch klappt mit den getrennten sln
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    in PacketChecks.cs war noch ein Bug.

    Code:
    // ISO/IEC 13818-1: "In the case of a null packet the value of the continuity_counter is undefined."
          if (header.Pid == 0x1fff) nullPackets++;
          else CheckContinuityCounter((byte)(tsPacket[3]), ref pi); // check continuity_counter if no null packet

    komplettes file:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace TsPacketChecker
    {
      class PacketChecker
      {
        private long droppedPackets;
        private long nullPackets;
        private long totalCCErrors;
        private long totalPcrErrors;
        private long totalPtsErrors;
        private long totalPayloadStartErrors;
        private double diffAllowed;
        private SortedDictionary<ushort, PidInfo> pids = new SortedDictionary<ushort, PidInfo>();
    
        #region Existence checks
        private bool PacketContainsPcr(TsHeader header, byte[] tsPacket)
        {
          return (header.HasAdaptionField && (tsPacket[5] & 0x10) == 0x10);
        }
        private ulong PacketContainsPtsDts(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!header.PayloadUnitStart)
            return 0;
          if (header.PayLoadStart > 185 && header.HasPayload)
          {
            totalPayloadStartErrors++;
            pi.payloadStartErrorTexts.Add(" payloadStart=" + header.PayLoadStart.ToString() + " HasAdaption=" + header.HasAdaptionField.ToString() + " HasPayload=" + header.HasPayload.ToString() + " AdaptionFieldSize=" + tsPacket[4].ToString());
            return 0;
          }
          if (!header.HasPayload)
            return 0;
          return header.PayLoadStart;
        }
        #endregion
    
        #region Continuity checks
        private bool CheckContinuityCounter(byte tsPacket3, ref PidInfo pi)
        {
          bool isOk = true;
          byte cc = (byte)(tsPacket3 & 0xF);
          if (pi.continuityCounter != 0xFF)
          {
            byte afc = (byte)((tsPacket3 >> 4) & 0x3);
            byte expected;
    // ISO/IEC 13818-1: "The continuity_counter shall not be incremented when the adaptation_field_control of the packet equals '00' or '10'." (binary)
            if ((afc.Equals(0)) || (afc.Equals(2))) expected = (byte)(pi.continuityCounter);
            else expected = (byte)(pi.continuityCounter + 1);
            if (expected == 16) expected = 0;
            if (cc != expected)
            {
              totalCCErrors++;
              isOk = false;
            }
          }
          pi.continuityCounter = cc;
          return isOk;
        }
        private void CheckPcr(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!pi.shouldCheck) return;
          if (!PacketContainsPcr(header, tsPacket)) return;
          Pcr pcr = new Pcr(tsPacket);
          if (pi.lastPcr.isValid)
          {
            TimeSpan diff = pcr.ToDateTime() - pi.lastPcr.ToDateTime();
            if (diff.TotalSeconds > diffAllowed)
            {
              pi.pcrErrorTexts.Add("last pcr: " + pi.lastPcr.ToDateTime().ToString("HH:MM:ss") + " current pcr: " + pcr.ToDateTime().ToString("HH:MM:ss"));
              totalPcrErrors++;
            }
          }
          pi.lastPcr = pcr;
        }
        private void CheckPtsDts(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!pi.shouldCheck) return;
          ulong offset = PacketContainsPtsDts(header, tsPacket, ref pi);
          if (offset == 0) return;
          Pcr pts; Pcr dts;
          PcrUtils.DecodePtsDts(tsPacket, offset, out pts, out dts);
          if (pi.lastPts.isValid)
          {
            TimeSpan diff = pts.ToDateTime() - pi.lastPts.ToDateTime();
            if (diff.TotalSeconds > diffAllowed)
            {
              pi.ptsErrorTexts.Add("last pts: " + pi.lastPts.ToDateTime().ToString("HH:MM:ss") + " current pts: " + pts.ToDateTime().ToString("HH:MM:ss"));
              totalPtsErrors++;
            }
          }
          pi.lastPts = pts;
        }
        #endregion
    
        #region Constructor
        public PacketChecker(double maxAllowedPcrDiff)
        {
          droppedPackets = 0;
          nullPackets = 0;
          totalCCErrors = 0;
          totalPcrErrors = 0;
          totalPtsErrors = 0;
          totalPayloadStartErrors = 0;
          diffAllowed = maxAllowedPcrDiff;
          pids = new SortedDictionary<ushort, PidInfo>();
        }
        #endregion
    
        #region Public methods
        public void AddPidsToCheck(List<ushort> streamPids)
        {
          foreach (ushort pid in streamPids)
          {
            if (pids.ContainsKey(pid))
              pids[pid].shouldCheck = true;
          }
        }
        public void ProcessPacket(byte[] tsPacket,TsHeader header)
        {
          if (header.TransportError)
          {
            droppedPackets++;
            return;
          }
          if (!pids.ContainsKey(header.Pid))
            pids.Add(header.Pid, new PidInfo());
    
          PidInfo pi = pids[header.Pid];
    // ISO/IEC 13818-1: "In the case of a null packet the value of the continuity_counter is undefined."
          if (header.Pid == 0x1fff) nullPackets++;
          else CheckContinuityCounter((byte)(tsPacket[3]), ref pi); // check continuity_counter if no null packet
          if (header.Pid > 0x1f) // don't check pids which contain SI information
          {
            CheckPcr(header, tsPacket, ref pi);
            CheckPtsDts(header, tsPacket, ref pi);
          }
          pids[header.Pid] = pi;
        }
    
        public string GetStatistics()
        {
          return "null packets=" + nullPackets.ToString() + " dropped packets=" + droppedPackets.ToString() + " cc errors=" + totalCCErrors.ToString() + " pcr holes=" + totalPcrErrors.ToString() + " pts holes=" + totalPtsErrors.ToString() + " total payloadstart errors=" + totalPayloadStartErrors.ToString();
        }
        public string GetErrorDetails()
        {
          string log = "";
          foreach (ushort pid in pids.Keys)
          {
            if (pids[pid].HasErrors())
            {
              PidInfo pi = pids[pid];
              log+="Pid 0x" + pid.ToString("x")+Environment.NewLine;
              if (pi.pcrErrorTexts.Count > 0)
              {
                log+="  - pcr errors=" + pi.pcrErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.pcrErrorTexts)
                  log="        ->" + s+Environment.NewLine;
              }
              if (pi.ptsErrorTexts.Count > 0)
              {
                log+="  - pts errors=" + pi.ptsErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.ptsErrorTexts)
                  log+="        ->" + s+Environment.NewLine;
              }
              if (pi.payloadStartErrorTexts.Count > 0)
              {
                log+="  - payloadStart errors=" + pi.payloadStartErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.payloadStartErrorTexts)
                  log+="        ->" + s+Environment.NewLine;
              }
            }
          }
          return log;
        }
        #endregion
      }
    }


    Bitte testen.

    dvb-mp.PNG

    Jetzt werden die null packets gezäht und nicht falsche cc error

    dvb-demuxtoy.PNG


    TSPacketChecker cc errors ist jetz nicht mehr weit von DemuxToy Continuity_cont_error entfernt.
    TSPacketChecker pts errors=40 aber DemuxToy PTS_error: 0
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    Ist es richtig null packets auf

    Code:
          if (header.Pid > 0x1f) // don't check pids which contain SI information
          {
            CheckPcr(header, tsPacket, ref pi);
            CheckPtsDts(header, tsPacket, ref pi);
          }

    Pcr und PtsDts errors zu prüfen?

    kommen die
    TSPacketChecker pts errors=40 aber DemuxToy PTS_error: 0
    daher?
     

    KayDiefenthal

    MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    da wir ja die ganze zeit vom aufbohren schreiben nun der erste weg
    das descriptoren in verschienden tables mehrmals vorkommen können

    macht eine methode zum parsen dessn keinen wirklichen sinn wenn man die nicht überall reinkopieren will
    drumm habe ich das descriptoren parsen ein wenig ausgelagert

    desc1.PNG


    der neue zugrif sieht dann so aus das wäre jetzt das looping im SDTParser
    desc2.PNG


    und wie man sieht wird gecheckt a das der descriptor nicht null ist und um welchen es sich handelt dem entspreched werden dann die werte in den treenode gepackt

    desc3.PNG


    sieht also aus wie vorher da componetdescriptor und linkage noch nicht im treenode eingebunden sind
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    ich habe noch einen Bug in PacketChecks.cs gefixt:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace TsPacketChecker
    {
      class PacketChecker
      {
        private long droppedPackets;
        private long nullPackets;
        private long totalCCErrors;
        private long totalPcrErrors;
        private long totalPtsErrors;
        private long totalPayloadStartErrors;
        private double diffAllowed;
        private SortedDictionary<ushort, PidInfo> pids = new SortedDictionary<ushort, PidInfo>();
    
        #region Existence checks
        private bool PacketContainsPcr(TsHeader header, byte[] tsPacket)
        {
          return (header.HasAdaptionField && (tsPacket[5] & 0x10) == 0x10);
        }
        private ulong PacketContainsPtsDts(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!header.PayloadUnitStart)
            return 0;
          if (header.PayLoadStart > 185 && header.HasPayload)
          {
            totalPayloadStartErrors++;
            pi.payloadStartErrorTexts.Add(" payloadStart=" + header.PayLoadStart.ToString() + " HasAdaption=" + header.HasAdaptionField.ToString() + " HasPayload=" + header.HasPayload.ToString() + " AdaptionFieldSize=" + tsPacket[4].ToString());
            return 0;
          }
          if (!header.HasPayload)
            return 0;
          return header.PayLoadStart;
        }
        #endregion
    
        #region Continuity checks
        private bool CheckContinuityCounter(byte tsPacket3, ref PidInfo pi)
        {
          bool isOk = true;
          byte cc = (byte)(tsPacket3 & 0xF);
          if (pi.continuityCounter != 0xFF)
          {
            byte afc = (byte)((tsPacket3 >> 4) & 0x3);
            byte expected;
    // ISO/IEC 13818-1: "The continuity_counter shall not be incremented when the adaptation_field_control of the packet equals '00' or '10'." (binary)
            if ((afc.Equals(0)) || (afc.Equals(2))) expected = (byte)(pi.continuityCounter);
            else expected = (byte)(pi.continuityCounter + 1);
            if (expected == 16) expected = 0;
            if (cc != expected)
            {
              totalCCErrors++;
              isOk = false;
            }
          }
          pi.continuityCounter = cc;
          return isOk;
        }
        private void CheckPcr(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!pi.shouldCheck) return;
          if (!PacketContainsPcr(header, tsPacket)) return;
          Pcr pcr = new Pcr(tsPacket);
          if (pi.lastPcr.isValid)
          {
            TimeSpan diff = pcr.ToDateTime() - pi.lastPcr.ToDateTime();
            if (diff.TotalSeconds > diffAllowed)
            {
              pi.pcrErrorTexts.Add("last pcr: " + pi.lastPcr.ToDateTime().ToString("HH:MM:ss") + " current pcr: " + pcr.ToDateTime().ToString("HH:MM:ss"));
              totalPcrErrors++;
            }
          }
          pi.lastPcr = pcr;
        }
        private void CheckPtsDts(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!pi.shouldCheck) return;
          ulong offset = PacketContainsPtsDts(header, tsPacket, ref pi);
          if (offset == 0) return;
          Pcr pts; Pcr dts;
          PcrUtils.DecodePtsDts(tsPacket, offset, out pts, out dts);
          if (pi.lastPts.isValid)
          {
            TimeSpan diff = pts.ToDateTime() - pi.lastPts.ToDateTime();
            if (diff.TotalSeconds > diffAllowed)
            {
              pi.ptsErrorTexts.Add("last pts: " + pi.lastPts.ToDateTime().ToString("HH:MM:ss") + " current pts: " + pts.ToDateTime().ToString("HH:MM:ss"));
              totalPtsErrors++;
            }
          }
          pi.lastPts = pts;
        }
        #endregion
    
        #region Constructor
        public PacketChecker(double maxAllowedPcrDiff)
        {
          droppedPackets = 0;
          nullPackets = 0;
          totalCCErrors = 0;
          totalPcrErrors = 0;
          totalPtsErrors = 0;
          totalPayloadStartErrors = 0;
          diffAllowed = maxAllowedPcrDiff;
          pids = new SortedDictionary<ushort, PidInfo>();
        }
        #endregion
    
        #region Public methods
        public void AddPidsToCheck(List<ushort> streamPids)
        {
          foreach (ushort pid in streamPids)
          {
            if (pids.ContainsKey(pid))
              pids[pid].shouldCheck = true;
          }
        }
        public void ProcessPacket(byte[] tsPacket,TsHeader header)
        {
          if (header.TransportError)
          {
            droppedPackets++;
            return;
          }
          if (!pids.ContainsKey(header.Pid))
            pids.Add(header.Pid, new PidInfo());
    
          PidInfo pi = pids[header.Pid];
    // ISO/IEC 13818-1: "In the case of a null packet the value of the continuity_counter is undefined."
          if (header.Pid == 0x1fff) nullPackets++;
          else CheckContinuityCounter((byte)(tsPacket[3]), ref pi); // check continuity_counter if no null packet
          if (header.Pid > 0x1f) // don't check pids which contain SI information
          {
            CheckPcr(header, tsPacket, ref pi);
            CheckPtsDts(header, tsPacket, ref pi);
          }
          pids[header.Pid] = pi;
        }
    
        public string GetStatistics()
        {
          return "null packets=" + nullPackets.ToString() + " dropped packets=" + droppedPackets.ToString() + " cc errors=" + totalCCErrors.ToString() + " pcr holes=" + totalPcrErrors.ToString() + " pts holes=" + totalPtsErrors.ToString() + " total payloadstart errors=" + totalPayloadStartErrors.ToString();
        }
        public string GetErrorDetails()
        {
          string log = "";
          foreach (ushort pid in pids.Keys)
          {
            if (pids[pid].HasErrors())
            {
              PidInfo pi = pids[pid];
              log+="Pid 0x" + pid.ToString("x")+Environment.NewLine;
              if (pi.pcrErrorTexts.Count > 0)
              {
                log+="  - pcr errors=" + pi.pcrErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.pcrErrorTexts)
    //              log="        ->" + s+Environment.NewLine;
                  log+="        ->" + s+Environment.NewLine;
              }
              if (pi.ptsErrorTexts.Count > 0)
              {
                log+="  - pts errors=" + pi.ptsErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.ptsErrorTexts)
                  log+="        ->" + s+Environment.NewLine;
              }
              if (pi.payloadStartErrorTexts.Count > 0)
              {
                log+="  - payloadStart errors=" + pi.payloadStartErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.payloadStartErrorTexts)
                  log+="        ->" + s+Environment.NewLine;
              }
            }
          }
          return log;
        }
        #endregion
      }
    }

    ziemlich am Ende, fehlerhafte Zeile auskommentiert und verbesserte Zeile eingefügt.

    @Kay:
    köönen wir es erst mal so machen, dass ich PacketChecks.cs bearbeite und Du den Rest?
     

    KayDiefenthal

    MP Donator
  • Premium Supporter
  • July 18, 2006
    1,176
    92
    45
    Germany - Bonn
    Home Country
    Germany Germany
    lol dann bist du definitiv vor mir fertig :)
    das descriptor coding ist mega heftig da man mit indexern hantiert macht man am anfang einen fehler stimmt nach hinten raus garnichts mehrund ich hab ja nocht nicht alle implementiert

    nur das gröbste halt bis mir die birne qualmte und eine Dialogbox her musste nehme mal an haste alles noch garnicht auf dem schirm oder ?
    dann schau mal rein Cleanup by Diefenthal · Pull Request #177 · MediaPortal/MediaPortal-1
     

    alexi

    Portal Member
    January 21, 2010
    35
    0
    Home Country
    Germany Germany
    noch ein bugfix:

    Code:
    //      return (header.HasAdaptionField && (tsPacket[5] & 0x10) == 0x10);
    // ISO/IEC 13818-1: "The adaptation_field_length is an 8-bit field specifying the number of bytes in the adaptation_field immediately following the adaptation_field_length.
    //                  The value 0 is for inserting a single stuffing byte in a Transport Stream packet." -> if (adaptation_field_length > 0)
          return (header.HasAdaptionField && (tsPacket[5] & 0x10) == 0x10) && (header.AdaptionFieldLength > 0);


    in PacketChecks.cs (komplett):

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace TsPacketChecker
    {
      class PacketChecker
      {
        private long droppedPackets;
        private long nullPackets;
        private long totalCCErrors;
        private long totalPcrErrors;
        private long totalPtsErrors;
        private long totalPayloadStartErrors;
        private double diffAllowed;
        private SortedDictionary<ushort, PidInfo> pids = new SortedDictionary<ushort, PidInfo>();
    
        #region Existence checks
        private bool PacketContainsPcr(TsHeader header, byte[] tsPacket)
        {
    //      return (header.HasAdaptionField && (tsPacket[5] & 0x10) == 0x10);
    // ISO/IEC 13818-1: "The adaptation_field_length is an 8-bit field specifying the number of bytes in the adaptation_field immediately following the adaptation_field_length.
    //                  The value 0 is for inserting a single stuffing byte in a Transport Stream packet." -> if (adaptation_field_length > 0)
          return (header.HasAdaptionField && (tsPacket[5] & 0x10) == 0x10) && (header.AdaptionFieldLength > 0);
        }
        private ulong PacketContainsPtsDts(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!header.PayloadUnitStart)
            return 0;
          if (header.PayLoadStart > 185 && header.HasPayload)
          {
            totalPayloadStartErrors++;
            pi.payloadStartErrorTexts.Add(" payloadStart=" + header.PayLoadStart.ToString() + " HasAdaption=" + header.HasAdaptionField.ToString() + " HasPayload=" + header.HasPayload.ToString() + " AdaptionFieldSize=" + tsPacket[4].ToString());
            return 0;
          }
          if (!header.HasPayload)
            return 0;
          return header.PayLoadStart;
        }
        #endregion
    
        #region Continuity checks
        private bool CheckContinuityCounter(byte tsPacket3, ref PidInfo pi)
        {
          bool isOk = true;
          byte cc = (byte)(tsPacket3 & 0xF);
          if (pi.continuityCounter != 0xFF)
          {
            byte afc = (byte)((tsPacket3 >> 4) & 0x3);
            byte expected;
    // ISO/IEC 13818-1: "The continuity_counter shall not be incremented when the adaptation_field_control of the packet equals '00' or '10'." (binary)
            if ((afc.Equals(0)) || (afc.Equals(2))) expected = (byte)(pi.continuityCounter);
            else expected = (byte)(pi.continuityCounter + 1);
            if (expected == 16) expected = 0;
            if (cc != expected)
            {
              totalCCErrors++;
              isOk = false;
            }
          }
          pi.continuityCounter = cc;
          return isOk;
        }
        private void CheckPcr(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!pi.shouldCheck) return;
          if (!PacketContainsPcr(header, tsPacket)) return;
          Pcr pcr = new Pcr(tsPacket);
          if (pi.lastPcr.isValid)
          {
            TimeSpan diff = pcr.ToDateTime() - pi.lastPcr.ToDateTime();
            if (diff.TotalSeconds > diffAllowed)
            {
    //          pi.pcrErrorTexts.Add("last pcr: " + pi.lastPcr.ToDateTime().ToString("HH:MM:ss") + " current pcr: " + pcr.ToDateTime().ToString("HH:MM:ss"));
              pi.pcrErrorTexts.Add("pcr last: " + pi.lastPcr.ToDateTime().ToString("HH:MM:ss") + " current: " + pcr.ToDateTime().ToString("HH:MM:ss") + " diff: " + diff.TotalSeconds.ToString() + " seconds");
              totalPcrErrors++;
            }
          }
          pi.lastPcr = pcr;
        }
        private void CheckPtsDts(TsHeader header, byte[] tsPacket, ref PidInfo pi)
        {
          if (!pi.shouldCheck) return;
          ulong offset = PacketContainsPtsDts(header, tsPacket, ref pi);
          if (offset == 0) return;
          Pcr pts; Pcr dts;
          PcrUtils.DecodePtsDts(tsPacket, offset, out pts, out dts);
          if (pi.lastPts.isValid)
          {
            TimeSpan diff = pts.ToDateTime() - pi.lastPts.ToDateTime();
            if (diff.TotalSeconds > diffAllowed)
            {
    //          pi.ptsErrorTexts.Add("last pts: " + pi.lastPts.ToDateTime().ToString("HH:MM:ss") + " current pts: " + pts.ToDateTime().ToString("HH:MM:ss"));
              pi.ptsErrorTexts.Add("pts last: " + pi.lastPts.ToDateTime().ToString("HH:MM:ss") + " current: " + pts.ToDateTime().ToString("HH:MM:ss") + " diff: " + diff.TotalSeconds.ToString() + " seconds");
              totalPtsErrors++;
            }
          }
          pi.lastPts = pts;
        }
        #endregion
    
        #region Constructor
        public PacketChecker(double maxAllowedPcrDiff)
        {
          droppedPackets = 0;
          nullPackets = 0;
          totalCCErrors = 0;
          totalPcrErrors = 0;
          totalPtsErrors = 0;
          totalPayloadStartErrors = 0;
          diffAllowed = maxAllowedPcrDiff;
          pids = new SortedDictionary<ushort, PidInfo>();
        }
        #endregion
    
        #region Public methods
        public void AddPidsToCheck(List<ushort> streamPids)
        {
          foreach (ushort pid in streamPids)
          {
            if (pids.ContainsKey(pid))
              pids[pid].shouldCheck = true;
          }
        }
        public void ProcessPacket(byte[] tsPacket,TsHeader header)
        {
          if (header.TransportError)
          {
            droppedPackets++;
            return;
          }
          if (!pids.ContainsKey(header.Pid))
            pids.Add(header.Pid, new PidInfo());
    
          PidInfo pi = pids[header.Pid];
    // ISO/IEC 13818-1: "In the case of a null packet the value of the continuity_counter is undefined."
          if (header.Pid == 0x1fff) nullPackets++;
          else CheckContinuityCounter((byte)(tsPacket[3]), ref pi); // check continuity_counter if no null packet
          if (header.Pid > 0x1f) // don't check pids which contain SI information
          {
            CheckPcr(header, tsPacket, ref pi);
            CheckPtsDts(header, tsPacket, ref pi);
          }
          pids[header.Pid] = pi;
        }
    
        public string GetStatistics()
        {
          return "null packets=" + nullPackets.ToString() + " dropped packets=" + droppedPackets.ToString() + " cc errors=" + totalCCErrors.ToString() + " pcr holes=" + totalPcrErrors.ToString() + " pts holes=" + totalPtsErrors.ToString() + " total payloadstart errors=" + totalPayloadStartErrors.ToString();
        }
        public string GetErrorDetails()
        {
          string log = "";
          foreach (ushort pid in pids.Keys)
          {
            if (pids[pid].HasErrors())
            {
              PidInfo pi = pids[pid];
              log+="Pid 0x" + pid.ToString("x")+Environment.NewLine;
              if (pi.pcrErrorTexts.Count > 0)
              {
                log+="  - pcr errors=" + pi.pcrErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.pcrErrorTexts)
    //              log="        ->" + s+Environment.NewLine;
                  log+="        ->" + s+Environment.NewLine;
              }
              if (pi.ptsErrorTexts.Count > 0)
              {
                log+="  - pts errors=" + pi.ptsErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.ptsErrorTexts)
                  log+="        ->" + s+Environment.NewLine;
              }
              if (pi.payloadStartErrorTexts.Count > 0)
              {
                log+="  - payloadStart errors=" + pi.payloadStartErrorTexts.Count.ToString()+Environment.NewLine;
                foreach (string s in pi.payloadStartErrorTexts)
                  log+="        ->" + s+Environment.NewLine;
              }
            }
          }
          return log;
        }
        #endregion
      }
    }

    und eine optische Überarbeitumg in Form1.Designer.cs:

    Code:
    namespace TsPacketChecker
    {
      partial class Form1
      {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
    
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
          if (disposing && (components != null))
          {
            components.Dispose();
          }
          base.Dispose(disposing);
        }
    
        #region Windows Form Designer generated code
    
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
          this.splitContainer2 = new System.Windows.Forms.SplitContainer();
          this.TrSections = new System.Windows.Forms.TreeView();
          this.splitContainer3 = new System.Windows.Forms.SplitContainer();
          this.PrBar = new System.Windows.Forms.ProgressBar();
          this.btnStop = new System.Windows.Forms.Button();
          this.edPcrDiff = new System.Windows.Forms.TextBox();
          this.label2 = new System.Windows.Forms.Label();
          this.btnAnalyze = new System.Windows.Forms.Button();
          this.edLog = new System.Windows.Forms.TextBox();
          this.openDlg = new System.Windows.Forms.OpenFileDialog();
          this.menuStrip1 = new System.Windows.Forms.MenuStrip();
          this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
          this.opentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
          this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
          this.importFromXMLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
          this.exportToXMLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
          this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
          this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
          this.saveDlg = new System.Windows.Forms.SaveFileDialog();
          this.splitContainer2.Panel1.SuspendLayout();
          this.splitContainer2.Panel2.SuspendLayout();
          this.splitContainer2.SuspendLayout();
          this.splitContainer3.Panel1.SuspendLayout();
          this.splitContainer3.Panel2.SuspendLayout();
          this.splitContainer3.SuspendLayout();
          this.menuStrip1.SuspendLayout();
          this.SuspendLayout();
          //
          // splitContainer2
          //
          this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
          this.splitContainer2.Location = new System.Drawing.Point(0, 24);
          this.splitContainer2.Name = "splitContainer2";
          //
          // splitContainer2.Panel1
          //
          this.splitContainer2.Panel1.Controls.Add(this.TrSections);
          //
          // splitContainer2.Panel2
          //
          this.splitContainer2.Panel2.Controls.Add(this.splitContainer3);
          this.splitContainer2.Size = new System.Drawing.Size(1038, 654);
          this.splitContainer2.SplitterDistance = 167;
          this.splitContainer2.TabIndex = 0;
          //
          // TrSections
          //
          this.TrSections.Dock = System.Windows.Forms.DockStyle.Fill;
          this.TrSections.Location = new System.Drawing.Point(0, 0);
          this.TrSections.Name = "TrSections";
          this.TrSections.Size = new System.Drawing.Size(167, 654);
          this.TrSections.TabIndex = 0;
          //
          // splitContainer3
          //
          this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
          this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
          this.splitContainer3.Location = new System.Drawing.Point(0, 0);
          this.splitContainer3.Name = "splitContainer3";
          this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
          //
          // splitContainer3.Panel1
          //
          this.splitContainer3.Panel1.Controls.Add(this.PrBar);
          this.splitContainer3.Panel1.Controls.Add(this.btnStop);
          this.splitContainer3.Panel1.Controls.Add(this.edPcrDiff);
          this.splitContainer3.Panel1.Controls.Add(this.label2);
          this.splitContainer3.Panel1.Controls.Add(this.btnAnalyze);
          //
          // splitContainer3.Panel2
          //
          this.splitContainer3.Panel2.Controls.Add(this.edLog);
          this.splitContainer3.Size = new System.Drawing.Size(867, 654);
          this.splitContainer3.SplitterDistance = 77;
          this.splitContainer3.TabIndex = 0;
          //
          // PrBar
          //
          this.PrBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                      | System.Windows.Forms.AnchorStyles.Right)));
          this.PrBar.Location = new System.Drawing.Point(102, 43);
          this.PrBar.Name = "PrBar";
          this.PrBar.Size = new System.Drawing.Size(752, 23);
          this.PrBar.Step = 1;
          this.PrBar.TabIndex = 4;
          //
          // btnStop
          //
          this.btnStop.Location = new System.Drawing.Point(13, 43);
          this.btnStop.Name = "btnStop";
          this.btnStop.Size = new System.Drawing.Size(75, 23);
          this.btnStop.TabIndex = 3;
          this.btnStop.Text = "Stop";
          this.btnStop.UseVisualStyleBackColor = true;
          this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
          //
          // edPcrDiff
          //
          this.edPcrDiff.Location = new System.Drawing.Point(299, 15);
          this.edPcrDiff.Name = "edPcrDiff";
          this.edPcrDiff.Size = new System.Drawing.Size(100, 20);
          this.edPcrDiff.TabIndex = 2;
          this.edPcrDiff.Text = "10";
          //
          // label2
          //
          this.label2.AutoSize = true;
          this.label2.Location = new System.Drawing.Point(100, 18);
          this.label2.Name = "label2";
          this.label2.Size = new System.Drawing.Size(187, 13);
          this.label2.TabIndex = 1;
          this.label2.Text = "Max Pcr/Pts diff (clock value) [seconds]";
          //
          // btnAnalyze
          //
          this.btnAnalyze.Location = new System.Drawing.Point(13, 13);
          this.btnAnalyze.Name = "btnAnalyze";
          this.btnAnalyze.Size = new System.Drawing.Size(75, 23);
          this.btnAnalyze.TabIndex = 0;
          this.btnAnalyze.Text = "Analyze";
          this.btnAnalyze.UseVisualStyleBackColor = true;
          this.btnAnalyze.Click += new System.EventHandler(this.btnAnalyze_Click);
          //
          // edLog
          //
          this.edLog.Dock = System.Windows.Forms.DockStyle.Fill;
          this.edLog.Location = new System.Drawing.Point(0, 0);
          this.edLog.Multiline = true;
          this.edLog.Name = "edLog";
          this.edLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
          this.edLog.Size = new System.Drawing.Size(867, 573);
          this.edLog.TabIndex = 0;
          //
          // openDlg
          //
          this.openDlg.FileName = "openFileDialog1";
          this.openDlg.Filter = "Ts Files (*.ts)|*.ts";
          this.openDlg.RestoreDirectory = true;
          //
          // menuStrip1
          //
          this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.fileToolStripMenuItem});
          this.menuStrip1.Location = new System.Drawing.Point(0, 0);
          this.menuStrip1.Name = "menuStrip1";
          this.menuStrip1.Size = new System.Drawing.Size(1038, 24);
          this.menuStrip1.TabIndex = 1;
          this.menuStrip1.Text = "menuStrip1";
          //
          // fileToolStripMenuItem
          //
          this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.opentsToolStripMenuItem,
                this.toolStripMenuItem1,
                this.importFromXMLToolStripMenuItem,
                this.exportToXMLToolStripMenuItem,
                this.toolStripMenuItem2,
                this.exitToolStripMenuItem});
          this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
          this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
          this.fileToolStripMenuItem.Text = "File";
          //
          // opentsToolStripMenuItem
          //
          this.opentsToolStripMenuItem.Name = "opentsToolStripMenuItem";
          this.opentsToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
          this.opentsToolStripMenuItem.Text = "Open .ts  file";
          this.opentsToolStripMenuItem.Click += new System.EventHandler(this.opentsToolStripMenuItem_Click);
          //
          // toolStripMenuItem1
          //
          this.toolStripMenuItem1.Name = "toolStripMenuItem1";
          this.toolStripMenuItem1.Size = new System.Drawing.Size(161, 6);
          //
          // importFromXMLToolStripMenuItem
          //
          this.importFromXMLToolStripMenuItem.Name = "importFromXMLToolStripMenuItem";
          this.importFromXMLToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
          this.importFromXMLToolStripMenuItem.Text = "Import from XML";
          this.importFromXMLToolStripMenuItem.Click += new System.EventHandler(this.importFromXMLToolStripMenuItem_Click);
          //
          // exportToXMLToolStripMenuItem
          //
          this.exportToXMLToolStripMenuItem.Name = "exportToXMLToolStripMenuItem";
          this.exportToXMLToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
          this.exportToXMLToolStripMenuItem.Text = "Export to XML";
          this.exportToXMLToolStripMenuItem.Click += new System.EventHandler(this.exportToXMLToolStripMenuItem_Click);
          //
          // toolStripMenuItem2
          //
          this.toolStripMenuItem2.Name = "toolStripMenuItem2";
          this.toolStripMenuItem2.Size = new System.Drawing.Size(161, 6);
          //
          // exitToolStripMenuItem
          //
          this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
          this.exitToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
          this.exitToolStripMenuItem.Text = "Exit";
          this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
          //
          // saveDlg
          //
          this.saveDlg.DefaultExt = "xml";
          this.saveDlg.Filter = "XML Files (*.xml)|*.xml";
          this.saveDlg.RestoreDirectory = true;
          //
          // Form1
          //
          this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
          this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
          this.ClientSize = new System.Drawing.Size(1038, 678);
          this.Controls.Add(this.splitContainer2);
          this.Controls.Add(this.menuStrip1);
          this.Name = "Form1";
          this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
          this.Text = "TsPacketChecker (by gemx)";
          this.splitContainer2.Panel1.ResumeLayout(false);
          this.splitContainer2.Panel2.ResumeLayout(false);
          this.splitContainer2.ResumeLayout(false);
          this.splitContainer3.Panel1.ResumeLayout(false);
          this.splitContainer3.Panel1.PerformLayout();
          this.splitContainer3.Panel2.ResumeLayout(false);
          this.splitContainer3.Panel2.PerformLayout();
          this.splitContainer3.ResumeLayout(false);
          this.menuStrip1.ResumeLayout(false);
          this.menuStrip1.PerformLayout();
          this.ResumeLayout(false);
          this.PerformLayout();
    
        }
    
        #endregion
    
        private System.Windows.Forms.OpenFileDialog openDlg;
        private System.Windows.Forms.SplitContainer splitContainer2;
        private System.Windows.Forms.SplitContainer splitContainer3;
        private System.Windows.Forms.TextBox edPcrDiff;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button btnAnalyze;
        private System.Windows.Forms.TextBox edLog;
        private System.Windows.Forms.Button btnStop;
        private System.Windows.Forms.ProgressBar PrBar;
        private System.Windows.Forms.TreeView TrSections;
        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem opentsToolStripMenuItem;
        private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
        private System.Windows.Forms.ToolStripMenuItem importFromXMLToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem exportToXMLToolStripMenuItem;
        private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
        private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
        private System.Windows.Forms.SaveFileDialog saveDlg;
    
      }
    }
     

    Users who are viewing this thread

    Top Bottom