示例#1
0
        /// <summary>
        /// Create an instance of the record class.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the record.</param>
        /// <param name="index">The index of the tag byte of the record.</param>
        /// <returns>A descriptor instance.</returns>
        internal static OpenTVRecordBase Instance(byte[] byteData, int index)
        {
            OpenTVRecordBase record;

            switch ((int)byteData[index])
            {
            case OpenTVTitleDataRecord.TagValue:
                record = new OpenTVTitleDataRecord();
                break;

            case OpenTVShortDescriptionRecord.TagValue:
                record = new OpenTVShortDescriptionRecord();
                break;

            case OpenTVExtendedDescriptionRecord.TagValue:
                record = new OpenTVExtendedDescriptionRecord();
                break;

            case OpenTVSeriesLinkRecord.TagValue:
                record = new OpenTVSeriesLinkRecord();
                break;

            default:
                record = new OpenTVRecordBase();
                break;
            }

            record.tag = (int)byteData[index];
            index++;

            record.length = (int)byteData[index];
            index++;

            record.Process(byteData, index);

            return(record);
        }
示例#2
0
        /// <summary>
        /// Create an instance of the record class.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the record.</param>
        /// <param name="index">The index of the tag byte of the record.</param>
        /// <returns>A descriptor instance.</returns>
        internal static OpenTVRecordBase Instance(byte[] byteData, int index)
        {
            OpenTVRecordBase record;

            switch ((int)byteData[index])
            {
                case OpenTVTitleDataRecord.TagValue:
                    record = new OpenTVTitleDataRecord();
                    break;
                case OpenTVShortDescriptionRecord.TagValue:
                    record = new OpenTVShortDescriptionRecord();
                    break;
                case OpenTVExtendedDescriptionRecord.TagValue:
                    record = new OpenTVExtendedDescriptionRecord();
                    break;
                case OpenTVSeriesLinkRecord.TagValue:
                    record = new OpenTVSeriesLinkRecord();
                    break;
                default:
                    record = new OpenTVRecordBase();
                    break;
            }

            record.tag = (int)byteData[index];
            index++;

            record.length = (int)byteData[index];
            index++;

            record.Process(byteData, index);

            return (record);
        }