Example #1
0
        /// <summary>
        /// The on video capture device property changed.
        /// </summary>
        /// <param name="obj">
        /// The obj.
        /// </param>
        /// <param name="args">
        /// The args.
        /// </param>
        private static void OnVideoCaptureDevicePropertyChanged(
            DependencyObject obj,
            DependencyPropertyChangedEventArgs args)
        {
            if (args.NewValue as DsDevice == null)
            {
                return;
            }

            //if (Video.Instance.VideoMode != VideoMode.Capture)
            //{
            //  return;
            //}

            var videoCapturer = obj as VideoCapturer;

            if (videoCapturer != null)
            {
                var device = args.NewValue as DsDevice;
                if (videoCapturer.VideoDeviceFilter != null)
                {
                    Marshal.ReleaseComObject(videoCapturer.VideoDeviceFilter);
                }

                videoCapturer.VideoDeviceFilter = DShowUtils.CreateFilter(FilterCategory.VideoInputDevice, device.Name);
                if (Video.Instance.VideoMode == VideoMode.Capture)
                {
                    videoCapturer.NewCamera(0, 0, 0);
                }
            }
        }
Example #2
0
        /// <summary>
        ///   The set video mode.
        /// </summary>
        /// <param name="newVideoMode">
        ///   The new video mode.
        /// </param>
        private void SetVideoMode(VideoMode newVideoMode)
        {
            if (this.videoMode == newVideoMode)
            {
                return;
            }

            this.videoElement.VideoFrameChanged -= this.VideoElementVideoFrameChanged;
            this.videoMode = newVideoMode;

            switch (this.videoMode)
            {
            case VideoMode.File:
            case VideoMode.None:
                this.videoCaptureElement.Dispose();
                this.videoElement = this.videoPlayerElement;
                break;

            case VideoMode.Capture:
                if (DShowUtils.GetVideoInputDevices().Any())
                {
                    this.videoElement = this.videoCaptureElement;
                    this.videoCaptureElement.NewCamera(0, 0, 0);
                    StatusBarContent.Instance.VideoFilename = "Live Video";
                }

                break;
            }

            this.videoElement.VideoFrameChanged += this.VideoElementVideoFrameChanged;
            //this.videoElement.ImageSource = this.videoElement.ImageSource;
            //this.ProcessedVideoSource = this.videoElement.ColorProcessedVideoSource;
        }
Example #3
0
 /// <summary>
 ///   The show property page of video device.
 /// </summary>
 public void ShowPropertyPageOfVideoDevice()
 {
     if (this.VideoDeviceFilter != null)
     {
         DShowUtils.DisplayPropertyPage(IntPtr.Zero, this.VideoDeviceFilter);
     }
 }
Example #4
0
 /// <summary>
 ///   The show video compressor options dialog.
 /// </summary>
 public void ShowVideoCompressorOptionsDialog()
 {
     if (this.videoCompressorFilter != null)
     {
         DShowUtils.DisplayPropertyPage(IntPtr.Zero, this.videoCompressorFilter);
     }
 }