protected void Read(File file) { if (file == null) { return; } try { file.Mode = FileAccessMode.Read; } catch (TagLibException) { return; } file.Seek(tagOffset); footer.SetData(file.ReadBlock((int)ApeFooter.Size)); if (footer.TagSize == 0 || footer.TagSize > (uint)file.Length) { return; } file.Seek(tagOffset + ApeFooter.Size - footer.TagSize); Parse(file.ReadBlock((int)(footer.TagSize - ApeFooter.Size))); }
public void LoadData(long dataPosition, int dataSize) { if (data == null && this.File != null && this.File.Mode != FileAccessMode.Closed) { File.Seek(dataPosition); data = File.ReadBlock(dataSize); } }
protected Mpeg4FullBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { File.Seek(base.DataPosition); // First 4 buffer contain version and flag data. version = File.ReadBlock(1)[0]; flags = File.ReadBlock(3).ToUInt(); }
public Mpeg4IsoSampleDescriptionBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { File.Seek(base.DataPosition); // This box just contains a number saying how many of the first boxes // will be SampleEntries, since they can be named whatever they want to // be. entryCount = File.ReadBlock(4).ToUInt(); }
public Mpeg4IsoAudioSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { File.Seek(base.DataPosition + 8); channelCount = (ushort)File.ReadBlock(2).ToShort(); sampleSize = (ushort)File.ReadBlock(2).ToShort(); File.Seek(base.DataPosition + 16); sampleRate = (uint)File.ReadBlock(4).ToUInt(); }
public Mpeg4IsoChunkLargeOffsetBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { File.Seek(base.DataPosition); offsets = new List <ulong>((int)File.ReadBlock(4).ToUInt()); for (int i = 0; i < offsets.Count; i++) { offsets[i] = (ulong)File.ReadBlock(4).ToLong(); } }
public Mpeg4IsoChunkOffsetBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { File.Seek(base.DataPosition); offsets = new List <uint>((int)File.ReadBlock(4).ToUInt()); //new uint[(int)File.ReadBlock(4).ToUInt()]; for (int i = 0; i < offsets.Count; i++) { offsets[i] = File.ReadBlock(4).ToUInt(); } }
protected void Read(File file) { if (file == null) return; try { file.Mode = FileAccessMode.Read; } catch (TagLibException) { return; } file.Seek(tagOffset); footer.SetData(file.ReadBlock((int)ApeFooter.Size)); if (footer.TagSize == 0 || footer.TagSize > (uint)file.Length) return; file.Seek(tagOffset + ApeFooter.Size - footer.TagSize); Parse(file.ReadBlock((int)(footer.TagSize - ApeFooter.Size))); }
public Mpeg4IsoHandlerBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { // Reserved File.Seek(base.DataPosition + 4); // Read the handler type. handlerType = File.ReadBlock(4); // Reserved File.Seek(base.DataPosition + 20); // Find the terminating byte and read a string from the data before it. long end = File.Find((byte)0, File.Tell); name = File.ReadBlock((int)(end - File.Tell)).ToString(); }
protected void Read() { if (file != null && file.IsValid) { file.Seek(tagOffset); // read the tag -- always 128 buffer ByteVector data = file.ReadBlock(128); // some initial sanity checking if (data.Count == 128 && data.StartsWith(FileIdentifier)) //"TAG")) { Parse(data); } else { TagLibDebugger.Debug("ID3v1 tag is not valid or could not be read at the specified offset."); } } }
public Mpeg4IsoSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { File.Seek(base.DataPosition + 6); dataReferenceIndex = (ushort)File.ReadBlock(2).ToShort(); }
public Mpeg4IsoMovieHeaderBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent) { // Size depends on version. boxSize = Version == 1 ? 108 : 96; // Get everything. File.Seek(base.DataPosition); ByteVector data = File.ReadBlock(boxSize); int pos = 0; // Read version one (large integers). if (Version == 1) { if (data.Count >= pos + 8) { creationTime = (ulong)data.Mid(pos, 8).ToLong(); } pos += 8; if (data.Count >= pos + 8) { modificationTime = (ulong)data.Mid(pos, 8).ToLong(); } pos += 8; if (data.Count >= pos + 4) { timescale = data.Mid(pos, 4).ToUInt(); } pos += 4; if (data.Count >= pos + 8) { duration = (ulong)data.Mid(pos, 8).ToLong(); } pos += 8; } // Read version zero (normal integers). else { if (data.Count >= pos + 4) { creationTime = data.Mid(pos, 4).ToUInt(); } pos += 4; if (data.Count >= pos + 4) { modificationTime = data.Mid(pos, 4).ToUInt(); } pos += 4; if (data.Count >= pos + 4) { timescale = data.Mid(pos, 4).ToUInt(); } pos += 4; if (data.Count >= pos + 4) { duration = (ulong)data.Mid(pos, 4).ToUInt(); } pos += 4; } // Get rate if (data.Count >= pos + 4) { rate = data.Mid(pos, 4).ToUInt(); } pos += 4; // Get volume if (data.Count >= pos + 2) { volume = (ushort)data.Mid(pos, 2).ToShort(); } pos += 2; // reserved pos += 2; // reserved pos += 8; // video transformation matrix pos += 36; // pre-defined pos += 24; // Get next track ID if (data.Count >= pos + 4) { nextTrackId = (ushort)data.Mid(pos, 4).ToUInt(); } }