Beispiel #1
0
        public void NewTsPacket(TsPacketMetadata tsPacketMetadata, UInt16 pid)
        {
            PidBitrate pidBitrate = null;

            if (!pidBitrateList.TryGetValue(pid, out pidBitrate))
            {
                //Create a new one.
                pidBitrate = new PidBitrate(pid);
                pidBitrateList.Add(pid, pidBitrate);
            }

            //Increase the exsiting size.
            pidBitrate.AddTsPacket(tsPacketMetadata);
        }
Beispiel #2
0
        public void AddRealtimeBitrate(KeyValuePair <DateTime, SortedDictionary <UInt16, PidBitrate> > bitrateForNow, bool isLive)
        {
            PidBitrate realtimePidBitrate = null;
            DateTime   timeOfBitrate      = bitrateForNow.Key;
            SortedDictionary <UInt16, PidBitrate> realtimePidBitrateList = bitrateForNow.Value;
            int rowIndex = dataGridViewRealtimeBitrate.Rows.Add();//Add a new row.

            if (rowIndex % 2 == 0)
            {
                dataGridViewRealtimeBitrate.Rows[rowIndex].DefaultCellStyle.BackColor = Color.SteelBlue;
            }
            else
            {
                dataGridViewRealtimeBitrate.Rows[rowIndex].DefaultCellStyle.BackColor = Color.LightSkyBlue;
            }

            dataGridViewRealtimeBitrate.Rows[rowIndex].Cells[0].Value = rowIndex;

            if (isLive)
            {
                dataGridViewRealtimeBitrate.Rows[rowIndex].Cells[1].Value = timeOfBitrate;
            }
            else
            {
                dataGridViewRealtimeBitrate.Rows[rowIndex].Cells[1].Value = rowIndex + 1 + " second";
            }


            foreach (KeyValuePair <UInt16, PidBitrate> keyPair in realtimePidBitrateList)
            {
                //Check whether we have an existing column, if no, create the column for this PID and insert it into the right position.
                realtimePidBitrate = keyPair.Value;
                int columnIndex = FindOrCreateColumn(keyPair.Key); //Find or create a column according to the PID.
                dataGridViewRealtimeBitrate.Rows[rowIndex].Cells[columnIndex].Value = realtimePidBitrate.Bitrate;

                //To update chart.
                String pidColumnName = GetPidColumnName(keyPair.Key);
                Series newPidSeries  = chartRealtimeBitrate.Series[pidColumnName];
                newPidSeries.Points.AddY(realtimePidBitrate.Bitrate);
            }
        }