예제 #1
0
        /// <summary>
        /// Create a new instance of a BIOP descriptor.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">Index of the descriptor tag in the MPEG2 section.</param>
        /// <returns>A BIOP descriptor instance.</returns>
        public static BIOPDescriptor Create(byte[] byteData, int index)
        {
            BIOPDescriptor descriptor = null;

            switch (byteData[index])
            {
            case DVBCompressedModuleDescriptor.Tag:
                descriptor = new DVBCompressedModuleDescriptor();
                break;

            case MHPLabelDescriptor.Tag:
                descriptor = new MHPLabelDescriptor();
                break;

            case MHPCachingPriorityDescriptor.Tag:
                descriptor = new MHPCachingPriorityDescriptor();
                break;

            case MHPContentTypeDescriptor.Tag:
                descriptor = new MHPContentTypeDescriptor();
                break;

            default:
                throw (new InvalidOperationException("BIOPDescriptor: Tag not recognized - " + byteData[index]));
            }

            descriptor.Process(byteData, index);

            return(descriptor);
        }
예제 #2
0
        /// <summary>
        /// Create a new instance of a BIOP descriptor.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the descriptor.</param>
        /// <param name="index">Index of the descriptor tag in the MPEG2 section.</param>
        /// <returns>A BIOP descriptor instance.</returns>
        public static BIOPDescriptor Create(byte[] byteData, int index)
        {
            BIOPDescriptor descriptor = null;

            switch (byteData[index])
            {
                case DVBCompressedModuleDescriptor.Tag:
                    descriptor = new DVBCompressedModuleDescriptor();
                    break;
                case MHPLabelDescriptor.Tag:
                    descriptor = new MHPLabelDescriptor();
                    break;
                case MHPCachingPriorityDescriptor.Tag:
                    descriptor = new MHPCachingPriorityDescriptor();
                    break;
                case MHPContentTypeDescriptor.Tag:
                    descriptor = new MHPContentTypeDescriptor();
                    break;
                default:
                    throw (new InvalidOperationException("BIOPDescriptor: Tag not recognized - " + byteData[index]));
            }

            descriptor.Process(byteData, index);

            return (descriptor);
        }