public void FrameIn(object sender, VsImageEventArgs e) { VsImage img = (VsImage)e.Image.Clone(); this.vsViewer.SizeMode = PictureBoxSizeMode.StretchImage; //if (vsAttachType == VsAttachType.ATTACH_ANALYZER) // this.vsViewer.Image = img.AnalyzedImage; //else this.vsViewer.Image = img.Image; //this.vsViewer.Image.Save("test.bmp"); // if the first frame -> alert to application and property control if (vsStatus == VsViewStatusType.VIEW_CONNECTING) { // connected flag vsStatus = VsViewStatusType.VIEW_CONNECTED; // alert to sigleview this.vsUpdateEvent(this, new VsMonitorEventArgs( new VsViewerParas(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_SIGLEVIEW, vsDeviceType, vsDeviceName, VsViewerType.VIEW_STATUS))); // alert to application control this.vsUpdateEvent(this, new VsMonitorEventArgs( new VsViewerParas(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_APPICATION, vsDeviceType, vsDeviceName, VsViewerType.VIEW_STATUS))); // alert to property control this.vsUpdateEvent(this, new VsMonitorEventArgs( new VsViewerParas(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_PROPERTY, vsDeviceType, vsDeviceName, VsViewerType.VIEW_STATUS))); } }
public void FrameIn(object sender, VsImageEventArgs e) { try { if (imgBuffer.Count > 1000 / syncTimer) { VsImage rm = (VsImage)imgBuffer.Dequeue(); rm.Dispose(); rm = null; logger.Log(LogLevel.Warn, DateTime.Now.ToString() + "; frame removed from Streamer"); } VsImage img = (VsImage)e.Image.Clone(); imgBuffer.Enqueue(img); } catch (Exception err) { logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace); } }
// On new frame ready //[MethodImpl(MethodImplOptions.Synchronized)] public void FrameIn(object sender, VsImageEventArgs e) { Thread.CurrentThread.Priority = ThreadPriority.Highest; try { if (imgBuffer.Count >= 1) { VsImage rm = (VsImage)imgBuffer.Dequeue(); rm.Dispose(); rm = null; } VsImage img = (VsImage)e.Image.Clone(); imgBuffer.Enqueue(img); } catch (Exception err) { logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace); ; } }
private void framedOut(object sender, VsImageEventArgs e) { //if (BQueue != null) //{ img = (VsImage)e.Image.Clone(); //Monitor.PulseAll(this); // BQueue.Enqueue(img); //} // bmp = img.Image; //MessageBox.Show("grameout"); //((MultimodeVideoSource)coreProvider).FrameOut -= new VsImageEventHandler(framedOut); // coreProvider.Stop(); }
// On new frame ready //[MethodImpl(MethodImplOptions.Synchronized)] // lock/unlock all thread from current instance object public void FrameIn(object sender, VsImageEventArgs e) { Thread.CurrentThread.Priority = ThreadPriority.Highest; try { if (imgBuffer.Count >= bufCount) { VsImage rm = (VsImage)imgBuffer.Dequeue(); rm.Dispose(); rm = null; logger.Log(LogLevel.Warn, DateTime.Now.ToString() + "; frame removed from Encoder"); } VsImage img = (VsImage)e.Image.Clone(); imgBuffer.Enqueue(img); } catch (Exception err) { logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace); } }