Exemplo n.º 1
0
        internal WebcamProperty GetProcAmpProperties(VideoProcAmpProperty property)
        {
            HResult result = HResult.ERROR_NOT_READY;

            WebcamProperty settings = new WebcamProperty
            {
                _name        = property.ToString(),
                _procAmpProp = property,
                _isProcAmp   = true
            };

            if (_base._webcamMode)
            {
                IAMVideoProcAmp control = _base.mf_MediaSource as IAMVideoProcAmp;
                result = control.GetRange(property, out settings._min, out settings._max, out settings._step, out settings._default, out VideoProcAmpFlags flags);

                if (result == Player.NO_ERROR)
                {
                    settings._supported   = (flags & VideoProcAmpFlags.Manual) != 0;
                    settings._autoSupport = (flags & VideoProcAmpFlags.Auto) != 0;

                    control.Get(property, out settings._value, out flags);
                    settings._auto = (flags & VideoProcAmpFlags.Auto) != 0;
                }
            }
            _base._lastError = result;
            return(settings);
        }
Exemplo n.º 2
0
        public VideoSetting(IAMVideoProcAmp filter, VideoProcAmpProperty property)
        {
            _CamFilter   = filter;
            _CamProperty = property;
            _Name        = property.ToString();

            // Update all defaults min max, etc...
            Read();
        }
Exemplo n.º 3
0
        private static CameraProperty ReadProperty(VideoCaptureDevice device, VideoProcAmpProperty property)
        {
            CameraProperty p = new CameraProperty();

            p.Identifier     = property.ToString();
            p.Specific       = "VideoProcAmp";
            p.ReadOnly       = false;
            p.Type           = CameraPropertyType.Integer;
            p.Representation = CameraPropertyRepresentation.LinearSlider;
            p.CanBeAutomatic = true;

            try
            {
                int min;
                int max;
                int step;
                int defaultValue;
                VideoProcAmpFlags flags;
                bool success = device.GetVideoPropertyRange(property, out min, out max, out step, out defaultValue, out flags);

                if (!success)
                {
                    p.Supported = false;
                }
                else
                {
                    p.Supported = true;
                    p.Minimum   = min.ToString(CultureInfo.InvariantCulture);
                    p.Maximum   = max.ToString(CultureInfo.InvariantCulture);

                    int currentValue;
                    success = device.GetVideoProperty(property, out currentValue, out flags);

                    if (!success)
                    {
                        p.Supported = false;
                    }
                    else
                    {
                        p.CurrentValue = currentValue.ToString(CultureInfo.InvariantCulture);
                        p.Automatic    = flags == VideoProcAmpFlags.Auto;
                    }
                }
            }
            catch
            {
                p.Supported = false;
            }

            return(p);
        }