/// <summary> /// 捕捉到视频数据事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoDataCapturered(object sender, VideoCapturedEventArgs e) { if (VE != null) { frameTransmit.sendData(IMLibrary3.Protocol.TransmitType.Video, VE.Encode(e.Data));//将视频数据编码后发送给对方 } }
/// <summary> /// 视频捕捉前事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoCapturerBefore(object sender, VideoCapturedEventArgs e) { Console.WriteLine("bmiColors:" + e.BITMAPINFO.bmiColors.ToString()); Console.WriteLine("biSize:" + e.BITMAPINFO.bmiHeader.biSize.ToString() + " biSizeImage:" + e.BITMAPINFO.bmiHeader.biSizeImage.ToString() + " biBitCount:" + e.BITMAPINFO.bmiHeader.biBitCount.ToString() + " biWidth:" + e.BITMAPINFO.bmiHeader.biWidth.ToString() + " biHeight:" + e.BITMAPINFO.bmiHeader.biHeight.ToString() + " biClrUsed:" + e.BITMAPINFO.bmiHeader.biClrUsed.ToString() + " biClrImportant:" + e.BITMAPINFO.bmiHeader.biClrImportant.ToString() + " biXPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biXPelsPerMeter.ToString() + " biYPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biYPelsPerMeter.ToString() + " biPlanes:" + e.BITMAPINFO.bmiHeader.biPlanes.ToString() + " biCompression:" + e.BITMAPINFO.bmiHeader.biCompression.ToString()); if (VE == null) { VE = new VideoEncoder(e.BITMAPINFO, true); //根据摄像头采集数据的格式,创建新的视频编码器 } if (VR == null) { VR = new VideoRender(this.cRemote); VR.IniVideoRender(e.BITMAPINFO.bmiHeader); } if (VD == null) { VD = new VideoEncoder(e.BITMAPINFO, false); //初始化解码器 } //防止丢包,发送三次本地视频图像头信息给对方,以便对方解码器正确解码 // AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 // System.Threading.Thread.Sleep(300); // AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 // System.Threading.Thread.Sleep(300); // AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 }
/// <summary> /// 捕捉到视频数据事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoDataCapturered(object sender, VideoCapturedEventArgs e) { if (VE != null) { Console.WriteLine(e.Data.Length.ToString() + ":" + VE.Encode(e.Data).Length.ToString()); //this.AVcommunication1.SendVideo(VE.Encode(e.Data));//将视频数据编码后发送给对方 //byte[] data=new byte[e.Data.Length]; //Array.Copy(e.Data, data, data.Length); VR.DrawVideo(e.Data); } }
/// <summary> /// 视频捕捉前事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoCapturerBefore(object sender, VideoCapturedEventArgs e) { //Console.WriteLine("biSize:" + e.BITMAPINFO.bmiHeader.biSize.ToString() + " biSizeImage:" + e.BITMAPINFO.bmiHeader.biSizeImage.ToString() // + " biBitCount:" + e.BITMAPINFO.bmiHeader.biBitCount.ToString() + " biWidth:" + e.BITMAPINFO.bmiHeader.biWidth.ToString() // + " biHeight:" + e.BITMAPINFO.bmiHeader.biHeight.ToString() // + " biClrUsed:" + e.BITMAPINFO.bmiHeader.biClrUsed.ToString() + " biClrImportant:" + e.BITMAPINFO.bmiHeader.biClrImportant.ToString() // + " biXPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biXPelsPerMeter.ToString() + " biYPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biYPelsPerMeter.ToString() // + " biPlanes:" + e.BITMAPINFO.bmiHeader.biPlanes.ToString() + " biCompression:" + e.BITMAPINFO.bmiHeader.biCompression.ToString()); if (VideoCapturerBefore != null) { VideoCapturerBefore(this, e.BITMAPINFO); } if (VE == null) { VE = new VideoEncoder(e.BITMAPINFO, true);//根据摄像头采集数据的格式,创建新的视频编码器 } }
/// <summary> /// 视频捕捉前事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoCapturerBefore(object sender, VideoCapturedEventArgs e) { Console.WriteLine("bmiColors:" + e.BITMAPINFO.bmiColors.ToString()); Console.WriteLine("biSize:" + e.BITMAPINFO.bmiHeader.biSize.ToString() + " biSizeImage:" + e.BITMAPINFO.bmiHeader.biSizeImage.ToString() + " biBitCount:" + e.BITMAPINFO.bmiHeader.biBitCount.ToString() + " biWidth:" + e.BITMAPINFO.bmiHeader.biWidth.ToString() + " biHeight:" + e.BITMAPINFO.bmiHeader.biHeight.ToString() + " biClrUsed:" + e.BITMAPINFO.bmiHeader.biClrUsed.ToString() + " biClrImportant:" + e.BITMAPINFO.bmiHeader.biClrImportant.ToString() + " biXPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biXPelsPerMeter.ToString() + " biYPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biYPelsPerMeter.ToString() + " biPlanes:" + e.BITMAPINFO.bmiHeader.biPlanes.ToString() + " biCompression:" + e.BITMAPINFO.bmiHeader.biCompression.ToString()); if (VE == null) VE = new VideoEncoder(e.BITMAPINFO , true);//根据摄像头采集数据的格式,创建新的视频编码器 if (VR == null) { VR = new VideoRender(this.cRemote); VR.IniVideoRender(e.BITMAPINFO.bmiHeader); } if (VD == null) { VD = new VideoEncoder(e.BITMAPINFO , false);//初始化解码器 } //防止丢包,发送三次本地视频图像头信息给对方,以便对方解码器正确解码 // AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 // System.Threading.Thread.Sleep(300); // AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 // System.Threading.Thread.Sleep(300); // AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 }
/// <summary> /// 捕捉到视频数据事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoDataCapturered(object sender, VideoCapturedEventArgs e) { if (VE != null) { this.AVcommunication1.SendVideo(VE.Encode(e.Data));//将视频数据编码后发送给对方 } }
/// <summary> /// 视频捕捉前事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoCapturerBefore(object sender, VideoCapturedEventArgs e) { if (VE == null) VE = new VideoEncoder(e.BITMAPINFO.bmiHeader, true);//根据摄像头采集数据的格式,创建新的视频编码器 //防止丢包,发送三次本地视频图像头信息给对方,以便对方解码器正确解码 AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 System.Threading.Thread.Sleep(300); AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 System.Threading.Thread.Sleep(300); AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码 }
/// <summary> /// 捕捉到视频数据事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoDataCapturered(object sender, VideoCapturedEventArgs e) { if (VE != null) frameTransmit.sendData(IMLibrary3.Protocol.TransmitType.Video, VE.Encode(e.Data));//将视频数据编码后发送给对方 }
/// <summary> /// 视频捕捉前事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void VC_VideoCapturerBefore(object sender, VideoCapturedEventArgs e) { //Console.WriteLine("biSize:" + e.BITMAPINFO.bmiHeader.biSize.ToString() + " biSizeImage:" + e.BITMAPINFO.bmiHeader.biSizeImage.ToString() // + " biBitCount:" + e.BITMAPINFO.bmiHeader.biBitCount.ToString() + " biWidth:" + e.BITMAPINFO.bmiHeader.biWidth.ToString() // + " biHeight:" + e.BITMAPINFO.bmiHeader.biHeight.ToString() // + " biClrUsed:" + e.BITMAPINFO.bmiHeader.biClrUsed.ToString() + " biClrImportant:" + e.BITMAPINFO.bmiHeader.biClrImportant.ToString() // + " biXPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biXPelsPerMeter.ToString() + " biYPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biYPelsPerMeter.ToString() // + " biPlanes:" + e.BITMAPINFO.bmiHeader.biPlanes.ToString() + " biCompression:" + e.BITMAPINFO.bmiHeader.biCompression.ToString()); if (VideoCapturerBefore != null) VideoCapturerBefore(this, e.BITMAPINFO); if (VE == null) VE = new VideoEncoder(e.BITMAPINFO, true);//根据摄像头采集数据的格式,创建新的视频编码器 }