Example #1
0
        /// <summary>
        /// Default constructor of the Capture class.
        /// </summary>
        /// <param name="VideoDevice">The video device to be the source.</param>
        /// <exception cref="ArgumentException">If no video device is provided.</exception>
        public CaptureWebcam(Filter VideoDevice, Action OnClick)
        {
            _form = new DummyForm();
            _form.Show();

            _form.Click += (S, E) => OnClick?.Invoke();

            this.VideoDevice = VideoDevice ?? throw new ArgumentException("The videoDevice parameter must be set to a valid Filter.\n");

            CreateGraph();
        }
        public CaptureWebcam(Filter VideoDevice, Action OnClick, IntPtr PreviewWindow)
        {
            _videoDevice = VideoDevice ?? throw new ArgumentException("The videoDevice parameter must be set to a valid Filter.\n");

            _form = new DummyForm();
            _form.Show();

            _form.Click += (S, E) => OnClick?.Invoke();

            _previewWindow = PreviewWindow != IntPtr.Zero ? PreviewWindow : _form.Handle;

            CreateGraph();
        }