Exemplo n.º 1
0
        /// <summary>
        /// Parse the title header.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the title header.</param>
        /// <param name="index">Index of the first byte of the title header in the MPEG2 section.</param>
        /// <param name="mpeg2Header">The MPEG2 header of the section.</param>
        /// <param name="pid">The PID of the section.</param>
        /// <param name="tid">The table ID of the section.</param>
        internal void Process(byte[] byteData, int index, Mpeg2ExtendedHeader mpeg2Header, int pid, int tid)
        {
            lastIndex = index;

            channelID = mpeg2Header.TableIDExtension;

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

                while (lastIndex < byteData.Length - 4)
                {
                    OpenTVTitleData data = new OpenTVTitleData();
                    data.Process(byteData, lastIndex, baseDate, channelID, pid, tid);

                    if (!data.IsEmpty)
                    {
                        if (titleData == null)
                        {
                            titleData = new Collection <OpenTVTitleData>();
                        }
                        titleData.Add(data);
                    }

                    lastIndex = data.Index;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("lastIndex = " + lastIndex));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parse the title header.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the title header.</param>
        /// <param name="index">Index of the first byte of the title header in the MPEG2 section.</param>
        /// <param name="mpeg2Header">The MPEG2 header of the section.</param>
        /// <param name="pid">The PID of the section.</param>
        /// <param name="tid">The table ID of the section.</param>
        internal void Process(byte[] byteData, int index, Mpeg2ExtendedHeader mpeg2Header, int pid, int tid)
        {
            lastIndex = index;

            channelID = mpeg2Header.TableIDExtension;

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

                while (lastIndex < byteData.Length - 4)
                {
                    OpenTVTitleData data = new OpenTVTitleData();
                    data.Process(byteData, lastIndex, baseDate, channelID, pid, tid);

                    if (!data.IsEmpty)
                    {
                        if (titleData == null)
                            titleData = new Collection<OpenTVTitleData>();
                        titleData.Add(data);
                    }

                    lastIndex = data.Index;
                }

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