Exemplo n.º 1
0
 static Box ParseBox(BoxLocation location, SequentialReader sr)
 {
     return(location.Type switch
     {
         BoxTypes.FTypTag => new FileTypeBox(location, sr),
         BoxTypes.MetaTag => new MetaBox(location, sr),
         BoxTypes.HdlrTag => new HandlerBox(location, sr),
         BoxTypes.DinfTag => new DataInformationBox(location, sr),
         BoxTypes.DrefTag => new DataReferenceBox(location, sr),
         BoxTypes.UrlTag => new DataEntryLocationBox(location, sr, hasName: false),
         BoxTypes.UrnTag => new DataEntryLocationBox(location, sr, hasName: true),
         BoxTypes.PitmTag => new PrimaryItemBox(location, sr),
         BoxTypes.Iinftag => new ItemInformationBox(location, sr),
         BoxTypes.InfeTag => new ItemInfoEntryBox(location, sr),
         BoxTypes.IrefTag => new ItemReferenceBox(location, sr),
         BoxTypes.IprpTag => new ItemPropertyBox(location, sr),
         BoxTypes.IpcoTag => new ItemPropertyContainerBox(location, sr),
         BoxTypes.IspeTag => new ImageSpatialExtentsBox(location, sr),
         BoxTypes.HvcCTag => new DecoderConfigurationBox(location, sr),
         BoxTypes.ColrTag => new ColorInformationBox(location, sr),
         BoxTypes.IrotTag => new ImageRotationBox(location, sr),
         BoxTypes.PixiTag => new PixelInformationBox(location, sr),
         BoxTypes.IdatTag => new ItemDataBox(location, sr),
         BoxTypes.IlocTag => new ItemLocationBox(location, sr),
         BoxTypes.IpmaTag => new ItemPropertyAssociationBox(location, sr),
         _ => new Box(location)
     });
Exemplo n.º 2
0
        public static List <Box> ReadBoxes(SequentialReader sr, BoxLocation loc)
        {
            var ret = new List <Box>();

            while (sr.IsWithinBox(loc))
            {
                var box = ReadBox(sr);
                if (box != null)
                {
                    ret.Add(box);
                }
            }

            return(ret);
        }
 public static bool IsWithinBox(this SequentialReader reader, BoxLocation location) => (ulong)reader.Position < location.NextPosition;
 public static ulong BytesRemainingInBox(this SequentialReader reader, BoxLocation boxLocation) => boxLocation.NextPosition - (ulong)reader.Position;
Exemplo n.º 5
0
 public Box(BoxLocation location) => _location = location;