/// <summary>
        /// Parse the summary data.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the summary data.</param>
        /// <param name="index">Index of the first byte of the summary data in the MPEG2 section.</param>
        /// <param name="baseDate">The base date for the program events.</param>
        internal void Process(byte[] byteData, int index, DateTime baseDate)
        {
            lastIndex = index;

            try
            {
                eventID    = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                length     = ((byteData[lastIndex] & 0x0f) * 256) + byteData[lastIndex + 1];
                lastIndex += 2;

                int recordLength = length;

                while (recordLength != 0)
                {
                    OpenTVRecordBase record = OpenTVRecordBase.Instance(byteData, lastIndex);
                    Records.Add(record);

                    lastIndex    += record.TotalLength;
                    recordLength -= record.TotalLength;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Open TV Summary Data message is short"));
            }
        }
Example #2
0
        /// <summary>
        /// Parse the title data.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the title data.</param>
        /// <param name="index">Index of the first byte of the title data in the MPEG2 section.</param>
        /// <param name="baseDate">The base date for the programs.</param>
        /// <param name="channel">The channel for the data.</param>
        /// <param name="pid">The PID of the section.</param>
        /// <param name="table">The table ID of the section.</param>
        internal void Process(byte[] byteData, int index, DateTime baseDate, int channel, int pid, int table)
        {
            lastIndex = index;

            this.pid      = pid;
            this.table    = table;
            this.baseDate = baseDate;

            try
            {
                eventID    = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                length     = ((byteData[lastIndex] & 0x0f) * 256) + byteData[lastIndex + 1];
                lastIndex += 2;

                int recordLength = length;

                while (recordLength != 0)
                {
                    OpenTVRecordBase record = OpenTVRecordBase.Instance(byteData, lastIndex);
                    Records.Add(record);

                    lastIndex    += record.TotalLength;
                    recordLength -= record.TotalLength;
                }

                timeStamp = DateTime.Now;

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("lastIndex = " + lastIndex));
            }
        }