GetCodec() public static method

Determines the correct codec to use for a stream header packet.
This method will first use CodecProvider delegates registered with AddCodecProvider and then attempt to use the built-in codecs.
/// No registered codec capable of processing could be found. ///
public static GetCodec ( ByteVector packet ) : Codec
packet ByteVector /// A object containing the first /// packet of an Ogg logical bitstream. ///
return Codec
示例#1
0
 public Bitstream(Page page)
 {
     if (page == null)
     {
         throw new ArgumentNullException("page");
     }
     codec = Codec.GetCodec(page.Packets[0]);
     first_absolute_granular_position = page.Header.AbsoluteGranularPosition;
 }
示例#2
0
        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="Bitstream" /> capable of processing a specified
        ///    page.
        /// </summary>
        /// <param name="page">
        ///    The first <see cref="Page" /> object of the stream to be
        ///    processed by the new instance.
        /// </param>
        /// <remarks>
        ///    The constructor only sets the new instance up to read the
        ///    packet, but doesn't actually read it.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="page" /> is <see langword="null" />.
        /// </exception>
        /// <exception cref="UnsupportedFormatException">
        ///    No registered codec capable of processing <paramref
        ///    name="page" /> could be found.
        /// </exception>
        public Bitstream(Page page)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            // Assume that the first packet is completely enclosed.
            // This should be sufficient for codec recognition.
            Codec = Codec.GetCodec(page.Packets[0]);

            first_absolute_granular_position = page.Header.AbsoluteGranularPosition;
        }