Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void Process(ImageContext context)
        {
            // guard against partial frame data at startup
            if (_waitForFullFrame)
            {
                _waitForFullFrame = !context.Eos;
                if (_waitForFullFrame)
                {
                    return;
                }
            }

            if (_detectingMotion)
            {
                _driver.Apply(context);
            }

            // accumulate frame data in the underlying memory stream
            base.Process(context);

            if (context.Eos)
            {
                // write a full frame if a request is pending
                if (_writeFrameRequested)
                {
                    this.WriteStreamToFile();
                    _writeFrameRequested = false;
                }

                // reset the stream to begin the next frame
                this.CurrentStream.SetLength(0);
            }
        }