public override bool Parse(AviParser parser) { if (!base.Parse(parser)) { return(false); } parser.GetInt(Attribute.TotalFrames); return(Valid); }
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); } FileType = parser.GetFourCC(Attribute.FileType); // 'AVI ' or 'AVIX' return(Valid); }
public override bool Parse(AviParser parser) { uint maxStreamNameLength = (uint)AviDetector.Configurable[AviDetector.ConfigurationKey.AviStreamNameMaxNameLength]; if (!base.Parse(parser)) { return(false); } if (parser.BytesRemaining > maxStreamNameLength) { return(false); // Sanity check } parser.GetString(Attribute.Name, parser.BytesRemaining); return(Valid); }
public override bool Parse(AviParser parser) { if (!base.Parse(parser)) { return(false); } uint maxDateStringLength = (uint)AviDetector.Configurable[AviDetector.ConfigurationKey.DigitizingDateMaxDateStringLength]; if (parser.BytesRemaining > maxDateStringLength) { return(false); } parser.GetString(Attribute.DateTime, parser.BytesRemaining); return(Valid); }
public override bool Parse(AviParser parser) { if (!base.Parse(parser)) { return(false); } parser.GetInt(Attribute.MicroSecPerFrame); parser.GetInt(Attribute.MaxBytesPerSec); parser.GetInt(Attribute.PaddingGranularity); parser.GetInt(Attribute.Flags); // TODO parse flags // • AVIF_HASINDEX // The file has an index // • AVIF_MUSTUSEINDEX // The order in which the video and audio chunks must be replayed is determined by the // index and may differ from the order in which those chunks occur in the file. // • AVIF_ISINTERLEAVED // The streams are properly interleaved into each other // • AVIF_WASCAPTUREFILE // The file was captured. The interleave might be weird. // • AVIF_COPYRIGHTED // Ignore it // • AVIF_TRUSTCKTYPE (Open-DML only!) // This flag indicates that the keyframe flags in the index are reliable. If this flag is not // set in an Open-DML file, the keyframe flags could be defective without technically // rendering the file invalid. parser.GetInt(Attribute.TotalFrames); parser.GetInt(Attribute.InitialFrames); parser.GetInt(Attribute.Streams); parser.GetInt(Attribute.SuggestedBufferSize); parser.GetInt(Attribute.Width); parser.GetInt(Attribute.Height); parser.GetInt(Attribute.Reserved); parser.GetInt(Attribute.Reserved); parser.GetInt(Attribute.Reserved); parser.GetInt(Attribute.Reserved); return(Valid); }
public override bool Parse(AviParser parser) { if (!base.Parse(parser)) { return(false); } const int IntFieldsCount = 17; const int ExpectedSize = IntFieldsCount * sizeof(int); if (Size < ExpectedSize) // invalidate the size attribute { parser.CheckAttribute(AviChunk.Attribute.Size, Size == ExpectedSize, false); } else if (Size > ExpectedSize) // invalidate the complete header { parser.CheckAttribute(AviChunk.Attribute.Size, Size == ExpectedSize, true); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.VideoFormatToken, typeof(VideoFormatToken)); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.VideoStandard, typeof(VideoStandard)); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.VerticalRefreshRate); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.HorizontalTotalInT); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.VerticalTotalInLines); } if (parser.BytesRemaining >= 4) { parser.GetFrameAspectRatio(Attribute.FrameAspectRatio); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.FrameWidthInPixels); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.FrameHeightInLines); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.FieldPerFrame); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.CompressedBitmapHeight); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.CompressedBitmapWidth); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.ValidBitmapHeight); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.ValidBitmapWidth); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.ValidBitmapXOffset); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.ValidBitmapYOffset); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.VideoXOffsetInT); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.VideoYValidStartLine); } return(Valid); }
public override bool Parse(AviParser parser) { if (!base.Parse(parser)) { return(false); } const int FrameSize = 4 * sizeof(short); const int IntFieldCount = 11; const int ShortFieldCount = 2; const int ExpectedSize = IntFieldCount * sizeof(int) + ShortFieldCount * sizeof(short) + FrameSize; // One sample had 8 bytes more. // The assumption is made that the frame is written in four ints // instead of in four shorts. const int ExtraBytesAllowed = 8; if ((Size < ExpectedSize) || (Size > ExpectedSize && Size <= ExpectedSize + ExtraBytesAllowed)) // invalidate the size attribute { parser.CheckAttribute(AviChunk.Attribute.Size, Size == ExpectedSize, false); } else if (Size > ExpectedSize + ExtraBytesAllowed) // invalidate the complete header { parser.CheckAttribute(AviChunk.Attribute.Size, Size == ExpectedSize, true); } if (parser.BytesRemaining >= 4) { StreamType = parser.GetFourCC(Attribute.StreamType); } if (parser.BytesRemaining >= 4) { Handler = parser.GetFourCC(Attribute.Handler); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.Flags); } // TODO parse flags // // AVISF_DISABLED = 0x00000001 // Indicates this stream should not be enabled by default // // AVISF_VIDEO_PALCHANGES = 0x00010000 // Indicates this video stream contains palette changes. // This flag warns the playback software that it will need to // animate the palette. // if (parser.BytesRemaining >= 2) { parser.GetShort(Attribute.Priority); } if (parser.BytesRemaining >= 2) { parser.GetShort(Attribute.Language); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.InitialFrames); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.Scale); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.Rate); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.Start); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.Length); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.SuggestedBufferSize); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.Quality); } if (parser.BytesRemaining >= 4) { parser.GetInt(Attribute.SampleSize); } if (Size == ExpectedSize) { if (parser.BytesRemaining >= 8) { parser.GetFrame(Attribute.Frame, FrameFieldType.Short); } } else if (Size == ExpectedSize + 4 * sizeof(short)) { if (parser.BytesRemaining >= 16) { parser.GetFrame(Attribute.Frame, FrameFieldType.Int); } } return(Valid); }