public bool Stop(RecordingStateType type) { try { if (this.IsRecording(type) == false) { return(false); } lock (this._videoRecordTable[type]) { this._videoRecordTable[type].Release(); this._recordedFrameCountTable[type] = 0; if (this.OnStop != null) { this.OnStop.Invoke(type); } } return(true); } catch (Exception) { return(false); } }
public void Write(RecordingStateType type, Mat frame) { try { if (this.IsRecording(type) == false) { return; } lock (this._videoRecordTable[type]) { this._videoRecordTable[type].Write(frame.Resize(this._videoRecordTable[type].FrameSize)); this._recordedFrameCountTable[type]++; if (this.OnRecorded != null) { this.OnRecorded.Invoke(type, frame, this._recordedFrameCountTable[type]); } var seconds = this._recordedFrameCountTable[type] / (int)this._videoRecordTable[type].Fps; var mod = this._recordedFrameCountTable[type] % (int)this._videoRecordTable[type].Fps; if (this.OnIncreasedTime != null && mod == 0) { this.OnIncreasedTime.Invoke(type, this._recordedFrameCountTable[type], seconds); } } } catch (Exception) { } }
public bool Record(RecordingStateType type, string path, Size size, int fps) { try { if (this.IsRecording(type)) { return(false); } if (this.IsCollisionPath(path)) { return(false); } lock (this._videoRecordTable[type]) { this._videoRecordTable[type].Open(path, FourCC.XVID, fps, size); } var success = this._videoRecordTable[type].IsOpened(); if (success && this.OnStart != null) { this.OnStart.Invoke(type); } return(success); } catch (Exception) { return(false); } }
public bool IsRecording(RecordingStateType type) { try { return(this._videoRecordTable[type].IsOpened()); } catch (Exception) { return(false); } }
public Size GetRecordSize(RecordingStateType type) { try { if (this.IsRecording(type) == false) { throw new Exception(); } return(this._videoRecordTable[type].FrameSize); } catch (Exception) { return(Size.Zero); } }