private void CreateAudioStream(int sample, int length, int sample_size) { VfwApi.AVISTREAMINFO sinfo = new VfwApi.AVISTREAMINFO(); sinfo.fccType = (int)VfwApi.streamtypeAUDIO; sinfo.fccHandler = 0; sinfo.dwFlags = 0; sinfo.dwCaps = 0; sinfo.wPriority = 0; sinfo.wLanguage = 0; sinfo.dwScale = 1; sinfo.dwRate = sample; sinfo.dwStart = 0; sinfo.dwLength = length; sinfo.dwInitialFrames = 0; sinfo.dwSuggestedBufferSize = 0; sinfo.dwQuality = 0; sinfo.dwSampleSize = sample_size; sinfo.rcFrame = new VfwApi.RECT(); sinfo.rcFrame.top = 0; sinfo.rcFrame.left = 0; sinfo.rcFrame.bottom = 0; sinfo.rcFrame.right = 0; sinfo.dwEditCount = 0; sinfo.dwFormatChangeCount = 0; sinfo.szName = new ushort[64]; int hr = VfwApi.AVIFileCreateStream(pfile_, ref pavi_audio_, ref sinfo); if (hr != 0) { throw new VfwException("AVIFileCreateStream", hr); } }
private void CreateVideoStream(int width, int height, int stride, int rate, int scale) { VfwApi.AVISTREAMINFO sinfo = new VfwApi.AVISTREAMINFO(); sinfo.fccType = (int)VfwApi.streamtypeVIDEO; sinfo.fccHandler = (int)VfwApi.mmioFOURCC('D', 'I', 'B', ' '); sinfo.dwFlags = 0; sinfo.dwCaps = 0; sinfo.wPriority = 0; sinfo.wLanguage = 0; sinfo.dwScale = scale; sinfo.dwRate = rate; sinfo.dwStart = 0; sinfo.dwLength = 0; sinfo.dwInitialFrames = 0; sinfo.dwSuggestedBufferSize = height * stride; sinfo.dwQuality = -1; sinfo.dwSampleSize = 0; sinfo.rcFrame = new VfwApi.RECT(); sinfo.rcFrame.top = 0; sinfo.rcFrame.left = 0; sinfo.rcFrame.bottom = (uint)height; sinfo.rcFrame.right = (uint)width; sinfo.dwEditCount = 0; sinfo.dwFormatChangeCount = 0; sinfo.szName = new ushort[64]; int hr = VfwApi.AVIFileCreateStream(pfile_, ref pavi_, ref sinfo); if (hr != 0) { throw new VfwException("AVIFileCreateStream", hr); } }