コード例 #1
0
 public void CloseCamera()
 {
     try
     {
         CMyVideo.Close();
     }
     catch
     {
     }
 }
コード例 #2
0
 public void Camera_Resize(object sender, EventArgs e)
 {
     try
     {
         CMyVideo.SetVideoDlgRect(0, 0, this.Width, this.Height);
         CMyVideo.MoveVideoDlg();
     }
     catch
     {
     }
 }
コード例 #3
0
 public bool CaptureImage(string path)
 {
     try
     {
         CMyVideo.WCaptureImage(channel, path);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #4
0
 public void StopVideoCapture()
 {
     try
     {
         CMyVideo.WStopVideoCapture(channel);
         outfile.Close();
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("视频文件关闭失败!");
     }
 }
コード例 #5
0
 public void StartVideoCapture(string filename)
 {
     try
     {
         CMyVideo.WStartVideoCapture(channel, "tmp.mp4");
         outfile = File.Open(filename, FileMode.Create, FileAccess.Write);
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("视频捕捉失败!");
     }
 }
コード例 #6
0
 private void Camera_Load(object sender, EventArgs e)
 {
     try
     {
         int a = CMyVideo.CreateVideoDlg(this.Handle, 0, 0, 800, 600);//this.Width, this.Height);
         CMyVideo.SetVideoDlgRect(0, 0, this.Width, this.Height);
         CMyVideo.MoveVideoDlg();
         CMyVideo.SelectChannel(channel);
         CMyVideo.WRegisterMessageNotifyHandle(this.Handle, USER);
         databuf = new byte[0x30000];
     }
     catch
     {
     }
 }
コード例 #7
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == USER)
     {
         datalength = 0x30000;
         unsafe
         {
             int reval = CMyVideo.WReadStreamData(0, databuf, ref datalength, ref FrameType);
             if (reval >= 0)
             {
                 if ((FrameType == (short)FrameType_t.PktSysHeader) || (FrameType == (short)FrameType_t.PktIFrames) || (FrameType == (short)FrameType_t.PktPFrames))
                 {
                     byte[] tmpchar = new byte[datalength];
                     Buffer.BlockCopy(databuf, 0, tmpchar, 0, datalength);
                     outfile.Write(tmpchar, 0, tmpchar.Length);
                 }
             }
         }
     }
     base.WndProc(ref m);
 }