public static bool Deserialize(Stream src, out VideoAvc dest) { dest = new VideoAvc(); if (src.GetAvaliableByteCounts() < 2) { Logger.FATAL("Not enough data"); return(false); } var reader = new N2HBinaryReader(src); var _spsLength = reader.ReadUInt16(); if (src.GetAvaliableByteCounts() < _spsLength + 2 + 8) { Logger.FATAL("Not enough data"); return(false); } var psps = reader.ReadBytes(_spsLength); var _ppsLength = reader.ReadUInt16(); if (src.GetAvaliableByteCounts() < _ppsLength + 2 + 8) { Logger.FATAL("Not enough data"); return(false); } var ppps = reader.ReadBytes(_ppsLength); dest.Init(psps, ppps); dest._widthOverride = reader.ReadUInt32(); dest._heightOverride = reader.ReadUInt32(); return(true); }
public static bool Deserialize(Stream src, out VideoAvc dest) { dest = new VideoAvc(); if (src.GetAvaliableByteCounts() < 2) { Logger.FATAL("Not enough data"); return false; } var reader = new N2HBinaryReader(src); var _spsLength = reader.ReadUInt16(); if (src.GetAvaliableByteCounts() < _spsLength + 2 + 8) { Logger.FATAL("Not enough data"); return false; } var psps = reader.ReadBytes(_spsLength); var _ppsLength = reader.ReadUInt16(); if (src.GetAvaliableByteCounts() < _ppsLength + 2 + 8) { Logger.FATAL("Not enough data"); return false; } var ppps = reader.ReadBytes(_ppsLength); dest.Init(psps, ppps); dest._widthOverride = reader.ReadUInt32(); dest._heightOverride = reader.ReadUInt32(); return true; }