RiffChunk(Stream stream, RiffAviFourCCCode code, RiffChunk parent) { this.stream = stream; WriteBits(RiffAviFourCCCodes.GetCode(code)); bookmark = new StreamBookmark(this.stream); bookmark.CaptureAndWrite(0); size = 0; this.parentChunk = parent; if (this.parentChunk != null) { this.parentChunk.size += 8; } }
public StreamBookmark WriteAndBookmarkDWORD(UInt32 value) { StreamBookmark bookmark = new StreamBookmark(this.stream); bookmark.CaptureAndWrite(value); this.size += 4; return (bookmark); }
void WriteStrhHeaderStructure(RiffChunk chunk) { chunk.WriteFourCC(RiffAviFourCCCode.Vids); // 'vids' chunk.WriteFourCC(RiffAviFourCCCode.Dib); // 'DIB ' chunk.WriteDWORD(0); // flags chunk.WriteWORD(0); // priority chunk.WriteWORD(0); // language chunk.WriteDWORD(0); // initial frames chunk.WriteDWORD(1); // scale chunk.WriteDWORD(framesPerSecond); // rate chunk.WriteDWORD(0); // start strhFrameCountBookmark = chunk.WriteAndBookmarkDWORD(0); // frameCount chunk.WriteDWORD(width * height * 4); // suggested buffer size chunk.WriteDWORD(0); // quality chunk.WriteDWORD(0); // sample size chunk.WriteDWORD(0); // left chunk.WriteDWORD(0); // top chunk.WriteDWORD((ushort)width); // right chunk.WriteDWORD((ushort)height); // bottom }
void WriteAvihHeaderStructure(RiffChunk chunk) { UInt32 microSecondsPerFrame = (UInt32)((1.0 / framesPerSecond) * 1.0E6); chunk.WriteDWORD(microSecondsPerFrame); // Microseconds per frame chunk.WriteDWORD(0); // Max Bytes Per Second chunk.WriteDWORD(0); // Padding granularity chunk.WriteDWORD(0); // Flags avihFrameCountBookmark = chunk.WriteAndBookmarkDWORD(0); // Total frames chunk.WriteDWORD(0); // Initial frames chunk.WriteDWORD(1); // Streams chunk.WriteDWORD(width * height * 4); // Suggested buffer size chunk.WriteDWORD(width); // Width chunk.WriteDWORD(height); // Height chunk.WriteDWORD(0); // Reserved [0] chunk.WriteDWORD(0); // Reserved [1] chunk.WriteDWORD(0); // Reserved [2] chunk.WriteDWORD(0); // Reserved [3] }