/// <summary> /// Остановить процедуру сохранения /// </summary> public void Stop() { bool blocked = false; try { if (mutex.WaitOne(1000)) { blocked = true; state = SaverState.Stopped; timer.Change(Timeout.Infinite, timeToBuffer); if (callBackMutex.WaitOne(3000)) { measuring = null; callBackMutex.ReleaseMutex(); } state = SaverState.Stopped; } } finally { if (blocked) { mutex.ReleaseMutex(); } } }
/// <summary> /// Запустить процедуру сохранения /// </summary> public void Start() { bool blocked = false; try { if (mutex.WaitOne(1000)) { blocked = true; state = SaverState.Started; measuring = t_measuring.Virtualize(adapter); timer.Change(0, timeToBuffer); state = SaverState.Started; } } finally { if (blocked) { mutex.ReleaseMutex(); } } }
public void BeginSave(int fpsWanted, string fileName) { this.Dispose(); videoWriter = CvInvoke.cvCreateVideoWriter(fileName, CvInvoke.CV_FOURCC('P', 'I', 'M', '1'), fpsWanted, Recorder.ScreenSize, true); this.saverState = SaverState.Running; this.saveThread.Start(); }
public void EndSave() { this.saverState = SaverState.Stopped; while (saveThread.ThreadState != ThreadState.Stopped) { Thread.Sleep(10); } CvInvoke.cvReleaseVideoWriter(ref this.videoWriter); this.videoWriter = IntPtr.Zero; }
public ScreenSaver(FrameBuffer buffer) { saveThread = new Thread(new ThreadStart(saveMethod)); this.Frames = buffer; this.saverState = SaverState.Stopped; }
/// <summary> /// Остановить процедуру сохранения /// </summary> public void Stop() { bool blocked = false; try { if (mutex.WaitOne(1000)) { blocked = true; state = SaverState.Stopped; timer.Change(Timeout.Infinite, timeToBuffer); if (callBackMutex.WaitOne(3000)) { measuring = null; callBackMutex.ReleaseMutex(); } state = SaverState.Stopped; } } finally { if (blocked) mutex.ReleaseMutex(); } }
/// <summary> /// Запустить процедуру сохранения /// </summary> public void Start() { bool blocked = false; try { if (mutex.WaitOne(1000)) { blocked = true; state = SaverState.Started; measuring = t_measuring.Virtualize(adapter); timer.Change(0, timeToBuffer); state = SaverState.Started; } } finally { if (blocked) mutex.ReleaseMutex(); } }