Beispiel #1
0
        private void btnRecord_Click(object sender, EventArgs e)
        {
            if (recording_)
            {
                btnRecord.Text = "Record";
                recording_     = false;
                recordingTimer_.Stop();
                watch_.Stop();
                StopRecording();
            }
            else
            {
                if (GlobalData.GetInst().Cameras.Count == 0)
                {
                    ErrorHandler.GetInst().PushError(new Exception("Cameras are required in order to start recording"));
                    return;
                }

                foreach (IMocapRecorder rec in GlobalData.GetInst().Cameras)
                {
                    if (rec.Calibration == null || !rec.Calibration.Valid())
                    {
                        //ErrorHandler.GetInst().PushError(new Exception("Cannot record: " + rec.Name + ", requires calibration"));
                        //return;
                    }
                }

                recorder_ = new ThreadedRecorder(GlobalData.GetInst().Cameras, new AVIVideoWriter {
                    FileName = "Test.avi", OutputSize = new Size(640 * 2, 480)
                });
                btnRecord.Text = "Stop";
                recording_     = true;
                recordingTimer_.Start();
                watch_.Start();

                foreach (IMocapRecorder rec in GlobalData.GetInst().Cameras)
                {
                    AForge.Controls.VideoSourcePlayer player = new AForge.Controls.VideoSourcePlayer();
                    player.Width       = 320;
                    player.Height      = 240;
                    player.VideoSource = rec.GetSource();
                    videoFlow.Controls.Add(player);
                }
                recorder_.Start();
            }
        }
        private void btnRecord_Click(object sender, EventArgs e)
        {
            if (recording_)
            {
                btnRecord.Text = "Record";
                recording_ = false;
                recordingTimer_.Stop();
                watch_.Stop();
                StopRecording();
            }
            else
            {
                if (GlobalData.GetInst().Cameras.Count == 0)
                {
                    ErrorHandler.GetInst().PushError(new Exception("Cameras are required in order to start recording"));
                    return;
                }

                foreach (IMocapRecorder rec in GlobalData.GetInst().Cameras)
                {
                    if (rec.Calibration == null || !rec.Calibration.Valid())
                    {
                        //ErrorHandler.GetInst().PushError(new Exception("Cannot record: " + rec.Name + ", requires calibration"));
                        //return;
                    }
                }

                recorder_ = new ThreadedRecorder(GlobalData.GetInst().Cameras, new AVIVideoWriter { FileName="Test.avi", OutputSize = new Size(640*2,480) } );
                btnRecord.Text = "Stop";
                recording_ = true;
                recordingTimer_.Start();
                watch_.Start();

                foreach (IMocapRecorder rec in GlobalData.GetInst().Cameras)
                {
                    AForge.Controls.VideoSourcePlayer player = new AForge.Controls.VideoSourcePlayer();
                    player.Width = 320;
                    player.Height = 240;
                    player.VideoSource = rec.GetSource();
                    videoFlow.Controls.Add(player);
                }
                recorder_.Start();
            }
        }