コード例 #1
0
 int ISampleGrabberCB.BufferCB(double time, IntPtr pBuffer, int len)
 {
     if (this.m_bGrabFrame)
     {
         if (len <= this.m_Stride * this.m_Height)
         {
             CaptureGraph.CopyMemory(this.m_Buffer, pBuffer, len);
         }
         this.m_bGrabFrame = false;
         this.m_Evt.Set();
     }
     else
     {
         ++this.m_DroppedFrame;
     }
     return(0);
 }
コード例 #2
0
 public Camera(
     int unit,
     int width,
     int height,
     int framerate,
     int quality,
     SupportedColorFormat color)
 {
     this.m_bStop     = true;
     this.m_Unit      = unit;
     this.m_Width     = width;
     this.m_Height    = height;
     this.m_Framerate = framerate;
     this.m_Quality   = quality;
     this.m_color     = color;
     this.VidCapture  = new CaptureGraph(this.m_Unit, this.m_Width, this.m_Height, this.m_Framerate, this.m_color);
 }
コード例 #3
0
 public void StopCamera()
 {
     if (this.previewThread != null)
     {
         this.m_bStop = true;
         this.previewThread.Join();
         if (this.VidCapture != null)
         {
             this.VidCapture.Dispose();
             this.VidCapture = (CaptureGraph)null;
         }
         if (Camera.s_sendFrame != null)
         {
             Camera.s_sendFrame = (Camera.getFrameCB)null;
         }
     }
     this.previewThread = (Thread)null;
 }
コード例 #4
0
 protected void Run()
 {
     this.m_bStop = false;
     try
     {
         this.VidCapture.Run();
         do
         {
             try
             {
                 this.pFrame = IntPtr.Zero;
                 this.pFrame = this.VidCapture.getSignleFrame();
                 if (Camera.s_sendFrame != null && this.pFrame != IntPtr.Zero)
                 {
                     Camera.s_sendFrame(this.pFrame, this.VidCapture.Width, this.VidCapture.Height, this.VidCapture.Stride);
                 }
                 if (!this.m_bStop)
                 {
                     continue;
                 }
             }
             catch (Exception ex)
             {
                 Logger.Error("Exception in send frame callback. Err : {0}", (object)ex.ToString());
                 throw;
             }
             this.VidCapture.Pause();
         }while (!this.m_bStop);
     }
     catch (Exception ex)
     {
         Logger.Error("Exception in Graph Run. Err : {0}", (object)ex.ToString());
     }
     finally
     {
         if (this.VidCapture != null)
         {
             this.VidCapture.Dispose();
             this.VidCapture = (CaptureGraph)null;
         }
     }
 }