Ejemplo n.º 1
0
       /// <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();
            }
        }
Ejemplo n.º 2
0
        //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();
            }
        }