Ejemplo n.º 1
0
        public bool Init()
        {
            _WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            int num = 0;

            foreach (FilterInfo info in _WebcamDevices)
            {
                SWebcamDevice device = new SWebcamDevice {
                    ID            = num,
                    Name          = info.Name,
                    MonikerString = info.MonikerString,
                    Capabilities  = new List <SCapabilities>()
                };
                num++;
                VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString);

                for (int i = 0; i < tmpdev.VideoCapabilities.Length; i++)
                {
                    SCapabilities item = new SCapabilities
                    {
                        Framerate = tmpdev.VideoCapabilities[i].FrameRate,
                        Height    = tmpdev.VideoCapabilities[i].FrameSize.Height,
                        Width     = tmpdev.VideoCapabilities[i].FrameSize.Width
                    };
                    device.Capabilities.Add(item);
                }
                _Devices.Add(device);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public bool Init()
        {
            _WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            int num = 0;
            foreach (FilterInfo info in _WebcamDevices)
            {
                SWebcamDevice device = new SWebcamDevice {
                    ID = num,
                    Name = info.Name,
                    MonikerString = info.MonikerString,
                    Capabilities = new List<SCapabilities>()
                };
                num++;
                VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString);

                for (int i = 0; i < tmpdev.VideoCapabilities.Length; i++ )
                {
                    SCapabilities item = new SCapabilities
                    {
                        Framerate = tmpdev.VideoCapabilities[i].FrameRate,
                        Height = tmpdev.VideoCapabilities[i].FrameSize.Height,
                        Width = tmpdev.VideoCapabilities[i].FrameSize.Width
                    };
                    device.Capabilities.Add(item);
                }
                _Devices.Add(device);
            }
            return true;
        }
Ejemplo n.º 3
0
        public bool Init()
        {
            FilterInfoCollection webcams = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            foreach (FilterInfo info in webcams)
            {
                var tmpdev = new VideoCaptureDevice(info.MonikerString);
                if (tmpdev.VideoCapabilities.Length == 0)
                {
                    continue;
                }
                var device = new SWebcamDevice
                {
                    Name          = info.Name,
                    MonikerString = info.MonikerString,
                    Capabilities  = new List <SCapabilities>(tmpdev.VideoCapabilities.Length)
                };

                foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities)
                {
                    var item = new SCapabilities
                    {
                        Framerate = capabilities.AverageFrameRate,
                        Height    = capabilities.FrameSize.Height,
                        Width     = capabilities.FrameSize.Width
                    };
                    device.Capabilities.Add(item);
                }
                _Devices.Add(device);
            }
            return(true);
        }