Beispiel #1
0
 public FileTypeBox(FourCC majorBrand, uint minorVersion, FourCC[] compatibleBrands)
     : this()
 {
     MajorBrand = majorBrand;
     MinorVersion = minorVersion;
     foreach(FourCC fourCC in compatibleBrands) _CompatibleBrands.Add(fourCC);
 }
Beispiel #2
0
        public BoxType(FourCC fourcc)
        {
            _FourCC = fourcc;

            byte[] uuidBytes = new byte[16];
            Buffer.BlockCopy(_FourCC.GetBytes(), 0, uuidBytes, 0, 4);
            Buffer.BlockCopy(BASE_UUID, 4, uuidBytes, 4, 12);

            _UserType = new Guid(uuidBytes);
        }
Beispiel #3
0
        public BoxType(FourCC fourcc)
        {
            _FourCC = fourcc;

            byte[] uuidBytes = new byte[16];
            Buffer.BlockCopy(_FourCC.GetBytes(), 0, uuidBytes, 0, 4);
            Buffer.BlockCopy(BASE_UUID, 4, uuidBytes, 4, 12);

            _UserType = new Guid(uuidBytes);
        }
Beispiel #4
0
        public BoxType(Guid uuid)
        {
            _UserType = uuid;

            bool isBaseType = true;
            byte[] uuidBytes = uuid.ToByteArray();
            for (int i = 4; i < 16; i++) if (uuidBytes[i] != BASE_UUID[i]) isBaseType=false;

            if (isBaseType) _FourCC = new FourCC(BitConverter.ToUInt32(uuidBytes, 0).NetworkToHostOrder());
            else _FourCC = UUID_FOURCC;
        }
Beispiel #5
0
        protected override void LoadFromStream(Stream stream)
        {
            base.LoadFromStream(stream);

            MajorBrand = new FourCC(stream.ReadBEUInt32());
            MinorVersion = stream.ReadBEUInt32();

            ulong remainingBytes = EffectiveSize - CalculateSize();
            ulong numBrands =  remainingBytes / 4;
            for (ulong i = 0; i < numBrands ; i++)
            {
                _CompatibleBrands.Add(new FourCC(stream.ReadBEUInt32()));
            }
        }
Beispiel #6
0
        public BoxType(Guid uuid)
        {
            _UserType = uuid;

            bool isBaseType = true;

            byte[] uuidBytes = uuid.ToByteArray();
            for (int i = 4; i < 16; i++)
            {
                if (uuidBytes[i] != BASE_UUID[i])
                {
                    isBaseType = false;
                }
            }

            if (isBaseType)
            {
                _FourCC = new FourCC(BitConverter.ToUInt32(uuidBytes, 0).NetworkToHostOrder());
            }
            else
            {
                _FourCC = UUID_FOURCC;
            }
        }
Beispiel #7
0
 public override string ToString()
 {
     return(FourCC == UUID_FOURCC?string.Format("uuid({0})", UserType.ToString()) : FourCC.ToString());
 }
Beispiel #8
0
 public override string ToString()
 {
     return(FourCC == UUID_FOURCC ? $"uuid({UserType})" : FourCC.ToString());
 }
Beispiel #9
0
 public bool IsCompatibleWith(FourCC brand)
 {
     if (MajorBrand == brand) return true;
     if (_CompatibleBrands.Contains(brand)) return true;
     return false;
 }