public override bool Parse(AviParser parser) { // Call the Parse method of the parent to initialise the header and // allow parsing the containing header if there is one. if (!base.Parse(parser)) { return(false); } // Now parse the header. LstType = parser.GetFourCC(Attribute.ListType); if (LstType == (uint)ListType.Info) { do { Valid = parser.Parse(new InfoAttribute(parser.BytesRemaining)); }while (parser.BytesRemaining > 0 && Valid); } else if (LstType == (uint)ListType.Prmi) { uint maxPrmiLength = (uint)AviDetector.Configurable[AviDetector.ConfigurationKey.HeaderListMaxPrmiLength]; parser.GetInt(Attribute.Unknown); parser.GetInt(Attribute.Unknown); parser.GetInt(Attribute.Unknown); if (parser.BytesRemaining > maxPrmiLength) { return(false); // Sanity check } parser.GetString(Attribute.AviAdobePremiereInfoList, parser.BytesRemaining); } return(Valid); }
public override bool Parse(AviParser parser) { const short MaxLongsPerEntryCount = 16; // Random choice. The only value I've seen up till now is 4. if (!base.Parse(parser)) { return(false); } ushort longsPerEntry = (ushort)parser.GetShort(Attribute.LongsPerEntry); if (longsPerEntry > MaxLongsPerEntryCount) { return(false); } parser.GetByte(Attribute.IndexSubType); parser.GetByte(Attribute.IndexType); parser.GetInt(Attribute.EntriesInUse); parser.GetInt(Attribute.ChunkId); parser.GetInt(Attribute.Reserved); parser.GetInt(Attribute.Reserved); parser.GetInt(Attribute.Reserved); if (longsPerEntry > 0) { ulong bytesRemaining = parser.BytesRemaining; parser.Parse(new IndexTableAttribute(longsPerEntry, bytesRemaining)); ulong numberOfEntriesInTable = bytesRemaining / (uint)(longsPerEntry * 4); parser.CheckAttribute(Attribute.IndexTable, numberOfEntriesInTable * longsPerEntry * 4 == bytesRemaining, false); } return(Valid); }