public override void Read(BoxReader reader)
        {
            base.Read(reader);
            // scan three strings, 2 of which may be empty
              int strCount = 0;
              for (int i = 0; (strCount < 3) && (i < allStrings.Length); i++) {
            allStrings[i] = reader.ReadChar();
            if (allStrings[i] == 0)
              strCount++;
              }
              contentEncoding = GetNextString();
              nameSpace = GetNextString();
              schemaLocation = GetNextString();

              if ((reader.BaseStream.Position - (long)Offset) < (long)Size) {
            bitRateBox = new BitRateBox();
            bitRateBox.Read(reader);
              }
        }
        public override void Read(BoxReader reader)
        {
            using (new SizeChecker(this, reader)) {
            long startpos = reader.BaseStream.Position;

            base.Read(reader);
            reader.ReadUInt16(); // pre_defined = 0;
            reader.ReadUInt16(); // reserved = 0;
            for (int i = 0; i < 3; i++) reader.ReadUInt32();  // unsigned int(32)[3] pre_defined = 0
            Width = reader.ReadUInt16();
            Height = reader.ReadUInt16();
            HorizResolution = reader.ReadUInt32(); // = 0x0048000 = 72 dpi
            VertResolution = reader.ReadUInt32(); // = 0x0048000 = 72 dpi
            reader.ReadUInt32(); // reserved = 0
            FrameCount = reader.ReadUInt16(); // frame_count = 1

            // Compressor name has first 2 bytes which is the readable length, the rest are char's or null bytes
            CompressorName = "";
            ushort len = reader.ReadUInt16();
            // NOTE: Some encoders use only one byte for count of compressor name, so here
            // we test for whether the length is valid. If not valid, only the first byte is
            // used as the length.
            if (len > 30)
            {
              byte[] b = BitConverter.GetBytes(len);
              if (BitConverter.IsLittleEndian)
              {
            len = (ushort)b[1];
            CompressorName += (char)b[0];
              }
              else
              {
            len = (ushort)b[0];
            CompressorName += (char)b[1];
              }
            }
            for (int i=0; i<30; i++) {
              if (i < len)
            CompressorName += reader.ReadChar();
              else
            reader.ReadChar();
            }
            CompressorName = CompressorName.Trim().Replace("\0","");
            Depth = reader.ReadUInt16(); // depth = 0x0018
            reader.ReadUInt16();  // pre_defined = -1

            bool bOptionalBoxFound = true;
            while (bOptionalBoxFound) {
              bOptionalBoxFound = false;
              long pos = reader.BaseStream.Position;
              Box test = new Box(BoxTypes.Any);
              test.Read(reader);
              reader.BaseStream.Position = pos;

              if (test.Type == BoxTypes.CleanApertureBox) {
            CleanApertureBox = new CleanApertureBox();
            CleanApertureBox.Read(reader);
            bOptionalBoxFound = true;
              } else

              if (test.Type == BoxTypes.PixelAspectRatio) {
            PixelAspectRatioBox = new PixelAspectRatioBox();
            PixelAspectRatioBox.Read(reader);
            bOptionalBoxFound = true;
              } else

              // retrieve CodecPrivateData from avcC
              if (test.Type == BoxTypes.AvcC) {
            AvcCBox = new AvcCBox();
            AvcCBox.Read(reader);

            //if ((ulong) (reader.BaseStream.Position - pos) < this.Size) {
            //  // klude to work around Expression problem (missing uuid, but box size large enough for it)
            //  pos = reader.BaseStream.Position;
            //  test = new Box(BoxTypes.Any);
            //  test.Read(reader);
            //  reader.BaseStream.Position = pos;

            //  if (test.Type == BoxTypes.UUID) {
            //    Uuid = new UuidBox();
            //    Uuid.Read(reader);
            //  }
            //}
            bOptionalBoxFound = true;
              } else

              if (test.Type == BoxTypes.UUID) {
            Uuid = new UuidBox();
            Uuid.Read(reader);
              } else

              if (test.Type == BoxTypes.Mp4v) {
            PrivDataFullBox = new AnyPrivFullBox();
            PrivDataFullBox.Read(reader);
            bOptionalBoxFound = true;
              } else

              if (test.Type == BoxTypes.Vc1) {
            PrivDataBox = new AnyPrivBox();
            PrivDataBox.Read(reader);
            bOptionalBoxFound = true;
              }
            }
              }
        }