internal AtomEvent(string name, AtomTypeFlags flags, long size, long dataSize) { Name = name; Flags = flags; Size = size; DataSize = dataSize; }
/// <summary> /// Read atom header, add known flags. /// </summary> private AtomEvent ReadAtom() { // get size uint sizeShort; if (!TryReadUint(out sizeShort)) { return(null); // end of stream } long size = sizeShort; long dataSize = size - 8; // header length // get type string name = ReadAsciiStr(4); if (string.IsNullOrEmpty(name)) { return(null); } // check for wide atom if (sizeShort == 0) { // Should not be hard to support it but dont need it yet. throw new InvalidOperationException("Open atom not supported."); } if (sizeShort == 1) { // wide atom (should be "mdat") ulong sizeLong; if (!TryReadUlong(out sizeLong)) { return(null); // end of stream } size = (long)sizeLong; // better to have size ulong, bot other methods expect long dataSize = size - 16; } // get known flags AtomTypeFlags flags = AtomTypeFlags.None; AtomType type = Types.GetValueOrDefault(name); if (type != null) { flags = type.Flags; } return(new AtomEvent(name, flags, size, dataSize)); }
public AtomType(string name, AtomTypeFlags flags) { Name = name; Flags = flags; }