public static Box newBox(Header header, BoxFactory factory) { Box claz = factory.ToClass(header.getFourcc()); if (claz == null) { return(new LeafBox(header)); } try { try { return(null); //return claz.getConstructor(Header.gclass).newInstance(header); } catch (Exception e) { return(claz.newInstance()); } } catch (Exception e) { throw e; } }
public static Box parseBox(MemoryStream input, Header childAtom, BoxFactory factory) { Box box = newBox(childAtom, factory); if (childAtom.getBodySize() < MAX_BOX_SIZE) { box.parse(input); return(box); } else { return(new LeafBox(new Header("free", 8))); } }
public static Box parseChildBox(MemoryStream input, BoxFactory factory) { MemoryStream fork = input.duplicate(); while (input.remaining() >= 4 && fork.getInt() == 0) { input.getInt(); } if (input.remaining() < 4) { return(null); } Header childAtom = Header.read(input); if (childAtom != null && input.remaining() >= childAtom.getBodySize()) { return(parseBox(StreamExtensions.read(input, (int)childAtom.getBodySize()), childAtom, factory)); } else { return(null); } }
public NodeBox(NodeBox other) : base(other) { this.boxes = other.boxes; this.factory = other.factory; }