UsersOpt.cs 介紹:
readyLogin() 入口
private void DataArrival(byte[] Data, System.Net.IPAddress Ip, int Port) 這是收到消息的處理函數,裏面有個一個大的switch
ServiceMain.cs
FormAccess.cs
newSendMsgForm() 產生新用戶發送消息窗口 (其中有打洞代碼)
if (user.State != 0 && !user.isWANConnected)//如果用戶在線且與對方未連接,則向服務器請求獲得對方IP與端口,並請求服務器通知對方UDP打洞
FormAccess.GetUserIPRequest(BitConverter.GetBytes(user.Index));
MyAV.cs 包含一個AV.cs
Connect() 連接到對方並且開始發送AV數據
AV.cs
IniVideoRender(){
IMLibrary.AV.BITMAPINFOHEADER bmi = new IMLibrary.AV.BITMAPINFOHEADER();
bmi.biCompression = 0;
bmi.biWidth = 160;
bmi.biHeight = 120;
bmi.biPlanes = 1;
bmi.biBitCount = 0x18;
bmi.biXPelsPerMeter = 0;
bmi.biYPelsPerMeter = 0;
bmi.biClrUsed = 0;
bmi.biClrImportant = 0;
bmi.biSizeImage = 0xE100;//0x9600;
bmi.biSize = Marshal.SizeOf(bmi);
}
WaveOut.cs 包裝 winmm.dll
WaveIn.cs 包裝 winmm.dll
DrawDib.cs 包裝了Render
1. this.SrcRect = this.DstRect = new Rectangle(0, 0, 80, 60);
2. BITMAPINFOHEADER 外面可以直接賦值。
用DrawDibDraw()把BMP圖像繪製到屏幕上。
IniVideoCapture()
VideoCapturer.cs 包裝 AVICAP32.dll
VideoCapturer() 構造函數
this.m_hwnd = capCreateCaptureWindow("", WS_VISIBLE | WS_CHILD, 0, 0, control.Width, control.Height, control.Handle, 0);
if (this.m_hwnd == IntPtr.Zero)
{
throw new AVException();
}
this.m_parms = new IMLibrary.AV.CaptureParms();
this.m_streamCallBack = new capVideoStreamCallback(this.streamCallBack);
this.m_errorCallBack = new IMLibrary.AV.capErrorCallback(this.capErrorCallback);