示例#1
0
        /// <summary>
        ///    Reads format specific information at the start of the
        ///    file.
        /// </summary>
        /// <param name="start">
        ///    A <see cref="long" /> value containing the seek position
        ///    at which the tags end and the media data begins.
        /// </param>
        /// <param name="propertiesStyle">
        ///    A <see cref="ReadStyle" /> value specifying at what level
        ///    of accuracy to read the media properties, or <see
        ///    cref="ReadStyle.None" /> to ignore the properties.
        /// </param>
        protected override void ReadStart(long start,
		                                   ReadStyle propertiesStyle)
        {
            long end;
            IList<Block> blocks = ReadBlocks (ref start, out end,
                BlockMode.Whitelist, BlockType.StreamInfo,
                BlockType.XiphComment, BlockType.Picture);
            metadata = new Metadata (blocks);

            TagTypesOnDisk |= metadata.TagTypes;

            if (propertiesStyle != ReadStyle.None) {
                // Check that the first block is a
                // METADATA_BLOCK_STREAMINFO.
                if (blocks.Count == 0 ||
                    blocks [0].Type != BlockType.StreamInfo)
                    throw new CorruptFileException (
                        "FLAC stream does not begin with StreamInfo.");

                // The stream exists from the end of the last
                // block to the end of the file.
                stream_start = end;
                header_block = blocks [0].Data;
            }
        }
示例#2
0
 protected override void ReadStart(long start, ReadStyle propertiesStyle)
 {
     long num;
     BlockType[] types = new BlockType[3];
     types[1] = BlockType.XiphComment;
     types[2] = BlockType.Picture;
     IList<Block> blocks = this.ReadBlocks(ref start, out num, BlockMode.Whitelist, types);
     this.metadata = new Metadata(blocks);
     base.TagTypesOnDisk |= this.metadata.TagTypes;
     if (propertiesStyle != ReadStyle.None)
     {
         if ((blocks.Count == 0) || (blocks[0].Type != BlockType.StreamInfo))
         {
             throw new CorruptFileException("FLAC stream does not begin with StreamInfo.");
         }
         this.stream_start = num;
         this.header_block = blocks[0].Data;
     }
 }