コード例 #1
0
        public void Start()
        {
            readyFrames_.Clear();
            workingThread_ = new Thread(() =>
            {
                for (; ;)
                {
                    if (frameQueue_.Count > 0)
                    {
                        FrameSet frame;
                        lock (frameQueue_)
                        {
                            frame = frameQueue_[0];
                            frameQueue_.RemoveAt(0);
                        }
                        Bitmap bmp = ImageUtil.BitmapUtil.ToStrip(frame.CameraImages, frame.CameraImages[0].Size);
                        lock (readyFrames_)
                            readyFrames_.Add(bmp);
                    }
                }
            });
            workingThread_.IsBackground = true;
            workingThread_.Start();
            Program.AddThread(workingThread_);
            writer_.Start();

            writingThread_ = new Thread(() =>
            {
                for (;;)
                {
                    if (readyFrames_.Count > 0)
                    {
                        Bitmap bmp = null;
                        lock (readyFrames_)
                        {
                            if (readyFrames_.Count > 0)
                            {
                                bmp = readyFrames_[0];
                                readyFrames_.RemoveAt(0);
                                if (writer_ != null)
                                {
                                    writer_.PushFrame(bmp);
                                }
                            }
                        }
                    }
                }
            });
            writingThread_.IsBackground = true;
            writingThread_.Start();
            Program.AddThread(writingThread_);

            foreach (Shared.IMocapRecorder rec in cameras_)
            {
                rec.StartRecording();
            }
        }