Exemple #1
0
		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)));
		}
Exemple #2
0
 public Mpeg4IsoSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
     File.Seek(base.DataPosition + 6);
     dataReferenceIndex = (ushort)File.ReadBlock(2).ToShort();
 }
Exemple #3
0
        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();
            }
        }