public CaptureGraph( int unit, int width, int height, int framerate, SupportedColorFormat color) { this.m_Unit = unit; this.m_Width = width; this.m_Height = height; this.m_FrameRate = framerate; this.m_DroppedFrame = 0; this.m_color = color; this.m_Evt = new ManualResetEvent(false); this.m_bGraphRunning = false; Logger.Info("Building graph"); try { this.BuildGraph(); } catch (Exception ex) { Logger.Error("Exception in build graph. Err : {0}", (object)ex.ToString()); this.Dispose(); throw; } }
public void camStart(int unit, int w, int h, int f) { if (this.camera != null || this.keyEnableCam != 1 || !this.cameraStoped) { return; } if (w > 0) { this.width = w; } if (h > 0) { this.height = h; } if (f > 0) { this.framerate = f; } Logger.Info("Starting Camera {0}. Frame width: {1}, height: {2}, framerate: {3}", (object)unit, (object)this.width, (object)this.height, (object)this.framerate); this.cameraStoped = false; this.cb = new Camera.getFrameCB(this.getFrame); for (int index = 0; index < 2; ++index) { if (this.camera == null) { try { this.m_color = (SupportedColorFormat)index; this.camera = new Camera(unit, this.width, this.height, this.framerate, this.jpegQuality, this.m_color); } catch (ColorFormatNotSupported ex) { Logger.Info("Trying with other color." + ex.ToString()); } catch (Exception ex) { Logger.Error("Exception in to initialize the camera. Err : ", (object)ex.ToString()); } } else { break; } } if (this.camera == null) { Logger.Error("Cannot start the host camera."); } else { this.camera.registerFrameCB(this.cb); this.camera.StartCamera(); } }
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); }