Exemple #1
0
        public FlacMetaDataBlock(FlacMetaDataBlockType blockType)
        {
            if ((int)blockType > 6 || (int)blockType < 0)
            {
                throw new Exception(string.Format("BlockType ({0}) out of range", (int)blockType));
            }

            BlockType = blockType;
            BlockData = null;
        }
Exemple #2
0
        public FlacMetaDataBlock(FlacMetaDataBlockType blockType)
        {
            if ((int)blockType > 6 || (int)blockType < 0)
            {
                throw new Exception(string.Format("BlockType ({0}) out of range", (int)blockType));
            }

            BlockType = blockType;
            BlockData = null;
        }
Exemple #3
0
        private void ReadTag_FLAC(Stream stream, InternalInfo info)
        {
            info.FileType = FileType.Flac;

            // Skip "fLaC" marker
            stream.Seek(4, SeekOrigin.Current);

            bool isLastMetaDataBlock;

            List <FlacMetaDataBlock> metaDataBlockList = new List <FlacMetaDataBlock>();

            do
            {
                int c = stream.ReadByte();
                isLastMetaDataBlock = (((c >> 7) & 0x01) == 1);

                int blocksize = stream.ReadInt24();

                FlacMetaDataBlockType blockType = (FlacMetaDataBlockType)(c & 0x07);

                if (blockType == FlacMetaDataBlockType.VorbisComment) // Vorbis comment
                {
                    info.OrigVorbisCommentSize = blocksize;
                    long mvcoffset = stream.Position - 4;
                    ReadTag_VorbisComment(stream);
                    stream.Seek(mvcoffset + 4, SeekOrigin.Begin);
                }

                FlacMetaDataBlock metaDataBlock = new FlacMetaDataBlock(blockType);
                metaDataBlock.SetBlockData(stream, blocksize);
                metaDataBlockList.Add(metaDataBlock);
            } while (isLastMetaDataBlock == false);

            info.MetaDataBlockList = metaDataBlockList;
            _metaDataBlockList     = metaDataBlockList;
        }