public override void decode(MP4InputStream inStream) { base.decode(inStream); while (getLeft(inStream) > 0) { int rate = (int)inStream.readBytes(4); int initialDelay = (int)inStream.readBytes(4); pairs.Add(new KeyValuePair <int, int>(rate, initialDelay)); } }
public override void decode(MP4InputStream inStream) { base.decode(inStream); inStream.skipBytes(4); //pre-defined: 0 handlerType = inStream.readBytes(4); inStream.readBytes(4); //reserved inStream.readBytes(4); //reserved inStream.readBytes(4); //reserved handlerName = inStream.readEncodedString((int)getLeft(inStream), Encoding.UTF8); }
public override void decode(MP4InputStream inStream) { // 3gpp or iTunes if (parent.getType() == BoxType.USER_DATA_BOX) { base.decode(inStream); // TODO: what to do with both? long entity = inStream.readBytes(4); long criteria = inStream.readBytes(4); languageCode = BoxUtils.getLanguageCode(inStream.readBytes(2)); var b = inStream.readTerminated((int)getLeft(inStream), 0); rating = Encoding.UTF8.GetString(b); } else { readChildren(inStream); } }
public override void decode(MP4InputStream inStream) { base.decode(inStream); referenceType = inStream.readString(4); while (getLeft(inStream) > 3) { trackIDs.Add((int)inStream.readBytes(4)); } }
public override void decode(MP4InputStream inStream) { base.decode(inStream); graphicsMode = inStream.readBytes(2); // 6 byte RGB color var c = new int[3]; for (int i = 0; i < 3; i++) { c[i] = (inStream.read() & 0xFF) | ((inStream.read() << 8) & 0xFF); } color = Color.FromArgb(c[0], c[1], c[2]); }
public override void decode(MP4InputStream inStream) { // 3gpp or iTunes if (parent.getType() == BoxType.USER_DATA_BOX) { base.decode(inStream); languageCode = BoxUtils.getLanguageCode(inStream.readBytes(2)); var b = inStream.readTerminated((int)getLeft(inStream), 0); genre = Encoding.UTF8.GetString(b); } else { readChildren(inStream); } }
public static IBox parseBox(IBox parent, MP4InputStream inStream) { long offset = inStream.getOffset(); long size = inStream.readBytes(4); var type = (BoxType)(uint)inStream.readBytes(4); if (size == 1) { size = inStream.readBytes(8); } if (type == BoxType.EXTENDED_TYPE) { inStream.skipBytes(16); } if (type == 0) { return(new UnknownBox()); } // --- error protection --- if (parent != null) { long parentLeft = (parent.getOffset() + parent.getSize()) - offset; if (size > parentLeft) { throw new Exception("error while decoding box '" + type + "' ('" + typeToString(type) + "') at offset " + offset.ToString("N0") + ": box too large for parent"); } } Logger.LogBoxes("[" + offset.ToString("N0") + "] " + GetBoxPath(type, parent)); var box = forType(type, inStream.getOffset()); box.setParams(parent, size, type, offset); box.decode(inStream); // --- if box doesn't contain data it only contains children --- if (box.GetType() == typeof(BoxImpl) || box.GetType() == typeof(FullBox)) { box.readChildren(inStream); } // --- check bytes left --- long left = (box.getOffset() + box.getSize()) - inStream.getOffset(); if (left > 0) { if (!(box is MediaDataBox) && !(box is UnknownBox) && !(box is FreeSpaceBox)) { Logger.LogInfo(string.Format("bytes left after reading box {0}: left: {1}, offset: {2}", typeToString(type), left, inStream.getOffset())); } // --- skip left Data --- inStream.skipBytes(left); } else if (left < 0) { Logger.LogServe(string.Format("box {0} overread: {1} bytes, offset: {2}", typeToString(type), -left, inStream.getOffset())); } return(box); }