コード例 #1
0
        private void SetPostConnectionOptions()
        {
            // Some options only work after the graph is actually connected.
            // For example logitech exposure. Probably due to a bug in Logitech firmware.
            SpecificInfo info = summary.Specific as SpecificInfo;

            // Only do this for Logitech devices.
            if (!summary.Identifier.Contains("usb#vid_046d") || info == null)
            {
                return;
            }

            if (info.CameraProperties.ContainsKey("exposure_logitech"))
            {
                if (info.CameraProperties["exposure_logitech"].Automatic)
                {
                    return;
                }

                int exposure = int.Parse(info.CameraProperties["exposure_logitech"].CurrentValue, CultureInfo.InvariantCulture);
                device.Logitech_SetExposure(exposure, true);
            }
            else if (info.CameraProperties.ContainsKey("exposure"))
            {
                if (info.CameraProperties["exposure"].Automatic)
                {
                    return;
                }

                int exposure = int.Parse(info.CameraProperties["exposure"].CurrentValue, CultureInfo.InvariantCulture);
                device.SetCameraProperty(CameraControlProperty.Exposure, exposure, CameraControlFlags.Manual);
            }
        }
コード例 #2
0
        private static void WriteLogitechProperty(VideoCaptureDevice device, CameraProperty value)
        {
            if (!value.Supported)
            {
                return;
            }

            try
            {
                int  v;
                bool parsed = int.TryParse(value.CurrentValue, NumberStyles.Any, CultureInfo.InvariantCulture, out v);
                if (parsed)
                {
                    device.Logitech_SetExposure(v, !value.Automatic);
                }
                else
                {
                    log.ErrorFormat("Could not parse property {0}, value: {1}.", value.Identifier, value.CurrentValue);
                }
            }
            catch (Exception e)
            {
                log.ErrorFormat("Could not write property {0}. {1}.", value.Identifier, e.Message);
            }
        }
コード例 #3
0
        private static void WriteLogitechProperty(VideoCaptureDevice device, CameraProperty value)
        {
            int v = int.Parse(value.CurrentValue, CultureInfo.InvariantCulture);

            device.Logitech_SetExposure(v, !value.Automatic);
        }