本文整理汇总了C#中Parameters.PopulateBITMAPINFOHEADER24方法的典型用法代码示例。如果您正苦于以下问题:C# Parameters.PopulateBITMAPINFOHEADER24方法的具体用法?C# Parameters.PopulateBITMAPINFOHEADER24怎么用?C# Parameters.PopulateBITMAPINFOHEADER24使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameters
的用法示例。
在下文中一共展示了Parameters.PopulateBITMAPINFOHEADER24方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenFile
public void OpenFile(string destPath, Parameters parameters, CodecToken videoCodecToken)
{
this.parameters = parameters;
this.currVideoCodecToken = videoCodecToken;
//TODO - try creating the file once first before we let vfw botch it up?
//open the avi output file handle
if (File.Exists(destPath))
File.Delete(destPath);
if (Win32.FAILED(Win32.AVIFileOpenW(ref pAviFile, destPath, Win32.OpenFileStyle.OF_CREATE | Win32.OpenFileStyle.OF_WRITE, 0)))
throw new InvalidOperationException("Couldnt open dest path for avi file: " + destPath);
//initialize the video stream
Win32.AVISTREAMINFOW vidstream_header = new Win32.AVISTREAMINFOW();
Win32.BITMAPINFOHEADER bmih = new Win32.BITMAPINFOHEADER();
parameters.PopulateBITMAPINFOHEADER24(ref bmih);
vidstream_header.fccType = Win32.mmioFOURCC("vids");
vidstream_header.dwRate = parameters.fps;
vidstream_header.dwScale = parameters.fps_scale;
vidstream_header.dwSuggestedBufferSize = (int)bmih.biSizeImage;
if (Win32.FAILED(Win32.AVIFileCreateStreamW(pAviFile, out pAviRawVideoStream, ref vidstream_header)))
{
CloseFile();
throw new InvalidOperationException("Failed opening raw video stream. Not sure how this could happen");
}
//initialize audio stream
Win32.AVISTREAMINFOW audstream_header = new Win32.AVISTREAMINFOW();
Win32.WAVEFORMATEX wfex = new Win32.WAVEFORMATEX();
parameters.PopulateWAVEFORMATEX(ref wfex);
audstream_header.fccType = Win32.mmioFOURCC("auds");
audstream_header.dwQuality = -1;
audstream_header.dwScale = wfex.nBlockAlign;
audstream_header.dwRate = (int)wfex.nAvgBytesPerSec;
audstream_header.dwSampleSize = wfex.nBlockAlign;
audstream_header.dwInitialFrames = 1; // ??? optimal value?
if (Win32.FAILED(Win32.AVIFileCreateStreamW(pAviFile, out pAviRawAudioStream, ref audstream_header)))
{
CloseFile();
throw new InvalidOperationException("Failed opening raw audio stream. Not sure how this could happen");
}
outStatus = new OutputStatus();
IsOpen = true;
}