/// <summary>Copy the stream into a new file</summary> /// <param name="fileName">Name of the new file</param> public override void ExportStream(String fileName) { Avi.AVICOMPRESSOPTIONS_CLASS opts = new Avi.AVICOMPRESSOPTIONS_CLASS(); opts.fccType = (UInt32)Avi.mmioStringToFOURCC("auds", 0); opts.fccHandler = (UInt32)Avi.mmioStringToFOURCC("CAUD", 0); opts.dwKeyFrameEvery = 0; opts.dwQuality = 0; opts.dwFlags = 0; opts.dwBytesPerSecond = 0; opts.lpFormat = new IntPtr(0); opts.cbFormat = 0; opts.lpParms = new IntPtr(0); opts.cbParms = 0; opts.dwInterleaveEvery = 0; Avi.AVISaveV(fileName, 0, 0, 1, ref aviStream, ref opts); }
/// <summary>Create a new stream</summary> private void CreateStreamWithoutFormat() { int scale = 1; double rate = frameRate; GetRateAndScale(ref rate, ref scale); Avi.AVISTREAMINFO strhdr = new Avi.AVISTREAMINFO(); strhdr.fccType = Avi.mmioStringToFOURCC("vids", 0); strhdr.fccHandler = Avi.mmioStringToFOURCC("CVID", 0); strhdr.dwFlags = 0; strhdr.dwCaps = 0; strhdr.wPriority = 0; strhdr.wLanguage = 0; strhdr.dwScale = (int)scale; strhdr.dwRate = (int)rate; // Frames per Second strhdr.dwStart = 0; strhdr.dwLength = 0; strhdr.dwInitialFrames = 0; strhdr.dwSuggestedBufferSize = frameSize; //height_ * stride_; strhdr.dwQuality = -1; //default strhdr.dwSampleSize = 0; strhdr.rcFrame.top = 0; strhdr.rcFrame.left = 0; strhdr.rcFrame.bottom = (uint)height; strhdr.rcFrame.right = (uint)width; strhdr.dwEditCount = 0; strhdr.dwFormatChangeCount = 0; strhdr.szName = new UInt16[64]; int result = Avi.AVIFileCreateStream(aviFile, out aviStream, ref strhdr); if (result != 0) { throw new Exception("Exception in AVIFileCreateStream: " + result.ToString()); } }