//http://id3.org/id3v2.4.0-structure private void Parse4(Stream stream) { HeaderLength = ID3Utils.ReadInt32(stream, false); byte[] flags = ID3Utils.Read(stream, 1); Flags = (ID3v2ExtendedHeaderFlags)flags[0]; if ((Flags & ID3v2ExtendedHeaderFlags.CrcPresent) == ID3v2ExtendedHeaderFlags.CrcPresent) { CRC = ID3Utils.Read(stream, 5); } if ((Flags & ID3v2ExtendedHeaderFlags.Restrict) == ID3v2ExtendedHeaderFlags.Restrict) { //%ppqrrstt TagSizeRestriction = (ID3v2TagSizeRestriction)(flags[0] & 0xC0); //p --> last 2 bit TextEncodingRestriction = (ID3v2TextEncodingRestriction)(flags[0] & 0x20); //q TextFieldSizeRestriction = (ID3v2TextFieldSizeRestriction)(flags[0] & 0x18); //r ImageEncodingRestriction = (ID3v2ImageEncodingRestriction)(flags[0] & 0x4); //s ImageSizeRestriction = (ID3v2ImageSizeRestriction)(flags[0] & 0x3); //t } if ((flags[0] & 0x8F) != 0) { throw new ID3Exception("Invalid Extendedheaderflags"); } }
public Frame GetFrame(FrameHeader header, ID3Version version, Stream stream) { var frame = GetFrame(header.FrameID, version, header); frame.DecodeContent(ID3Utils.Read(stream, header.FrameSize)); return(frame); }
private void Parse2(Stream stream) { byte[] buffer = ID3Utils.Read(stream, 6); FrameID = ID3Utils.ReadString(buffer, 0, 3, ID3Utils.Iso88591); FrameSize = ID3Utils.ReadInt32(buffer, 3, false, 3); //Flags not supported Flags = FrameFlags.None; }
private void Parse4(Stream stream) { byte[] buffer = ID3Utils.Read(stream, 10); FrameID = ID3Utils.ReadString(buffer, 0, 4, ID3Utils.Iso88591); FrameSize = ID3Utils.ReadInt32(buffer, 4, true, 4); byte[] flags = new byte[] { buffer[8], buffer[9] }; //%0abc0000 Framestatusflags if ((flags[0] & 0x40) == 0) { Flags |= FrameFlags.PreserveTagAltered; } if ((flags[0] & 0x20) == 0) { Flags |= FrameFlags.PreserveFileAltered; } if ((flags[0] & 0x10) != 0) { Flags |= FrameFlags.ReadOnly; } //%0h00kmnp Frameformatflags if ((flags[1] & 0x40) != 0) { Flags |= FrameFlags.GroupIdentified; GroupIdentifier = ID3Utils.Read(stream, 1)[0]; FrameSize -= 1; } if ((flags[1] & 0x8) != 0) { Flags |= FrameFlags.Compressed; } if ((flags[1] & 0x4) != 0) { Flags |= FrameFlags.Encrypted; _encryptionMethod = ID3Utils.Read(stream, 1)[0]; FrameSize -= 1; } if ((flags[1] & 0x2) != 0) { Flags |= FrameFlags.UnsyncApplied; //todo: tag allgemein benachrichtigen? } if ((flags[1] & 0x1) != 0) { Flags |= FrameFlags.DataLengthIndicatorPresent; _dataLengthIndicator = ID3Utils.ReadInt32(stream, true); FrameSize -= 4; } }
private void Parse3(Stream stream) { HeaderLength = ID3Utils.ReadInt32(stream, false); byte[] flags = ID3Utils.Read(stream, 2); PaddingSize = ID3Utils.ReadInt32(stream, false); if ((flags[0] & 0x7F) != 0 || flags[1] != 0) { throw new ID3Exception("Invalid ExtendedHeaderflags"); } //Flags = (ID3v2ExtendedHeaderFlags)flags[0]; if ((flags[0] & 0x80) != 0) { Flags |= ID3v2ExtendedHeaderFlags.CrcPresent; CRC = ID3Utils.Read(stream, 4); } }
private void Parse3(Stream stream) { byte[] buffer = ID3Utils.Read(stream, 10); FrameID = ID3Utils.ReadString(buffer, 0, 4, ID3Utils.Iso88591); FrameSize = ID3Utils.ReadInt32(buffer, 4, false, 4); byte[] flags = new byte[] { buffer[8], buffer[9] }; //%abc00000 if ((flags[0] & 0x80) == 0) { Flags |= FrameFlags.PreserveTagAltered; } if ((flags[0] & 0x40) == 0) { Flags |= FrameFlags.PreserveFileAltered; } if ((flags[0] & 0x20) != 0) { Flags |= FrameFlags.ReadOnly; } //%ijk00000 if ((flags[1] & 0x80) != 0) { Flags |= FrameFlags.Compressed; _uncompressedSize = ID3Utils.ReadInt32(stream, false); FrameSize -= 4; } if ((flags[1] & 0x40) != 0) { Flags |= FrameFlags.Encrypted; _encryptionMethod = ID3Utils.Read(stream, 1)[0]; FrameSize -= 1; } if ((flags[1] & 0x20) != 0) { Flags |= FrameFlags.GroupIdentified; GroupIdentifier = ID3Utils.Read(stream, 1)[0]; FrameSize -= 1; } }