//private COMPVARS compvars = null; /// <summary> /// 初始化视频编解码器 /// </summary> /// <param name="bitmapInfoHeader">图像头信息</param> /// <param name="isEncode">标识完成编码还是解码功能</param> public VideoEncoder(BITMAPINFO bitmapInfo, bool isEncode) { //BITMAPINFO bitmapInfo = new BITMAPINFO(); //bitmapInfo.bmiHeader = bitmapInfoHeader; this.IsEncode = isEncode; if (isEncode) { COMPVARS compvars = new COMPVARS(); compvars.cbSize = Marshal.SizeOf(compvars); compvars.dwFlags = 1; compvars.fccHandler = FOURCC.MP42; compvars.fccType = FOURCC.ICTYPE_VIDEO; compvars.lDataRate = 780; // 780; compvars.lKey = 15; // 15; compvars.lQ = 500; // -1; //compvars.lQ = 500; this.Compressor = new ICCompressor(compvars, bitmapInfo, FOURCC.MP42); this.Compressor.Open();//打开编码器 } else { bitmapInfo.bmiHeader.biCompression = FOURCC.MP42; this.Decompressor = new ICDecompressor(new COMPVARS(), bitmapInfo, FOURCC.MP42); this.Decompressor.Open(); } }
/// <summary> /// 初始化视频编解码器 /// </summary> /// <param name="bitmapInfo">图像头信息</param> /// <param name="isEncode">标识完成编码还是解码功能</param> public VideoEncoder(BITMAPINFO bitmapInfo, bool isEncode) { this.IsEncode = isEncode; if (isEncode) { COMPVARS compvars = new COMPVARS(); compvars.cbSize = Marshal.SizeOf(compvars); compvars.dwFlags = 1; compvars.fccHandler = FOURCC.MP42; compvars.fccType = FOURCC.ICTYPE_VIDEO; compvars.lDataRate = 780;// 780; compvars.lKey = 15;// 15; compvars.lQ = 500;// -1; //compvars.lQ = 500; this.Compressor = new ICCompressor(compvars, bitmapInfo, FOURCC.MP42); this.Compressor.Open();//打开编码器 } else { bitmapInfo.bmiHeader.biCompression = FOURCC.MP42; this.Decompressor = new ICDecompressor(new COMPVARS(), bitmapInfo, FOURCC.MP42); this.Decompressor.Open(); } }
public static extern int ICSeqCompressFrame( COMPVARS pc, int uiFlags, byte[] lpBits, ref bool pfKey, ref long plSize );
public ICBase(COMPVARS cp,BITMAPINFO biIn,ICMODE mode,int fourcc) { this.pp=cp; this._in=biIn; this.mode=mode; this.fourcc=fourcc; _out=new BITMAPINFO(); }
public ICBase(COMPVARS cp, BITMAPINFO biIn, ICMODE mode, int fourcc) { this.pp = cp; this._in = biIn; this.mode = mode; this.fourcc = fourcc; _out = new BITMAPINFO(); }
public static extern bool ICCompressorChoose( IntPtr hwnd, int uiFlags, //ref BITMAPINFO pvIn, int pvIn, int lpData, COMPVARS pc, string lpszTitle );
//ICMODE_DECOMPRESS /// <summary> /// ��ʼ����Ƶ������ /// </summary> /// <param name="cp">ѹ������</param> /// <param name="biIn">ͼ����Ϣ</param> /// <param name="fourcc">��������</param> public ICDecompressor(COMPVARS cp,BITMAPINFO biIn,int fourcc) : base(cp,biIn,ICMODE.ICMODE_DECOMPRESS,fourcc) { }
public static extern bool ICSeqCompressFrameStart( COMPVARS pc, ref BITMAPINFO lpbiIn );
public static extern void ICSeqCompressFrameEnd(ref COMPVARS pc);
/// <summary> /// ³õʼ»¯ÊÓƵ½âÂëÆ÷ /// </summary> /// <param name="cp">ѹËõ¶ÔÏñ</param> /// <param name="biIn">ͼÏñÐÅÏ¢</param> /// <param name="fourcc">±àÂëÀàÐÍ</param> public ICDecompressor(COMPVARS cp, BITMAPINFO biIn, int fourcc) : base(cp, biIn, ICMODE.ICMODE_DECOMPRESS, fourcc) //ICMODE_DECOMPRESS { }
/// <summary> /// ³õʼ»¯ÊÓƵ±àÂëÆ÷ /// </summary> /// <param name="cp">ѹËõ¶ÔÏñ</param> /// <param name="biIn">ͼÏñÐÅÏ¢</param> /// <param name="fourcc">±àÂëÀàÐÍ</param> public ICCompressor(COMPVARS cp, BITMAPINFO biIn, int fourcc) : base(cp, biIn, ICMODE.ICMODE_COMPRESS, fourcc) { }