/// <summary>
        /// Stops a capture.
        /// </summary>
        /// <exception cref="InvalidOperationException">The control is not capturing a video stream.</exception>
        /// <exception cref="DirectShowException">Failed to stop a video capture graph.</exception>
        public void StopCapture()
        {
            if (!IsCapturing)
            {
                throw new InvalidOperationException();
            }

            Proxy.Stop();
            IsCapturing = false;

            Proxy.ResetCaptureGraph();
            _currentCamera = null;
        }
        /// <summary>
        /// Starts a capture.
        /// </summary>
        /// <param name="camera">The camera to capture from.</param>
        /// <exception cref="ArgumentNullException">A null reference is passed as an argument.</exception>
        /// <exception cref="Win32Exception">Failed to load the DirectShow utilities dll.</exception>
        /// <exception cref="DirectShowException">Failed to run a video capture graph.</exception>
        public void StartCapture(WebCameraId camera)
        {
            if (camera == null)
            {
                throw new ArgumentNullException();
            }

            if (!_captureGraphInitialized)
            {
                InitializeCaptureGraph();

                _captureGraphInitialized = true;
            }

            if (IsCapturing)
            {
                if (_currentCamera == camera)
                {
                    return;
                }

                StopCapture();
            }

            if (_currentCamera != null)
            {
                Proxy.ResetCaptureGraph();
                _currentCamera = null;
            }

            Proxy.AddCaptureFilter(camera.DevicePath);
            _currentCamera = camera;

            try
            {
                Proxy.Start();
                IsCapturing = true;
            }
            catch (DirectShowException)
            {
                Proxy.ResetCaptureGraph();
                _currentCamera = null;
                throw;
            }
        }